当前位置: 首页>>代码示例>>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;未经允许,请勿转载。