tests - improve exclusion handling for node.js tests

This commit is contained in:
Benjamin Pasero 2022-04-21 17:10:10 +02:00
parent aa69f3d762
commit 08ac1bb67c
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -25,11 +25,12 @@ const optimist = require('optimist')
const TEST_GLOB = '**/test/**/*.test.js';
const excludeGlob = '**/{browser,electron-sandbox,electron-browser,electron-main}/**/*.test.js';
const excludeModules = [
'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/common/testResultService.test.js' // flaky (https://github.com/microsoft/vscode/issues/137853)
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)
];
/**
@ -152,7 +153,7 @@ function main() {
/** @type {string[]} */
const modules = [];
for (let file of files) {
if (!minimatch(file, excludeGlob) && excludeModules.indexOf(file) === -1) {
if (!excludeGlobs.some(excludeGlob => minimatch(file, excludeGlob))) {
modules.push(file.replace(/\.js$/, ''));
}
}