mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
![Inclusive Coding Bot](/assets/img/avatar_default.png)
* Switch to gender neutral terms * Update testrunner.js * Update fileSearchManager.ts * Update fileSearch.ts * Update fileSearch.ts Co-authored-by: inclusive-coding-bot <inclusive-coding-bot@github.com>
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
//@ts-check
|
|
'use strict';
|
|
|
|
const paths = require('path');
|
|
const glob = require('glob');
|
|
// Linux: prevent a weird NPE when mocha on Linux requires the window size from the TTY
|
|
// Since we are not running in a tty environment, we just implement the method statically
|
|
const tty = require('tty');
|
|
// @ts-ignore
|
|
if (!tty.getWindowSize) {
|
|
// @ts-ignore
|
|
tty.getWindowSize = function () { return [80, 75]; };
|
|
}
|
|
const Mocha = require('mocha');
|
|
|
|
let mocha = new Mocha({
|
|
ui: 'tdd',
|
|
color: true
|
|
});
|
|
|
|
exports.configure = function configure(opts) {
|
|
mocha = new Mocha(opts);
|
|
};
|
|
|
|
exports.run = function run(testsRoot, clb) {
|
|
// Enable source map support
|
|
require('source-map-support').install();
|
|
|
|
// Glob test files
|
|
glob('**/**.test.js', { cwd: testsRoot }, function (error, files) {
|
|
if (error) {
|
|
return clb(error);
|
|
}
|
|
try {
|
|
// Fill into Mocha
|
|
files.forEach(function (f) { return mocha.addFile(paths.join(testsRoot, f)); });
|
|
// Run the tests
|
|
mocha.run(function (failures) {
|
|
clb(null, failures);
|
|
});
|
|
}
|
|
catch (error) {
|
|
return clb(error);
|
|
}
|
|
});
|
|
};
|