Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
denco committed Oct 26, 2023
1 parent e9fd5a7 commit 2a9a164
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import * as path from 'path';

import { runTests } from 'vscode-test';
import { runTests } from '@vscode/test-electron';

async function main() {
try {
Expand All @@ -21,4 +21,4 @@ async function main() {
}
}

main();
main();
47 changes: 24 additions & 23 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';

export function run(): Promise<void> {

const { globSync } = require("glob");

// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
Expand All @@ -12,26 +14,25 @@ export function run(): Promise<void> {
const testsRoot = path.resolve(__dirname, '..');

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
e(err);
}
});

const files = globSync('**/**.test.js', { cwd: testsRoot })

console.log(files);

// Add files to the test suite
files.forEach((f: string) => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run((failures: number) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
e(err);
}
});
}
}

0 comments on commit 2a9a164

Please sign in to comment.