28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
"use strict";
|
|
/*---------------------------------------------------------
|
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
*--------------------------------------------------------*/
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.run = void 0;
|
|
const mocha_1 = __importDefault(require("mocha"));
|
|
async function run() {
|
|
const { mochaOpts, files, preload, colorDefault, } = JSON.parse(process.env.VSCODE_TEST_OPTIONS);
|
|
// Create the mocha test
|
|
const mocha = new mocha_1.default({
|
|
ui: 'tdd',
|
|
color: colorDefault,
|
|
...mochaOpts,
|
|
});
|
|
for (const file of preload) {
|
|
require(file);
|
|
}
|
|
for (const file of files) {
|
|
mocha.addFile(file);
|
|
}
|
|
await new Promise((resolve, reject) => mocha.run((failures) => failures ? reject(failures > 1 ? `${failures} tests failed.` : `${failures} test failed.`) : resolve()));
|
|
}
|
|
exports.run = run;
|