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


TypeScript fs.exists方法代碼示例

本文整理匯總了TypeScript中@cmt/pr.fs.exists方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript fs.exists方法的具體用法?TypeScript fs.exists怎麽用?TypeScript fs.exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@cmt/pr.fs的用法示例。


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

示例1: test

test('Copy compile_commands.json to a pre-determined path', async () => {
      expect(await fs.exists(compdb_cp_path), 'File shouldn\'t be there!').to.be.false;
      let retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File still shouldn\'t be there').to.be.false;
      testEnv.config.updatePartial({copyCompileCommands: compdb_cp_path});
      retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File wasn\'t copied').to.be.true;
    }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:10,代碼來源:configure-and-build.test.ts

示例2: test

  test('Test scan of mingw', async () => {
    const kits = await scanForKits({
      scanDirs: [],
      minGWSearchDirs: mingw_dirs,
    });
    const is_kit_MinGW_present = kits.find(kit => kit.name.indexOf('GCC for i686-w64-mingw32 4.9.2') >= 0) ? true : false;
    const is_kit_MinGW_w64_present = kits.find(kit => kit.name.indexOf('GCC for x86_64-w64-mingw32 7.2.0') >= 0) ? true : false;
    console.log(JSON.stringify(kits, null, 2));

    if (await fs.exists(mingw_dirs[0])) {
      expect(is_kit_MinGW_present).to.equal(true);
    }
    if (await fs.exists(mingw_dirs[1])) {
      expect(is_kit_MinGW_w64_present).to.equal(true);
    }
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:16,代碼來源:scan_kits.test.ts

示例3: suiteTeardown

 suiteTeardown(async () => {
   if (testEnv) {
     testEnv.teardown();
   }
   if (await fs.exists(compdb_cp_path)) {
     await fs.unlink(compdb_cp_path);
   }
 });
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:8,代碼來源:configure-and-build.test.ts

示例4: teardown

  teardown(async function(this: Mocha.IBeforeAndAfterContext) {
    const variantFileBackup = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
    if (await fs.exists(variantFileBackup)) {
      const variantFile = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
      await fs.rename(variantFileBackup, variantFile);
    }

    this.timeout(30000);
    await cmt.asyncDispose();
    testEnv.teardown();
  });
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:11,代碼來源:variant-envs.test.ts

示例5: test

  test('Replace default variant', async () => {
    const variantFile = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
    const variantFileBackup = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json.backup');
    await fs.rename(variantFile, variantFileBackup);
    expect(await fs.exists(variantFile)).to.be.false;

    // Set fake settings
    testEnv.config.updatePartial({
      defaultVariants: {
        buildType: {
          default: 'debug-label',
          choices: {
            'debug-label': {short: 'debug-label short', buildType: 'Debug'},
            'not-debug': {short: 'not-debug short', buildType: 'Release'}
          }
        },
        otherVariant: {
          default: 'option1',
          choices: {
            option1: {short: 'option1 short', env: {TEST_VARIANT_ENV: '0xCAFE'}},
            option2: {short: 'option2 short'}
          }
        }
      }
    });

    try {
      // Configure
      expect(await cmt.configure()).to.be.eq(0, '[variantEnv] configure failed');
      expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
      const cache = await CMakeCache.fromPath(await cmt.cachePath);

      const cacheEntry_ = cache.get('variantEnv');
      expect(cacheEntry_).to.not.be.eq(null, '[variantEnv] Cache entry was not present');
      const cacheEntry = cacheEntry_!;
      expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[variantEnv] unexpected cache entry type');
      expect(cacheEntry.key).to.eq('variantEnv', '[variantEnv] unexpected cache entry key name');
      expect(typeof cacheEntry.value).to.eq('string', '[variantEnv] unexpected cache entry value type');
      expect(cacheEntry.as<string>()).to.eq('0xCAFE', '[variantEnv] incorrect environment variable');
    } finally {
      // Restore the vairants file to before the test
      await fs.rename(variantFileBackup, variantFile);
    }
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:44,代碼來源:variant-envs.test.ts

示例6: teardown

 teardown(async () => {
   if (await fs.exists(test_file_path)) {
     await fs.unlink(test_file_path);
   }
 });
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:5,代碼來源:dirty.test.ts


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