Path: blob/main/test/integration/electron/testrunner.js
3520 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45//@ts-check6'use strict';78const paths = require('path');9const glob = require('glob');10// Linux: prevent a weird NPE when mocha on Linux requires the window size from the TTY11// Since we are not running in a tty environment, we just implement the method statically12const tty = require('tty');13// @ts-ignore14if (!tty.getWindowSize) {15// @ts-ignore16tty.getWindowSize = function () { return [80, 75]; };17}18const Mocha = require('mocha');1920let mocha = new Mocha({21ui: 'tdd',22color: true23});2425exports.configure = function configure(opts) {26mocha = new Mocha(opts);27};2829exports.run = function run(testsRoot, clb) {30// Enable source map support31require('source-map-support').install();3233// Glob test files34glob('**/**.test.js', { cwd: testsRoot }, function (error, files) {35if (error) {36return clb(error);37}38try {39// Fill into Mocha40files.forEach(function (f) { return mocha.addFile(paths.join(testsRoot, f)); });41// Run the tests42mocha.run(function (failures) {43clb(null, failures);44});45}46catch (error) {47return clb(error);48}49});50};515253