Skip to content

Commit

Permalink
use mocha for smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Sep 4, 2017
1 parent 4fe77bc commit bedcf4c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 58 deletions.
43 changes: 37 additions & 6 deletions test/smoke/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 changes: 0 additions & 17 deletions test/smoke/src/mocha-runner.ts

This file was deleted.

35 changes: 0 additions & 35 deletions test/smoke/src/test.ts

This file was deleted.

3 changes: 3 additions & 0 deletions test/smoke/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--timeout 60000
--slow 10000
out/main.js

0 comments on commit bedcf4c

Please sign in to comment.