diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index e0e0472cd9716..62490d2517e16 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -8,6 +8,10 @@ import * as https from 'https'; import * as cp from 'child_process'; import * as path from 'path'; import * as mkdirp from 'mkdirp'; +import * as minimist from 'minimist'; + +const [, , ...args] = process.argv; +const opts = minimist(args, { string: ['build', 'stable-build'] }); const testDataPath = path.join(__dirname, '..', 'test_data'); const workspacePath = path.join(testDataPath, 'smoketest.code-workspace'); @@ -42,7 +46,8 @@ function getDevElectronPath(): string { } } -let [, , testCodePath, stableCodePath] = process.argv; +let testCodePath = opts.build; +let stableCodePath = opts['stable-build']; if (testCodePath) { process.env.VSCODE_PATH = testCodePath; @@ -125,10 +130,36 @@ async function main(): Promise { console.log('Running npm install...'); // cp.execSync('npm install', { cwd: testRepoLocalDir, stdio: 'inherit' }); - - console.log('Running tests...'); - const mocha = cp.spawnSync(process.execPath, ['out/mocha-runner.js'], { cwd: path.join(__dirname, '..'), stdio: 'inherit' }); - process.exit(mocha.status); } -main().catch(fail); \ No newline at end of file +/** + * WebDriverIO 4.8.0 outputs all kinds of "deprecation" warnings + * for common commands like `keys` and `moveToObject`. + * According to https://github.com/Codeception/CodeceptJS/issues/531, + * these deprecation warnings are for Firefox, and have no alternative replacements. + * Since we can't downgrade WDIO as suggested (it's Spectron's dep, not ours), + * we must suppress the warning with a classic monkey-patch. + * + * @see webdriverio/lib/helpers/depcrecationWarning.js + * @see https://github.com/webdriverio/webdriverio/issues/2076 + */ +// Filter out the following messages: +const wdioDeprecationWarning = /^WARNING: the "\w+" command will be depcrecated soon./; // [sic] +// Monkey patch: +const warn = console.warn; +console.warn = function suppressWebdriverWarnings(message) { + if (wdioDeprecationWarning.test(message)) { return; } + warn.apply(console, arguments); +}; + +before(async () => main()); + +import './areas/css/css.test'; +import './areas/explorer/explorer.test'; +import './areas/preferences/settings.test'; +import './areas/preferences/keybindings.test'; +import './areas/multiroot/multiroot.test'; +import './areas/extensions/extensions.test'; +import './areas/search/search.test'; +import './areas/workbench/data-loss.test'; +// import './areas/workbench/data-migration.test'; \ No newline at end of file diff --git a/test/smoke/src/mocha-runner.ts b/test/smoke/src/mocha-runner.ts deleted file mode 100644 index fb7f0bb79fb03..0000000000000 --- a/test/smoke/src/mocha-runner.ts +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const MochaTest = require('mocha'); -const path = require('path'); - -const mochaTest = new MochaTest({ - timeout: 60000, - slow: 10000, - useColors: true -}); -mochaTest.addFile(path.join(__dirname, 'test.js')); -mochaTest.run((failures) => { - process.exit(failures); -}); \ No newline at end of file diff --git a/test/smoke/src/test.ts b/test/smoke/src/test.ts deleted file mode 100644 index ebe74f44269bf..0000000000000 --- a/test/smoke/src/test.ts +++ /dev/null @@ -1,35 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/** - * WebDriverIO 4.8.0 outputs all kinds of "deprecation" warnings - * for common commands like `keys` and `moveToObject`. - * According to https://github.com/Codeception/CodeceptJS/issues/531, - * these deprecation warnings are for Firefox, and have no alternative replacements. - * Since we can't downgrade WDIO as suggested (it's Spectron's dep, not ours), - * we must suppress the warning with a classic monkey-patch. - * - * @see webdriverio/lib/helpers/depcrecationWarning.js - * @see https://github.com/webdriverio/webdriverio/issues/2076 - */ -// Filter out the following messages: -const wdioDeprecationWarning = /^WARNING: the "\w+" command will be depcrecated soon./; // [sic] -// Monkey patch: -const warn = console.warn; -console.warn = function suppressWebdriverWarnings(message) { - if (wdioDeprecationWarning.test(message)) { return; } - warn.apply(console, arguments); -}; - -import './areas/css/css.test'; -import './areas/explorer/explorer.test'; -import './areas/preferences/settings.test'; -import './areas/preferences/keybindings.test'; -import './areas/multiroot/multiroot.test'; -import './areas/extensions/extensions.test'; -import './areas/search/search.test'; -import './areas/workbench/data-loss.test'; -// import './areas/workbench/data-migration.test'; - // testDataMigration(); \ No newline at end of file diff --git a/test/smoke/test/mocha.opts b/test/smoke/test/mocha.opts new file mode 100644 index 0000000000000..f7385dc1642ba --- /dev/null +++ b/test/smoke/test/mocha.opts @@ -0,0 +1,3 @@ +--timeout 60000 +--slow 10000 +out/main.js \ No newline at end of file