mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
fix(build): bail if script/bootstrap fails and enhance test output
Have the test output
This commit is contained in:
parent
8ac340cbb4
commit
971089aeb0
8 changed files with 38 additions and 23 deletions
|
@ -6,18 +6,20 @@ proc = require 'child_process'
|
|||
executeTests = (test, grunt, done) ->
|
||||
testSucceeded = false
|
||||
testOutput = ""
|
||||
testProc = proc.spawn(test.cmd, test.args)
|
||||
testProc.stdout.on 'data', (data) ->
|
||||
str = data.toString()
|
||||
testOutput += str
|
||||
console.log(str)
|
||||
if str.indexOf(' 0 failures') isnt -1
|
||||
testSucceeded = true
|
||||
|
||||
testProc.stderr.on 'data', (data) ->
|
||||
str = data.toString()
|
||||
testOutput += str
|
||||
grunt.log.error(str)
|
||||
testProc = proc.spawn(test.cmd, test.args, {stdio: "inherit"})
|
||||
|
||||
# testProc.stdout.on 'data', (data) ->
|
||||
# str = data.toString()
|
||||
# testOutput += str
|
||||
# console.log(str)
|
||||
# if str.indexOf(' 0 failures') isnt -1
|
||||
# testSucceeded = true
|
||||
#
|
||||
# testProc.stderr.on 'data', (data) ->
|
||||
# str = data.toString()
|
||||
# testOutput += str
|
||||
# grunt.log.error(str)
|
||||
|
||||
testProc.on 'error', (err) ->
|
||||
grunt.log.error("Process error: #{err}")
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
# The credentials for the Keychain are availble via the Jenkins-injected
|
||||
# KEYCHAIN_ACCESS environment variable.
|
||||
|
||||
set -e
|
||||
|
||||
echo "---> $(npm --version)"
|
||||
echo "---> $(node --version)"
|
||||
script/bootstrap
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Runs script/grunt docs and moves the output to gh-pages branch
|
||||
# This overwrites whatever is in gh-pages
|
||||
mkdir docs/output
|
||||
|
|
|
@ -18,7 +18,8 @@ try
|
|||
|
||||
# Show window synchronously so a focusout doesn't fire on input elements
|
||||
# that are focused in the very first spec run.
|
||||
NylasEnv.getCurrentWindow().show() unless NylasEnv.getLoadSettings().exitWhenDone
|
||||
if NylasEnv.getLoadSettings().showSpecsInWindow
|
||||
NylasEnv.getCurrentWindow().show()
|
||||
|
||||
{runSpecSuite} = require './jasmine-helper'
|
||||
|
||||
|
|
|
@ -98,9 +98,10 @@ class Application
|
|||
@launchWithOptions(options)
|
||||
|
||||
# Opens a new window based on the options provided.
|
||||
launchWithOptions: ({urlsToOpen, test, devMode, safeMode, specDirectory, specFilePattern, logFile, specsOnCommandLine}) ->
|
||||
launchWithOptions: ({urlsToOpen, test, devMode, safeMode, specDirectory, specFilePattern, logFile, showSpecsInWindow}) ->
|
||||
if test
|
||||
@runSpecs({exitWhenDone: specsOnCommandLine, @resourcePath, specDirectory, specFilePattern, logFile})
|
||||
exitWhenDone = true
|
||||
@runSpecs({exitWhenDone, showSpecsInWindow, @resourcePath, specDirectory, specFilePattern, logFile})
|
||||
else
|
||||
@openWindowsForTokenState()
|
||||
for urlToOpen in (urlsToOpen || [])
|
||||
|
@ -214,6 +215,7 @@ class Application
|
|||
@on 'application:run-all-specs', ->
|
||||
@runSpecs
|
||||
exitWhenDone: false
|
||||
showSpecsInWindow: true
|
||||
resourcePath: @resourcePath
|
||||
safeMode: @windowManager.focusedWindow()?.safeMode
|
||||
|
||||
|
@ -226,6 +228,7 @@ class Application
|
|||
return if not filenames or filenames.length is 0
|
||||
@runSpecs
|
||||
exitWhenDone: false
|
||||
showSpecsInWindow: true
|
||||
resourcePath: @resourcePath
|
||||
specDirectory: filenames[0]
|
||||
|
||||
|
@ -469,12 +472,15 @@ class Application
|
|||
#
|
||||
# options -
|
||||
# :exitWhenDone - A Boolean that, if true, will close the window upon
|
||||
# completion.
|
||||
# completion and exit the app with the status code of
|
||||
# 1 if the specs failed and 0 if they passed.
|
||||
# :showSpecsInWindow - A Boolean that, if true, will run specs in a
|
||||
# window
|
||||
# :resourcePath - The path to include specs from.
|
||||
# :specPath - The directory to load specs from.
|
||||
# :safeMode - A Boolean that, if true, won't run specs from ~/.nylas/packages
|
||||
# and ~/.nylas/dev/packages, defaults to false.
|
||||
runSpecs: ({exitWhenDone, resourcePath, specDirectory, specFilePattern, logFile, safeMode}) ->
|
||||
runSpecs: ({exitWhenDone, showSpecsInWindow, resourcePath, specDirectory, specFilePattern, logFile, safeMode}) ->
|
||||
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
|
||||
resourcePath = @resourcePath
|
||||
|
||||
|
|
|
@ -129,11 +129,12 @@ parseCommandLine = ->
|
|||
specFilePattern = args['file-pattern']
|
||||
devResourcePath = process.env.N1_PATH ? process.cwd()
|
||||
|
||||
showSpecsInWindow = false
|
||||
|
||||
if args['resource-path']
|
||||
devMode = true
|
||||
resourcePath = args['resource-path']
|
||||
else
|
||||
specsOnCommandLine = true
|
||||
# Set resourcePath based on the specDirectory if running specs on N1 core
|
||||
if specDirectory?
|
||||
packageDirectoryPath = path.resolve(specDirectory, '..')
|
||||
|
@ -150,7 +151,7 @@ parseCommandLine = ->
|
|||
specDirectory = path.join(devResourcePath, "spec")
|
||||
else if test is "window"
|
||||
specDirectory = path.join(devResourcePath, "spec")
|
||||
specsOnCommandLine = false
|
||||
showSpecsInWindow = true
|
||||
else
|
||||
specDirectory = path.resolve(path.join(devResourcePath, "internal_packages", test))
|
||||
|
||||
|
@ -167,6 +168,6 @@ parseCommandLine = ->
|
|||
resourcePath = normalizeDriveLetterName(resourcePath)
|
||||
devResourcePath = normalizeDriveLetterName(devResourcePath)
|
||||
|
||||
{resourcePath, pathsToOpen, urlsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, specsOnCommandLine, logFile, specFilePattern}
|
||||
{resourcePath, pathsToOpen, urlsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, showSpecsInWindow, logFile, specFilePattern}
|
||||
|
||||
start()
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
setupCrashReporter = function() {};
|
||||
|
||||
parseCommandLine = function() {
|
||||
var args, devMode, devResourcePath, executedFrom, logFile, newWindow, options, packageDirectoryPath, packageManifest, packageManifestPath, pathsToOpen, pidToKillWhenClosed, ref, ref1, ref2, resourcePath, safeMode, specDirectory, specFilePattern, specsOnCommandLine, test, urlsToOpen, version;
|
||||
var args, devMode, devResourcePath, executedFrom, logFile, newWindow, options, packageDirectoryPath, packageManifest, packageManifestPath, pathsToOpen, pidToKillWhenClosed, ref, ref1, ref2, resourcePath, safeMode, showSpecsInWindow, specDirectory, specFilePattern, test, urlsToOpen, version;
|
||||
version = app.getVersion();
|
||||
options = optimist(process.argv.slice(1));
|
||||
options.usage("N1 v" + version + "\n\nUsage: n1 [options] [path ...]\n\nOne or more paths to files or folders to open may be specified.\n\nFile paths will open in the current window.\n\nFolder paths will open in an existing window if that folder has already been\nopened or a new window if it hasn't.\n\nEnvironment Variables:\nN1_PATH The path from which N1 loads source code in dev mode.\n Defaults to `cwd`.");
|
||||
|
@ -153,11 +153,11 @@
|
|||
logFile = args['log-file'];
|
||||
specFilePattern = args['file-pattern'];
|
||||
devResourcePath = (ref2 = process.env.N1_PATH) != null ? ref2 : process.cwd();
|
||||
showSpecsInWindow = false;
|
||||
if (args['resource-path']) {
|
||||
devMode = true;
|
||||
resourcePath = args['resource-path'];
|
||||
} else {
|
||||
specsOnCommandLine = true;
|
||||
if (specDirectory != null) {
|
||||
packageDirectoryPath = path.resolve(specDirectory, '..');
|
||||
packageManifestPath = path.join(packageDirectoryPath, 'package.json');
|
||||
|
@ -175,7 +175,7 @@
|
|||
specDirectory = path.join(devResourcePath, "spec");
|
||||
} else if (test === "window") {
|
||||
specDirectory = path.join(devResourcePath, "spec");
|
||||
specsOnCommandLine = false;
|
||||
showSpecsInWindow = true;
|
||||
} else {
|
||||
specDirectory = path.resolve(path.join(devResourcePath, "internal_packages", test));
|
||||
}
|
||||
|
@ -210,7 +210,7 @@
|
|||
safeMode: safeMode,
|
||||
newWindow: newWindow,
|
||||
specDirectory: specDirectory,
|
||||
specsOnCommandLine: specsOnCommandLine,
|
||||
showSpecsInWindow: showSpecsInWindow,
|
||||
logFile: logFile,
|
||||
specFilePattern: specFilePattern
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@ class NylasWindow
|
|||
toolbar,
|
||||
resizable,
|
||||
pathToOpen,
|
||||
showSpecsInWindow,
|
||||
@isSpec,
|
||||
@devMode,
|
||||
@safeMode,
|
||||
|
|
Loading…
Reference in a new issue