mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge vscode 1.67 (#20883)
* Fix initial build breaks from 1.67 merge (#2514) * Update yarn lock files * Update build scripts * Fix tsconfig * Build breaks * WIP * Update yarn lock files * Misc breaks * Updates to package.json * Breaks * Update yarn * Fix breaks * Breaks * Build breaks * Breaks * Breaks * Breaks * Breaks * Breaks * Missing file * Breaks * Breaks * Breaks * Breaks * Breaks * Fix several runtime breaks (#2515) * Missing files * Runtime breaks * Fix proxy ordering issue * Remove commented code * Fix breaks with opening query editor * Fix post merge break * Updates related to setup build and other breaks (#2516) * Fix bundle build issues * Update distro * Fix distro merge and update build JS files * Disable pipeline steps * Remove stats call * Update license name * Make new RPM dependencies a warning * Fix extension manager version checks * Update JS file * Fix a few runtime breaks * Fixes * Fix runtime issues * Fix build breaks * Update notebook tests (part 1) * Fix broken tests * Linting errors * Fix hygiene * Disable lint rules * Bump distro * Turn off smoke tests * Disable integration tests * Remove failing "activate" test * Remove failed test assertion * Disable other broken test * Disable query history tests * Disable extension unit tests * Disable failing tasks
This commit is contained in:
@@ -16,7 +16,7 @@ For instance, `./scripts/test.sh --debug --glob **/extHost*.test.js` runs all te
|
||||
|
||||
yarn test-browser --browser webkit --browser chromium
|
||||
|
||||
Unit tests from layers `common` and `browser` are run inside `chromium`, `webkit`, and (soon’ish) `firefox` (using playwright). This complements our electron-based unit test runner and adds more coverage of supported platforms. Notes:
|
||||
Unit tests from layers `common` and `browser` are run inside `chromium`, `webkit`, and (soon'ish) `firefox` (using playwright). This complements our electron-based unit test runner and adds more coverage of supported platforms. Notes:
|
||||
|
||||
- these tests are part of the continuous build, that means you might have test failures that only happen with webkit on _windows_ or _chromium_ on linux
|
||||
- you can run these tests locally via yarn `test-browser --browser chromium --browser webkit`
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const glob = require('glob');
|
||||
@@ -13,7 +14,7 @@ const createStatsCollector = require('../../../node_modules/mocha/lib/stats-coll
|
||||
const MochaJUnitReporter = require('mocha-junit-reporter');
|
||||
const url = require('url');
|
||||
const minimatch = require('minimatch');
|
||||
const playwright = require('playwright');
|
||||
const playwright = require('@playwright/test');
|
||||
const { applyReporter } = require('../reporter');
|
||||
|
||||
// opts
|
||||
@@ -24,6 +25,7 @@ const optimist = require('optimist')
|
||||
.describe('run', 'only run tests matching <relative_file_path>').string('run')
|
||||
.describe('grep', 'only run tests matching <pattern>').alias('grep', 'g').alias('grep', 'f').string('grep')
|
||||
.describe('debug', 'do not run browsers headless').alias('debug', ['debug-browser']).boolean('debug')
|
||||
.describe('sequential', 'only run suites for a single browser at a time').boolean('sequential')
|
||||
.describe('browser', 'browsers in which tests should run').string('browser').default('browser', ['chromium', 'firefox', 'webkit'])
|
||||
.describe('reporter', 'the mocha reporter').string('reporter').default('reporter', defaultReporterName)
|
||||
.describe('reporter-options', 'the mocha reporter options').string('reporter-options').default('reporter-options', '')
|
||||
@@ -49,12 +51,12 @@ const withReporter = (function () {
|
||||
mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${browserType}-${argv.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return (_, runner) => applyReporter(runner, argv);
|
||||
}
|
||||
})()
|
||||
})();
|
||||
|
||||
const outdir = argv.build ? 'out-build' : 'out';
|
||||
const out = path.join(__dirname, `../../../${outdir}`);
|
||||
@@ -81,7 +83,7 @@ const testModules = (async function () {
|
||||
} else {
|
||||
// glob patterns (--glob)
|
||||
const defaultGlob = '**/*.test.js';
|
||||
const pattern = argv.run || defaultGlob
|
||||
const pattern = argv.run || defaultGlob;
|
||||
isDefaultModules = pattern === defaultGlob;
|
||||
|
||||
promise = new Promise((resolve, reject) => {
|
||||
@@ -89,7 +91,7 @@ const testModules = (async function () {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(files)
|
||||
resolve(files);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -106,7 +108,7 @@ const testModules = (async function () {
|
||||
}
|
||||
}
|
||||
return modules;
|
||||
})
|
||||
});
|
||||
})();
|
||||
|
||||
function consoleLogFn(msg) {
|
||||
@@ -135,7 +137,7 @@ async function runTestsInBrowser(testModules, browserType) {
|
||||
|
||||
const emitter = new events.EventEmitter();
|
||||
await page.exposeFunction('mocha_report', (type, data1, data2) => {
|
||||
emitter.emit(type, data1, data2)
|
||||
emitter.emit(type, data1, data2);
|
||||
});
|
||||
|
||||
page.on('console', async msg => {
|
||||
@@ -234,18 +236,25 @@ testModules.then(async modules => {
|
||||
const browserTypes = Array.isArray(argv.browser)
|
||||
? argv.browser : [argv.browser];
|
||||
|
||||
const promises = browserTypes.map(async browserType => {
|
||||
try {
|
||||
return await runTestsInBrowser(modules, browserType);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
let messages = [];
|
||||
let didFail = false;
|
||||
|
||||
try {
|
||||
if (argv.sequential) {
|
||||
for (const browserType of browserTypes) {
|
||||
messages.push(await runTestsInBrowser(modules, browserType));
|
||||
}
|
||||
} else {
|
||||
messages = await Promise.all(browserTypes.map(async browserType => {
|
||||
return await runTestsInBrowser(modules, browserType);
|
||||
}));
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// aftermath
|
||||
let didFail = false;
|
||||
const messages = await Promise.all(promises);
|
||||
for (let msg of messages) {
|
||||
if (msg) {
|
||||
didFail = true;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
'sinon-test': new URL('../../../node_modules/sinon-test/dist/sinon-test.js', baseUrl).href,
|
||||
xterm: new URL('../../../node_modules/xterm/lib/xterm.js', baseUrl).href,
|
||||
sql: new URL(`../../../${!!isBuild ? 'out-build' : 'out'}/sql`, baseUrl).href, // {{SQL CARBON EDIT}}
|
||||
'iconv-lite-umd': new URL('../../../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js', baseUrl).href,
|
||||
'@vscode/iconv-lite-umd': new URL('../../../node_modules/@vscode/iconv-lite-umd/lib/iconv-lite-umd.js', baseUrl).href,
|
||||
jschardet: new URL('../../../node_modules/jschardet/dist/jschardet.min.js', baseUrl).href
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
// come before any mocha imports.
|
||||
process.env.MOCHA_COLORS = '1';
|
||||
|
||||
const { app, BrowserWindow, ipcMain } = require('electron');
|
||||
const { app, BrowserWindow, ipcMain, crashReporter } = require('electron');
|
||||
const product = require('../../../product.json');
|
||||
const { tmpdir } = require('os');
|
||||
const { join } = require('path');
|
||||
const { existsSync, mkdirSync } = require('fs');
|
||||
const path = require('path');
|
||||
const mocha = require('mocha');
|
||||
const events = require('events');
|
||||
@@ -19,10 +20,6 @@ const net = require('net');
|
||||
const createStatsCollector = require('mocha/lib/stats-collector');
|
||||
const { applyReporter, importMochaReporter } = require('../reporter');
|
||||
|
||||
// Disable render process reuse, we still have
|
||||
// non-context aware native modules in the renderer.
|
||||
app.allowRendererProcessReuse = false;
|
||||
|
||||
const optimist = require('optimist')
|
||||
.describe('grep', 'only run tests matching <pattern>').alias('grep', 'g').alias('grep', 'f').string('grep')
|
||||
.describe('invert', 'uses the inverse of the match specified by grep').alias('invert', 'i').string('invert') // {{SQL CARBON EDIT}}
|
||||
@@ -35,6 +32,7 @@ const optimist = require('optimist')
|
||||
.describe('reporter-options', 'the mocha reporter options').string('reporter-options').default('reporter-options', '')
|
||||
.describe('wait-server', 'port to connect to and wait before running tests')
|
||||
.describe('timeout', 'timeout for tests')
|
||||
.describe('crash-reporter-directory', 'crash reporter directory').string('crash-reporter-directory')
|
||||
.describe('tfs').string('tfs')
|
||||
.describe('help', 'show the help').alias('help', 'h');
|
||||
|
||||
@@ -53,8 +51,39 @@ if (argv.help) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
let crashReporterDirectory = argv['crash-reporter-directory'];
|
||||
if (crashReporterDirectory) {
|
||||
crashReporterDirectory = path.normalize(crashReporterDirectory);
|
||||
|
||||
if (!path.isAbsolute(crashReporterDirectory)) {
|
||||
console.error(`The path '${crashReporterDirectory}' specified for --crash-reporter-directory must be absolute.`);
|
||||
app.exit(1);
|
||||
}
|
||||
|
||||
if (!existsSync(crashReporterDirectory)) {
|
||||
try {
|
||||
mkdirSync(crashReporterDirectory);
|
||||
} catch (error) {
|
||||
console.error(`The path '${crashReporterDirectory}' specified for --crash-reporter-directory does not seem to exist or cannot be created.`);
|
||||
app.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Crashes are stored in the crashDumps directory by default, so we
|
||||
// need to change that directory to the provided one
|
||||
console.log(`Found --crash-reporter-directory argument. Setting crashDumps directory to be '${crashReporterDirectory}'`);
|
||||
app.setPath('crashDumps', crashReporterDirectory);
|
||||
|
||||
crashReporter.start({
|
||||
companyName: 'Microsoft',
|
||||
productName: process.env['VSCODE_DEV'] ? `${product.nameShort} Dev` : product.nameShort,
|
||||
uploadToServer: false,
|
||||
compress: true
|
||||
});
|
||||
}
|
||||
|
||||
if (!argv.debug) {
|
||||
app.setPath('userData', join(tmpdir(), `vscode-tests-${Date.now()}`));
|
||||
app.setPath('userData', path.join(tmpdir(), `vscode-tests-${Date.now()}`));
|
||||
}
|
||||
|
||||
function deserializeSuite(suite) {
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
['rmdir', 1],
|
||||
].forEach((element) => {
|
||||
intercept(element[0], element[1]);
|
||||
})
|
||||
});
|
||||
})();
|
||||
|
||||
const { ipcRenderer } = require('electron');
|
||||
@@ -129,10 +129,10 @@ function createCoverageReport(opts) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
function loadWorkbenchTestingModule() {
|
||||
function loadWorkbenchTestingUtilsModule() {
|
||||
return new Promise((resolve, reject) => {
|
||||
loader.require(['vs/workbench/test/electron-browser/testing'], resolve, reject);
|
||||
})
|
||||
loader.require(['vs/workbench/test/common/utils'], resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
function loadTestModules(opts) {
|
||||
@@ -198,7 +198,7 @@ function loadTests(opts) {
|
||||
});
|
||||
});
|
||||
|
||||
return loadWorkbenchTestingModule().then((workbenchTestingModule) => {
|
||||
return loadWorkbenchTestingUtilsModule().then((workbenchTestingModule) => {
|
||||
const assertCleanState = workbenchTestingModule.assertCleanState;
|
||||
|
||||
suite('Tests are using suiteSetup and setup correctly', () => {
|
||||
@@ -225,7 +225,7 @@ function loadTests(opts) {
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function serializeSuite(suite) {
|
||||
|
||||
@@ -42,7 +42,7 @@ module.exports = class FullJsonStreamReporter extends BaseRunner {
|
||||
writeEvent(['fail', test]);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function writeEvent(event) {
|
||||
process.stdout.write(JSON.stringify(event) + '\n');
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const yaserver = require('yaserver');
|
||||
const http = require('http');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../../');
|
||||
const PORT = 8887;
|
||||
|
||||
function template(str, env) {
|
||||
return str.replace(/{{\s*([\w_\-]+)\s*}}/g, function (all, part) {
|
||||
return env[part];
|
||||
});
|
||||
}
|
||||
|
||||
yaserver.createServer({ rootDir: REPO_ROOT }).then((staticServer) => {
|
||||
const server = http.createServer((req, res) => {
|
||||
if (req.url === '' || req.url === '/') {
|
||||
glob('**/vs/{base,platform,editor}/**/test/{common,browser}/**/*.test.js', {
|
||||
cwd: path.join(REPO_ROOT, 'out'),
|
||||
// ignore: ['**/test/{node,electron*}/**/*.js']
|
||||
}, function (err, files) {
|
||||
if (err) { console.log(err); process.exit(0); }
|
||||
|
||||
var modules = files
|
||||
.map(function (file) { return file.replace(/\.js$/, ''); });
|
||||
|
||||
fs.readFile(path.join(__dirname, 'index.html'), 'utf8', function (err, templateString) {
|
||||
if (err) { console.log(err); process.exit(0); }
|
||||
|
||||
res.end(template(templateString, {
|
||||
modules: JSON.stringify(modules)
|
||||
}));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return staticServer.handle(req, res);
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`http://localhost:${PORT}/`);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
define([], function() {
|
||||
return {
|
||||
load: function(name, req, load) {
|
||||
load({});
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>VSCode Tests</title>
|
||||
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
|
||||
<script src="/out/vs/loader.js"></script>
|
||||
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
|
||||
|
||||
<script>
|
||||
mocha.setup('tdd');
|
||||
|
||||
require.config({
|
||||
baseUrl: '/out',
|
||||
paths: {
|
||||
assert: '/test/unit/assert.js',
|
||||
sinon: '/node_modules/sinon/pkg/sinon.js',
|
||||
'sinon-test': '/node_modules/sinon-test/dist/sinon-test.js'
|
||||
}
|
||||
});
|
||||
|
||||
require({{ modules }}, function () {
|
||||
mocha.run();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,25 +3,39 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/*eslint-env mocha*/
|
||||
/*global define,run*/
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
process.env.MOCHA_COLORS = '1'; // Force colors (note that this must come before any mocha imports)
|
||||
|
||||
const assert = require('assert');
|
||||
const mocha = require('mocha');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
const jsdom = require('jsdom-no-contextify');
|
||||
const TEST_GLOB = '**/test/**/*.test.js';
|
||||
const minimatch = require('minimatch');
|
||||
const coverage = require('../coverage');
|
||||
|
||||
const optimist = require('optimist')
|
||||
.usage('Run the Code tests. All mocha options apply.')
|
||||
.describe('build', 'Run from out-build').boolean('build')
|
||||
.describe('run', 'Run a single file').string('run')
|
||||
.describe('coverage', 'Generate a coverage report').boolean('coverage')
|
||||
.describe('browser', 'Run tests in a browser').boolean('browser')
|
||||
.alias('h', 'help').boolean('h')
|
||||
.describe('h', 'Show help');
|
||||
|
||||
|
||||
const TEST_GLOB = '**/test/**/*.test.js';
|
||||
|
||||
const excludeGlobs = [
|
||||
'**/{browser,electron-sandbox,electron-browser,electron-main}/**/*.test.js',
|
||||
'**/vs/platform/environment/test/node/nativeModules.test.js', // native modules are compiled against Electron and this test would fail with node.js
|
||||
'**/vs/base/parts/storage/test/node/storage.test.js', // same as above, due to direct dependency to sqlite native module
|
||||
'**/vs/workbench/contrib/testing/test/**' // flaky (https://github.com/microsoft/vscode/issues/137853)
|
||||
];
|
||||
|
||||
/**
|
||||
* @type {{ build: boolean; run: string; runGlob: string; coverage: boolean; help: boolean; }}
|
||||
*/
|
||||
const argv = optimist.argv;
|
||||
|
||||
if (argv.help) {
|
||||
@@ -34,22 +48,55 @@ const out = argv.build ? 'out-build' : 'out';
|
||||
const loader = require(`../../../${out}/vs/loader`);
|
||||
const src = path.join(REPO_ROOT, out);
|
||||
|
||||
const majorRequiredNodeVersion = `v${/^target\s+"([^"]+)"$/m.exec(fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8'))[1]}`.substring(0, 3);
|
||||
const currentMajorNodeVersion = process.version.substring(0, 3);
|
||||
if (majorRequiredNodeVersion !== currentMajorNodeVersion) {
|
||||
console.error(`node.js unit tests require a major node.js version of ${majorRequiredNodeVersion} (your version is: ${currentMajorNodeVersion})`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function main() {
|
||||
process.on('uncaughtException', function (e) {
|
||||
console.error(e.stack || e);
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {{ isWindows?: boolean, scheme?: string, fallbackAuthority?: string }} config
|
||||
* @returns {string}
|
||||
*/
|
||||
function fileUriFromPath(path, config) {
|
||||
|
||||
// Since we are building a URI, we normalize any backslash
|
||||
// to slashes and we ensure that the path begins with a '/'.
|
||||
let pathName = path.replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = `/${pathName}`;
|
||||
}
|
||||
|
||||
/** @type {string} */
|
||||
let uri;
|
||||
|
||||
// Windows: in order to support UNC paths (which start with '//')
|
||||
// that have their own authority, we do not use the provided authority
|
||||
// but rather preserve it.
|
||||
if (config.isWindows && pathName.startsWith('//')) {
|
||||
uri = encodeURI(`${config.scheme || 'file'}:${pathName}`);
|
||||
}
|
||||
|
||||
// Otherwise we optionally add the provided authority if specified
|
||||
else {
|
||||
uri = encodeURI(`${config.scheme || 'file'}://${config.fallbackAuthority || ''}${pathName}`);
|
||||
}
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
}
|
||||
|
||||
const loaderConfig = {
|
||||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
baseUrl: path.join(REPO_ROOT, 'src'),
|
||||
paths: {
|
||||
'vs/css': '../test/unit/node/css.mock',
|
||||
'vs': `../${out}/vs`,
|
||||
baseUrl: fileUriFromPath(src, { isWindows: process.platform === 'win32' }),
|
||||
'sql': `../${out}/sql`, // {{SQL CARBON EDIT}}
|
||||
'lib': `../${out}/lib`,
|
||||
'bootstrap-fork': `../${out}/bootstrap-fork`
|
||||
},
|
||||
catchError: true,
|
||||
nodeModules: [ // {{SQL CARBON EDIT}}
|
||||
'@angular/common',
|
||||
@@ -81,28 +128,19 @@ function main() {
|
||||
|
||||
loader.config(loaderConfig);
|
||||
|
||||
global.define = loader;
|
||||
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
|
||||
global.self = global.window = global.document.parentWindow;
|
||||
|
||||
global.Element = global.window.Element;
|
||||
global.HTMLElement = global.window.HTMLElement;
|
||||
global.Node = global.window.Node;
|
||||
global.navigator = global.window.navigator;
|
||||
global.XMLHttpRequest = global.window.XMLHttpRequest;
|
||||
|
||||
let didErr = false;
|
||||
const write = process.stderr.write;
|
||||
process.stderr.write = function (data) {
|
||||
didErr = didErr || !!data;
|
||||
write.apply(process.stderr, arguments);
|
||||
process.stderr.write = function (...args) {
|
||||
didErr = didErr || !!args[0];
|
||||
return write.apply(process.stderr, args);
|
||||
};
|
||||
|
||||
/** @type { (callback:(err:any)=>void)=>void } */
|
||||
let loadFunc = null;
|
||||
|
||||
if (argv.runGlob) {
|
||||
loadFunc = (cb) => {
|
||||
const doRun = tests => {
|
||||
const doRun = /** @param {string[]} tests */(tests) => {
|
||||
const modulesToLoad = tests.map(test => {
|
||||
if (path.isAbsolute(test)) {
|
||||
test = path.relative(src, path.resolve(test));
|
||||
@@ -110,7 +148,7 @@ function main() {
|
||||
|
||||
return test.replace(/(\.js)|(\.d\.ts)|(\.js\.map)$/, '');
|
||||
});
|
||||
define(modulesToLoad, () => cb(null), cb);
|
||||
loader(modulesToLoad, () => cb(null), cb);
|
||||
};
|
||||
|
||||
glob(argv.runGlob, { cwd: src }, function (err, files) { doRun(files); });
|
||||
@@ -123,15 +161,19 @@ function main() {
|
||||
return path.relative(src, path.resolve(test)).replace(/(\.js)|(\.js\.map)$/, '').replace(/\\/g, '/');
|
||||
});
|
||||
loadFunc = (cb) => {
|
||||
define(modulesToLoad, () => cb(null), cb);
|
||||
loader(modulesToLoad, () => cb(null), cb);
|
||||
};
|
||||
} else {
|
||||
loadFunc = (cb) => {
|
||||
glob(TEST_GLOB, { cwd: src }, function (err, files) {
|
||||
const modulesToLoad = files.map(function (file) {
|
||||
return file.replace(/\.js$/, '');
|
||||
});
|
||||
define(modulesToLoad, function () { cb(null); }, cb);
|
||||
/** @type {string[]} */
|
||||
const modules = [];
|
||||
for (let file of files) {
|
||||
if (!excludeGlobs.some(excludeGlob => minimatch(file, excludeGlob))) {
|
||||
modules.push(file.replace(/\.js$/, ''));
|
||||
}
|
||||
}
|
||||
loader(modules, function () { cb(null); }, cb);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -146,7 +188,7 @@ function main() {
|
||||
|
||||
if (!argv.run && !argv.runGlob) {
|
||||
// set up last test
|
||||
suite('Loader', function () {
|
||||
mocha.suite('Loader', function () {
|
||||
test('should not explode while loading', function () {
|
||||
assert.ok(!didErr, 'should not explode while loading');
|
||||
});
|
||||
@@ -155,7 +197,7 @@ function main() {
|
||||
|
||||
// report failing test for every unexpected error during any of the tests
|
||||
let unexpectedErrors = [];
|
||||
suite('Errors', function () {
|
||||
mocha.suite('Errors', function () {
|
||||
test('should not have unexpected errors in tests', function () {
|
||||
if (unexpectedErrors.length) {
|
||||
unexpectedErrors.forEach(function (stack) {
|
||||
@@ -181,13 +223,9 @@ function main() {
|
||||
});
|
||||
|
||||
// fire up mocha
|
||||
run();
|
||||
mocha.run();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (process.argv.some(function (a) { return /^--browser/.test(a); })) {
|
||||
require('./browser');
|
||||
} else {
|
||||
main();
|
||||
}
|
||||
main();
|
||||
@@ -19,7 +19,7 @@ exports.importMochaReporter = name => {
|
||||
|
||||
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', name);
|
||||
return require(reporterPath);
|
||||
}
|
||||
};
|
||||
|
||||
exports.applyReporter = (runner, argv) => {
|
||||
let Reporter;
|
||||
@@ -39,4 +39,4 @@ exports.applyReporter = (runner, argv) => {
|
||||
reporterOptions = reporterOptions.reduce((r, o) => Object.assign(r, parseReporterOption(o)), {});
|
||||
|
||||
return new Reporter(runner, { reporterOptions });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user