當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript tempy.directory函數代碼示例

本文整理匯總了TypeScript中tempy.directory函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript directory函數的具體用法?TypeScript directory怎麽用?TypeScript directory使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了directory函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it("should not throw if there's no package.json", async (): Promise<void> => {
   const dir = tempy.directory()
   await index(
     ['', getScriptPath(dir), 'pre-push'],
     (): Promise<string> => Promise.resolve('foo')
   )
 })
開發者ID:typicode,項目名稱:husky,代碼行數:7,代碼來源:index.ts

示例2: it

  it('should run working command and return 0 status', (): void => {
    const dir = tempy.directory()
    const filename = path.join(dir, 'package.json')

    fs.writeFileSync(
      filename,
      JSON.stringify({
        scripts: {
          commitmsg: 'echo $GIT_PARAMS GIT_PARAMS HUSKY_GIT_PARAMS',
          precommit: 'npm test'
        }
      }),
      'utf-8'
    )

    index(dir)

    expect(JSON.parse(fs.readFileSync(filename, 'utf-8'))).toEqual({
      husky: {
        hooks: {
          'commit-msg':
            'echo $HUSKY_GIT_PARAMS HUSKY_GIT_PARAMS HUSKY_GIT_PARAMS',
          'pre-commit': 'npm test'
        }
      },
      scripts: {}
    })
  })
開發者ID:typicode,項目名稱:husky,代碼行數:28,代碼來源:index.ts

示例3: it

  it('should return default conf', (): void => {
    const tempDir = tempy.directory()
    fs.writeFileSync(
      path.join(tempDir, 'package.json'),
      JSON.stringify(testConf)
    )

    expect(getConf(tempDir)).toEqual({ skipCI: true, foo: 'bar' })
  })
開發者ID:typicode,項目名稱:husky,代碼行數:9,代碼來源:getConf.ts

示例4: beforeEach

  beforeEach(async () => {
    tmpDir = tempy.directory();
    buildRoot = tempy.directory();
    const fixturesPath = resolve(__dirname, '__fixtures__');

    // Copy all the test fixtures into a tmp dir, as we will be mutating them
    await copy(['**/*'], tmpDir, {
      cwd: fixturesPath,
      dot: true,
      nodir: true,
      parents: true,
    });

    const projects = await getProjects(tmpDir, ['.', './packages/*']);

    for (const project of projects.values()) {
      // This will both install dependencies and generate `yarn.lock` files
      await project.installDependencies({
        extraArgs: ['--silent', '--no-progress'],
      });
    }
  }, timeout);
開發者ID:elastic,項目名稱:kibana,代碼行數:22,代碼來源:build_production_projects.test.ts

示例5: async

    async () => {
      const tmpDir = tempy.directory();
      const buildRoot = tempy.directory();
      const fixturesPath = resolve(__dirname, '__fixtures__');

      // Copy all the test fixtures into a tmp dir, as we will be mutating them
      await copy(['**/*'], tmpDir, {
        cwd: fixturesPath,
        dot: true,
        nodir: true,
        parents: true,
      });

      const projects = await getProjects(tmpDir, ['.', './packages/*']);

      for (const project of projects.values()) {
        // This will both install dependencies and generate `yarn.lock` files
        await project.installDependencies({
          extraArgs: ['--silent', '--no-progress'],
        });
      }

      await buildProductionProjects({ kibanaRoot: tmpDir, buildRoot });

      const files = await globby(['**/*', '!**/node_modules/**'], {
        cwd: buildRoot,
      });

      expect(files.sort()).toMatchSnapshot();

      for (const file of files) {
        if (file.endsWith('package.json')) {
          expect(await readPackageJson(join(buildRoot, file))).toMatchSnapshot(
            file
          );
        }
      }
    },
開發者ID:JinlongHe,項目名稱:kibana,代碼行數:38,代碼來源:build_production_projects.test.ts


注:本文中的tempy.directory函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。