Merge pull request #3762 from atom/run-specs-with-grep

Allow running specs with --grep option from command line
This commit is contained in:
Cheng Zhao 2015-12-11 11:21:57 +08:00
commit ced6aae6df
6 changed files with 25 additions and 9 deletions

View file

@ -11,6 +11,7 @@
},
"private": true,
"scripts": {
"preinstall": "node -e 'process.exit(0)'"
"preinstall": "node -e 'process.exit(0)'",
"test": "python ./script/test.py"
}
}

View file

@ -8,7 +8,7 @@ os = require 'os'
{remote, screen} = require 'electron'
{ipcMain, BrowserWindow} = remote.require 'electron'
isCI = remote.process.argv[2] == '--ci'
isCI = remote.getGlobal('isCi')
describe 'browser-window module', ->
fixtures = path.resolve __dirname, 'fixtures'

View file

@ -18,7 +18,7 @@ describe 'crash-reporter module', ->
return if process.mas
# The crash-reporter test is not reliable on CI machine.
isCI = remote.process.argv[2] == '--ci'
isCI = remote.getGlobal('isCi')
return if isCI
it 'should send minidump when renderer crashes', (done) ->

View file

@ -5,13 +5,14 @@
"version": "0.1.0",
"devDependencies": {
"basic-auth": "^1.0.0",
"multiparty": "4.1.2",
"graceful-fs": "3.0.5",
"mocha": "2.1.0",
"multiparty": "4.1.2",
"q": "0.9.7",
"temp": "0.8.1",
"walkdir": "0.0.7",
"ws": "0.7.2"
"ws": "0.7.2",
"yargs": "^3.31.0"
},
"optionalDependencies": {
"ffi": "2.0.0",

View file

@ -18,8 +18,7 @@
var remote = electron.remote;
var ipcRenderer = electron.ipcRenderer;
var argv = remote.process.argv;
var isCi = argv[2] == '--ci';
var isCi = remote.getGlobal('isCi')
if (!isCi) {
var win = remote.getCurrentWindow();

View file

@ -5,6 +5,13 @@ const dialog = electron.dialog;
const BrowserWindow = electron.BrowserWindow;
const path = require('path');
const url = require('url');
var argv = require('yargs')
.boolean('ci')
.string('g').alias('g', 'grep')
.boolean('i').alias('i', 'invert')
.argv;
var window = null;
process.port = 0; // will be used by crash-reporter spec.
@ -42,7 +49,8 @@ ipcMain.on('echo', function(event, msg) {
event.returnValue = msg;
});
if (process.argv[2] == '--ci') {
global.isCi = !!argv.ci;
if (global.isCi) {
process.removeAllListeners('uncaughtException');
process.on('uncaughtException', function(error) {
console.error(error, error.stack);
@ -67,7 +75,14 @@ app.on('ready', function() {
javascript: true // Test whether web-preferences crashes.
},
});
window.loadURL('file://' + __dirname + '/index.html');
window.loadURL(url.format({
pathname: __dirname + '/index.html',
protocol: 'file',
query: {
grep: argv.grep,
invert: argv.invert ? 'true': ''
}
}));
window.on('unresponsive', function() {
var chosen = dialog.showMessageBox(window, {
type: 'warning',