vscode-plugin/test/index.ts
tonycheang 28f70f2d31
Line Decoration for Code Nav (#350)
* update: typescript to latest

* add: ts bundling with ts-loader

* add: KiteCodeLensProvider skeleton

* change: wip codelens -> prototype inline decoration

* update: rm vscode devDep in favor of @types/vscode and vscode-test

See https://code.visualstudio.com/updates/v1_36#_splitting-vscode-package-into-typesvscode-and-vscodetest

* improve: consolidate after block to avoid conflicting styles

Long standing vscode bug "Inline decorations can interfere with one another"
https://github.com/microsoft/vscode/issues/33852

* remove: post-install since now using @types/vscode

* update: webpack and webpack-cli to latest

* migrate: to using vscode-test via webpack transpiling

* improve: fix various tests and improve dev test experience

* improve: use link theme color for inline message

* improve: bump kite-api and use getLineDecoration

* add: source-map and typescript test support

* migrate: expect.js -> chai for assertion style testing

* remove: unused deps + update sinon

* test: codenav-decoration
2021-01-13 11:02:31 -08:00

43 lines
1.1 KiB
TypeScript

// This file provides the test runner to use when running extension tests,
// based off the example in VSCode documentation.
process.env.NODE_ENV = "test";
import 'source-map-support/register';
import * as path from 'path';
import * as glob from 'glob';
import Mocha = require('mocha')
export function run(): Promise<void> {
const mocha = new Mocha({
ui: 'bdd', // the TDD UI is being used in extension.test.js (suite, test, etc.)
timeout: 5000,
});
mocha.useColors(true);
const outTestDir = path.resolve(__dirname);
return new Promise((res, rej) => {
glob('*.test.js', { cwd: outTestDir }, (err, files) => {
if (err) {
return rej(err);
}
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(outTestDir, f)));
try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
rej(new Error(`${failures} tests failed.`));
} else {
res();
}
});
} catch (err) {
rej(err);
}
});
});
}