Skip to content

Commit f76020e

Browse files
committed
module interop
1 parent ea0c03c commit f76020e

4 files changed

Lines changed: 21 additions & 29 deletions

File tree

src/test/runTests.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ import { runTests } from 'vscode-test';
88

99
async function main() {
1010
try {
11-
// The folder containing the Extension Manifest package.json
12-
// Passed to `--extensionDevelopmentPath`
1311
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
14-
15-
// The path to test runner
16-
// Passed to --extensionTestsPath
1712
const extensionTestsPath = path.resolve(__dirname, './suite/index');
1813

19-
// Download VS Code, unzip it and run the integration test
20-
await runTests({ extensionDevelopmentPath, extensionTestsPath });
14+
await runTests({
15+
extensionDevelopmentPath,
16+
extensionTestsPath,
17+
});
2118
} catch (err) {
2219
console.error(err);
2320
console.error('Failed to run tests');

src/test/suite/extension.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,3 @@ suite('Extension Test Suite', () => {
1818
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
1919
});
2020
});
21-
22-
function sleep(ms: number): Promise<void> {
23-
return new Promise(resolve => {
24-
setTimeout(resolve, ms);
25-
});
26-
}

src/test/suite/index.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
* Copyright (c) Applied Eng & Design All rights reserved.
33
* Licensed under the MIT License. See License.md in the project root for license information.
44
* -------------------------------------------------------------------------------------------- */
5-
import * as path from 'path';
6-
import * as Mocha from 'mocha';
7-
import * as glob from 'glob';
5+
import path from 'path';
6+
import Mocha from 'mocha';
7+
import glob from 'glob';
88

9-
export function run(): Promise<void> {
9+
export const run = (testsRoot: string): Promise<void> => {
1010
// Create the mocha test
1111
const mocha = new Mocha({
1212
ui: 'tdd',
13+
timeout: 15000,
1314
color: true,
1415
});
1516

16-
const testsRoot = path.resolve(__dirname, '..');
17-
1817
return new Promise((c, e) => {
19-
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
20-
if (err) {
21-
return e(err);
18+
glob('**/**.test.js', { cwd: testsRoot }, (error, files) => {
19+
if (error) {
20+
return e(error);
2221
}
2322

24-
// Add files to the test suite
25-
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
26-
2723
try {
24+
files.forEach((file: string) => mocha.addFile(path.resolve(testsRoot, file)));
2825
// Run the mocha test
29-
mocha.run(failures => {
26+
mocha.run((failures: number) => {
3027
if (failures > 0) {
3128
e(new Error(`${failures} tests failed.`));
3229
} else {
@@ -38,4 +35,4 @@ export function run(): Promise<void> {
3835
}
3936
});
4037
});
41-
}
38+
};

tsconfig.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
"rootDir": "src",
1212
"strict": true,
1313
"resolveJsonModule": true,
14-
"newLine": "lf"
14+
"newLine": "lf",
15+
"removeComments": true,
16+
"esModuleInterop": true,
17+
"forceConsistentCasingInFileNames": true,
18+
"skipLibCheck": true
1519
},
1620
"exclude": [
1721
"node_modules",
18-
".vscode-test"
22+
"samplenc",
1923
]
2024
}

0 commit comments

Comments
 (0)