34 lines
794 B
TypeScript
34 lines
794 B
TypeScript
import * as path from 'path';
|
|
import * as fs from 'fs';
|
|
import Mocha from 'mocha';
|
|
|
|
export function run(): Promise<void> {
|
|
// Create the mocha test
|
|
const mocha = new Mocha({
|
|
ui: 'tdd',
|
|
color: true
|
|
});
|
|
|
|
const testsRoot = path.resolve(__dirname, '..');
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
try {
|
|
// Simple approach - add extension.test.js directly
|
|
// This will find our basic test file
|
|
mocha.addFile(path.resolve(testsRoot, 'test/extension.test.js'));
|
|
|
|
// Run the mocha test
|
|
mocha.run((failures: number) => {
|
|
if (failures > 0) {
|
|
reject(new Error(`${failures} tests failed.`));
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
} catch (err) {
|
|
console.error(err);
|
|
reject(err);
|
|
}
|
|
});
|
|
}
|