本文整理匯總了TypeScript中@test/util.DefaultEnvironment類的典型用法代碼示例。如果您正苦於以下問題:TypeScript DefaultEnvironment類的具體用法?TypeScript DefaultEnvironment怎麽用?TypeScript DefaultEnvironment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DefaultEnvironment類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: suite
suite('[Toolchain Substitution]', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
if (process.platform === 'win32')
this.skip();
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', 'build', 'output.txt');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
const kits = await kitsAvailableInWorkspaceDirectory(testEnv.projectFolder.location);
const tc_kit = kits.find(k => k.name === 'Test Toolchain');
expect(tc_kit).to.not.eq(undefined);
// Set preferred generators
testEnv.config.updatePartial({preferredGenerators: ['Unix Makefiles']});
await cmt.setKit(tc_kit!);
testEnv.projectFolder.buildDirectory.clear();
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});
test('Check substitution within toolchain kits', async () => {
// Configure
expect(await cmt.configure()).to.be.eq(0, '[toolchain] 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('CMAKE_TOOLCHAIN_FILE') as api.CacheEntry;
// tslint:disable-next-line:no-unused-expression
expect(cacheEntry).to.not.be.null;
expect(cacheEntry.key).to.eq('CMAKE_TOOLCHAIN_FILE', '[toolchain] unexpected cache entry key name');
expect(platformNormalizePath(cacheEntry.as<string>()))
.to.eq(platformNormalizePath(testEnv.projectFolder.location.concat('/test-toolchain.cmake')),
'[toolchain] substitution incorrect');
}).timeout(100000);
});
示例2: suite
suite('cmake', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
const build_loc = 'build';
const exe_res = 'output.txt';
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', build_loc, exe_res);
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
// This test will use all on the same kit.
// No rescan of the tools is needed
// No new kit selection is needed
await clearExistingKitConfigurationFile();
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});
test('No cmake present message', async () => {
testEnv.config.updatePartial({cmakePath: 'cmake3'});
await cmt.allTargetName; // Using an cmaketools command which creates the instance once.
expect(testEnv.errorMessagesQueue.length).to.eql(1); // Expect only cmake error message
expect(testEnv.errorMessagesQueue[0])
.to.be.contains('Is it installed or settings contain the correct path (cmake.cmakePath)?');
}).timeout(60000);
});
示例3: suite
suite('[Debug/Lauch interface]', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', 'build', 'output.txt');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
expect(await cmt.build()).to.be.eq(0);
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});
test('Test call of debugger', async () => {
const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);
await cmt.debugTarget();
sinon.assert.calledWith(testEnv.vs_debug_start_debugging);
}).timeout(60000);
test('Test launchTargetPath for use in other extensions or launch.json', async () => {
const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);
expect(await cmt.launchTargetPath()).to.be.eq(executablesTargets[0].path);
});
test('Test build on launch (default)', async () => {
testEnv.config.updatePartial({buildBeforeRun: undefined});
const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);
const launchProgrammPath = await cmt.launchTargetPath();
expect(launchProgrammPath).to.be.not.null;
const validPath: string = launchProgrammPath!;
// Check that the compiled files does not exist
fs.unlinkSync(validPath);
expect(fs.existsSync(validPath)).to.be.false;
await cmt.launchTargetPath();
// Check that it is compiled as a new file
expect(fs.existsSync(validPath)).to.be.false;
}).timeout(60000);
test('Test build on launch on by config', async () => {
testEnv.config.updatePartial({buildBeforeRun: true});
const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);
const launchProgrammPath = await cmt.launchTargetPath();
expect(launchProgrammPath).to.be.not.null;
const validPath: string = launchProgrammPath!;
// Check that the compiled files does not exist
fs.unlinkSync(validPath);
expect(fs.existsSync(validPath)).to.be.false;
await cmt.launchTargetPath();
// Check that it is compiled as a new file
expect(fs.existsSync(validPath)).to.be.true;
}).timeout(60000);
test('Test build on launch off by config', async () => {
testEnv.config.updatePartial({buildBeforeRun: false});
const executablesTargets = await cmt.executableTargets;
expect(executablesTargets.length).to.be.not.eq(0);
await cmt.setLaunchTargetByName(executablesTargets[0].name);
const launchProgrammPath = await cmt.launchTargetPath();
expect(launchProgrammPath).to.be.not.null;
const validPath: string = launchProgrammPath!;
// Check that the compiled files does not exist
fs.unlinkSync(validPath);
expect(fs.existsSync(validPath)).to.be.false;
await cmt.launchTargetPath();
// Check that it is compiled as a new file
expect(fs.existsSync(validPath)).to.be.false;
}).timeout(60000);
//.........這裏部分代碼省略.........
示例4: suite
suite('[Environment]', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', 'build', 'output.txt');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
// This test will use all on the same kit.
// No rescan of the tools is needed
// No new kit selection is needed
await clearExistingKitConfigurationFile();
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});
test('Passing env-vars to CMake but not to the compiler', async () => {
// Set fake settings
testEnv.config.updatePartial({
configureEnvironment: {
_CONFIGURE_ENV: '${workspaceRootFolderName}',
},
});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[configureEnvironment] 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('configureEnvironment') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[configureEnvironment] unexpected cache entry type');
expect(cacheEntry.key).to.eq('configureEnvironment', '[configureEnvironment] unexpected cache entry key name');
expect(cacheEntry.as<string>())
.to.eq(path.basename(testEnv.projectFolder.location), '[configureEnvironment] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[configureEnvironment] unexpected cache entry value type');
// Build
expect(await cmt.build()).to.be.eq(0, '[configureEnvironment] build failed');
const result = await testEnv.result.getResultAsJson();
expect(result['configure-env']).to.eq('', '[configureEnvironment] env-var got passed to compiler');
}).timeout(100000);
test('Passing env-vars to the compiler but not to CMake', async () => {
// Set fake settings
testEnv.config.updatePartial({buildEnvironment: {_BUILD_ENV: '${workspaceRootFolderName}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[buildEnvironment] 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('buildEnvironment') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[buildEnvironment] unexpected cache entry type');
expect(cacheEntry.key).to.eq('buildEnvironment', '[buildEnvironment] unexpected cache entry key name');
expect(cacheEntry.as<string>()).to.be.eq('', '[buildEnvironment] env-var got passed to CMake');
expect(typeof cacheEntry.value).to.eq('string', '[buildEnvironment] unexpected cache entry value type');
// Build
expect(await cmt.build()).to.be.eq(0, '[buildEnvironment] build failed');
const result = await testEnv.result.getResultAsJson();
expect(result['build-env'])
.to.eq(path.basename(testEnv.projectFolder.location), '[buildEnvironment] substitution incorrect');
}).timeout(100000);
test('Passing env-vars to CMake AND to the compiler', async () => {
// Set fake settings
testEnv.config.updatePartial({environment: {_ENV: '${workspaceRootFolderName}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[environment] 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('environment') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[environment] unexpected cache entry type');
expect(cacheEntry.key).to.eq('environment', '[environment] unexpected cache entry key name');
expect(cacheEntry.as<string>())
.to.eq(path.basename(testEnv.projectFolder.location), '[environment] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[environment] unexpected cache entry value type');
// Build
expect(await cmt.build()).to.be.eq(0, '[environment] build failed');
const result = await testEnv.result.getResultAsJson();
expect(result['env']).to.eq(path.basename(testEnv.projectFolder.location), '[environment] substitution incorrect');
}).timeout(100000);
});
示例5: suite
suite('[Variable Substitution]', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', 'build', 'output.txt');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
// This test will use all on the same kit.
// No rescan of the tools is needed
// No new kit selection is needed
await clearExistingKitConfigurationFile();
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});
test('Check substitution for "workspaceRoot"', async () => {
// Set fake settings
testEnv.config.updatePartial({configureSettings: {workspaceRoot: '${workspaceRoot}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[workspaceRoot] 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('workspaceRoot') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[workspaceRoot] unexpected cache entry type');
expect(cacheEntry.key).to.eq('workspaceRoot', '[workspaceRoot] unexpected cache entry key name');
expect(platformNormalizePath(cacheEntry.as<string>()))
.to.eq(platformNormalizePath(testEnv.projectFolder.location), '[workspaceRoot] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[workspaceRoot] unexpected cache entry value type');
}).timeout(100000);
test('Check substitution for "workspaceFolder"', async () => {
// Set fake settings
testEnv.config.updatePartial({configureSettings: {workspaceFolder: '${workspaceFolder}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[workspaceFolder] 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('workspaceFolder') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[workspaceFolder] unexpected cache entry type');
expect(cacheEntry.key).to.eq('workspaceFolder', '[workspaceFolder] unexpected cache entry key name');
expect(platformNormalizePath(cacheEntry.as<string>()))
.to.eq(platformNormalizePath(testEnv.projectFolder.location), '[workspaceFolder] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[workspaceFolder] unexpected cache entry value type');
}).timeout(100000);
test('Check substitution for "buildType"', async () => {
// Set fake settings
testEnv.config.updatePartial({configureSettings: {buildType: '${buildType}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[buildType] 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('buildType') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[buildType] unexpected cache entry type');
expect(cacheEntry.key).to.eq('buildType', '[buildType] unexpected cache entry key name');
expect(cacheEntry.as<string>()).to.eq('Debug', '[buildType] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[buildType] unexpected cache entry value type');
}).timeout(100000);
test('Check substitution for "buildKit"', async () => {
// Set fake settings
testEnv.config.updatePartial({configureSettings: {buildKit: '${buildKit}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[buildKit] 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('buildKit') as api.CacheEntry;
expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[buildKit] unexpected cache entry type');
expect(cacheEntry.key).to.eq('buildKit', '[buildKit] unexpected cache entry key name');
const kit = cmt.activeKit;
expect(cacheEntry.as<string>()).to.eq(kit!.name, '[buildKit] substitution incorrect');
expect(typeof cacheEntry.value).to.eq('string', '[buildKit] unexpected cache entry value type');
}).timeout(100000);
test('Check substitution for "workspaceRootFolderName"', async () => {
// Set fake settings
testEnv.config.updatePartial({configureSettings: {workspaceRootFolderName: '${workspaceRootFolderName}'}});
// Configure
expect(await cmt.configure()).to.be.eq(0, '[workspaceRootFolderName] configure failed');
expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
const cache = await CMakeCache.fromPath(await cmt.cachePath);
//.........這裏部分代碼省略.........
示例6: suite
suite('Build', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
let compdb_cp_path: string;
suiteSetup(async function(this: Mocha.IHookCallbackContext) {
this.timeout(100000);
const build_loc = 'build';
const exe_res = 'output.txt';
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', build_loc, exe_res);
compdb_cp_path = path.join(testEnv.projectFolder.location, 'compdb_cp.json');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
// This test will use all on the same kit.
// No rescan of the tools is needed
// No new kit selection is needed
await clearExistingKitConfigurationFile();
await cmt.asyncDispose();
});
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
});
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
await cmt.asyncDispose();
testEnv.clean();
});
suiteTeardown(async () => {
if (testEnv) {
testEnv.teardown();
}
if (await fs.exists(compdb_cp_path)) {
await fs.unlink(compdb_cp_path);
}
});
test('Configure', async () => {
expect(await cmt.configure()).to.be.eq(0);
expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'no expected cache present');
}).timeout(100000);
test('Build', async () => {
expect(await cmt.build()).to.be.eq(0);
const result = await testEnv.result.getResultAsJson();
expect(result['cookie']).to.eq('passed-cookie');
}).timeout(100000);
test('Configure and Build', async () => {
expect(await cmt.configure()).to.be.eq(0);
expect(await cmt.build()).to.be.eq(0);
const result = await testEnv.result.getResultAsJson();
expect(result['cookie']).to.eq('passed-cookie');
}).timeout(100000);
test('Configure and Build run target', async () => {
expect(await cmt.configure()).to.be.eq(0);
const targets = await cmt.targets;
const runTestTargetElement = targets.find(item => item.name === 'runTestTarget');
expect(runTestTargetElement).to.be.not.an('undefined');
await cmt.setDefaultTarget('runTestTarget');
expect(await cmt.build()).to.be.eq(0);
const resultFile = new TestProgramResult(testEnv.projectFolder.buildDirectory.location, 'output_target.txt');
const result = await resultFile.getResultAsJson();
expect(result['cookie']).to.eq('passed-cookie');
}).timeout(100000);
test('Configure with cache-initializer', async () => {
testEnv.config.updatePartial({cacheInit: 'TestCacheInit.cmake'});
expect(await cmt.configure()).to.be.eq(0);
await cmt.setDefaultTarget('runTestTarget');
expect(await cmt.build()).to.be.eq(0);
const resultFile = new TestProgramResult(testEnv.projectFolder.buildDirectory.location, 'output_target.txt');
const result = await resultFile.getResultAsJson();
expect(result['cookie']).to.eq('cache-init-cookie');
}).timeout(100000);
test('Test kit switch after missing preferred generator', async function(this: ITestCallbackContext) {
// Select compiler build node dependent
const os_compilers: {[osName: string]: {kitLabel: RegExp, compiler: string}[]} = {
linux: [{kitLabel: /^GCC \d/, compiler: 'GNU'}, {kitLabel: /^Clang \d/, compiler: 'Clang'}],
win32: [{kitLabel: /^GCC \d/, compiler: 'GNU'}, {kitLabel: /^VisualStudio/, compiler: 'MSVC'}]
};
if (!(workername in os_compilers))
this.skip();
//.........這裏部分代碼省略.........
示例7: suite
suite('[Environment Variables in Variants]', async () => {
let cmt: CMakeTools;
let testEnv: DefaultEnvironment;
setup(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(100000);
testEnv = new DefaultEnvironment('test/extension-tests/successful-build/project-folder', 'build', 'output.txt');
cmt = await CMakeTools.create(testEnv.vsContext, testEnv.wsContext);
// This test will use all on the same kit.
// No rescan of the tools is needed
// No new kit selection is needed
await clearExistingKitConfigurationFile();
await cmt.setKit(await getFirstSystemKit());
testEnv.projectFolder.buildDirectory.clear();
});
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();
});
test('Check for environment variables being passed to configure', async () => {
// Set fake settings
// 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('0cbfb6ae-f2ec-4017-8ded-89df8759c502', '[variantEnv] incorrect environment variable');
}).timeout(100000);
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);
});
示例8: suiteTeardown
suiteTeardown(async () => {
if (testEnv) {
testEnv.teardown();
}
if (await fs.exists(compdb_cp_path)) {
await fs.unlink(compdb_cp_path);
}
});
示例9: 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();
});
示例10: teardown
teardown(async function(this: Mocha.IBeforeAndAfterContext) {
this.timeout(30000);
await cmt.asyncDispose();
testEnv.teardown();
});