use mocha for smoke test

This commit is contained in:
Joao
2017-09-04 15:46:35 +02:00
parent 4fe77bc342
commit bedcf4c760
4 changed files with 40 additions and 58 deletions
+37 -6
View File
@@ -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<void> {
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);
/**
* 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';
-17
View File
@@ -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);
});
-35
View File
@@ -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();
+3
View File
@@ -0,0 +1,3 @@
--timeout 60000
--slow 10000
out/main.js