From 4adf23a5956e55ab113631f6652fda25438d032f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2016 11:24:01 +0200 Subject: [PATCH 1/7] Unconditionally report deprecations on every test environment --- build/tasks/spec-task.coffee | 1 - spec/jasmine-test-runner.coffee | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index 40b7ad5ce..2e319a19c 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -18,7 +18,6 @@ module.exports = (grunt) -> packageSpecQueue = null logDeprecations = (label, {stderr}={}) -> - return unless process.env.JANKY_SHA1 or process.env.CI stderr ?= '' deprecatedStart = stderr.indexOf('Calls to deprecated functions') return if deprecatedStart is -1 diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 5b5d4e225..dd8386f5d 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -1,3 +1,4 @@ +Grim = require 'grim' _ = require 'underscore-plus' fs = require 'fs-plus' path = require 'path' @@ -96,13 +97,10 @@ buildTerminalReporter = (logFile, resolveWithExitCode) -> log(str) onComplete: (runner) -> fs.closeSync(logStream) if logStream? - if process.env.JANKY_SHA1 or process.env.CI - grim = require 'grim' - - if grim.getDeprecationsLength() > 0 - grim.logDeprecations() - resolveWithExitCode(1) - return + if Grim.getDeprecationsLength() > 0 + Grim.logDeprecations() + resolveWithExitCode(1) + return if runner.results().failedCount > 0 resolveWithExitCode(1) From 303bb8c74e5274fcc2585acd53ca0d0df9459d95 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2016 11:24:59 +0200 Subject: [PATCH 2/7] Remove this commit if it works on travis --- spec/fake-spec.coffee | 3 +++ spec/jasmine-test-runner.coffee | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 spec/fake-spec.coffee diff --git a/spec/fake-spec.coffee b/spec/fake-spec.coffee new file mode 100644 index 000000000..c14cdbb94 --- /dev/null +++ b/spec/fake-spec.coffee @@ -0,0 +1,3 @@ +fdescribe "remove this", -> + it "remove me", -> + require("grim").deprecate("foo") diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index dd8386f5d..fd0187298 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -25,7 +25,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 61d8c6852c1577a439f87f57f87ddfad32052424 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2016 15:07:50 +0200 Subject: [PATCH 3/7] Remove non-Mac run-specs code and use ELECTRON_ENABLE_LOGGING=true * Remove Windows/Linux run-specs code. There is little value in keeping those code paths, given that we don't run specs on those platforms; if we ever need it again, we can restore it from the git history. * Use ELECTRON_ENABLE_LOGGING=true. This allows us to capture the output of calls to `console.warn` and `console.log`, which are useful to log out Grim deprecations. * Remove `logDeprecations` in build/spec-task.coffee. This method used to format the output captured on stderr to strip out "[Console]" noise from deprecations. This code path was not running anymore because we started using stdio: 'inherit' in #10838, which prevents stderr output to be captured. This doesn't seem a huge deal, so long as those deprecations get logged to screen. --- build/tasks/spec-task.coffee | 121 ++++++----------------------------- 1 file changed, 21 insertions(+), 100 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index 2e319a19c..b806ffcb7 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -5,40 +5,14 @@ temp = require('temp').track() _ = require 'underscore-plus' async = require 'async' -# TODO: This should really be parallel on every platform, however: -# - On Windows, our fixtures step on each others toes. -if process.platform is 'win32' - concurrency = 1 -else - concurrency = 2 - module.exports = (grunt) -> {isAtomPackage, spawn} = require('./task-helpers')(grunt) packageSpecQueue = null - logDeprecations = (label, {stderr}={}) -> - stderr ?= '' - deprecatedStart = stderr.indexOf('Calls to deprecated functions') - return if deprecatedStart is -1 - - grunt.log.error(label) - stderr = stderr.substring(deprecatedStart) - stderr = stderr.replace(/^\s*\[[^\]]+\]\s+/gm, '') - stderr = stderr.replace(/source: .*$/gm, '') - stderr = stderr.replace(/^"/gm, '') - stderr = stderr.replace(/",\s*$/gm, '') - grunt.log.error(stderr) - getAppPath = -> contentsDir = grunt.config.get('atom.contentsDir') - switch process.platform - when 'darwin' - path.join(contentsDir, 'MacOS', 'Atom') - when 'linux' - path.join(contentsDir, 'atom') - when 'win32' - path.join(contentsDir, 'atom.exe') + path.join(contentsDir, 'MacOS', 'Atom') runPackageSpecs = (callback) -> failedPackages = [] @@ -46,34 +20,17 @@ module.exports = (grunt) -> resourcePath = process.cwd() appPath = getAppPath() - # Ensure application is executable on Linux - fs.chmodSync(appPath, '755') if process.platform is 'linux' - packageSpecQueue = async.queue (packagePath, callback) -> - if process.platform in ['darwin', 'linux'] - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", path.join(packagePath, 'spec')] - opts: - cwd: packagePath - env: _.extend({}, process.env, ATOM_PATH: rootDir) - else if process.platform is 'win32' - options = - cmd: process.env.comspec - args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", "--log-file=ci.log", path.join(packagePath, 'spec')] - opts: - cwd: packagePath - env: _.extend({}, process.env, ATOM_PATH: rootDir) + options = + cmd: appPath + args: ['--test', "--resource-path=#{resourcePath}", path.join(packagePath, 'spec')] + opts: + cwd: packagePath + env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) grunt.log.ok "Launching #{path.basename(packagePath)} specs." - spawn options, (error, results, code) -> - if process.platform is 'win32' - if error - process.stderr.write(fs.readFileSync(path.join(packagePath, 'ci.log'))) - fs.unlinkSync(path.join(packagePath, 'ci.log')) - + spawn options, (error) -> failedPackages.push path.basename(packagePath) if error - logDeprecations("#{path.basename(packagePath)} Specs", results) callback() modulesDirectory = path.resolve('node_modules') @@ -83,71 +40,38 @@ module.exports = (grunt) -> continue unless isAtomPackage(packagePath) packageSpecQueue.push(packagePath) - packageSpecQueue.concurrency = Math.max(1, concurrency - 1) + packageSpecQueue.concurrency = 1 packageSpecQueue.drain = -> callback(null, failedPackages) - runCoreSpecs = (callback, logOutput = false) -> + runCoreSpecs = (callback) -> appPath = getAppPath() resourcePath = process.cwd() coreSpecsPath = path.resolve('spec') - if process.platform in ['darwin', 'linux'] - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", coreSpecsPath, "--user-data-dir=#{temp.mkdirSync('atom-user-data-dir')}"] - opts: - env: _.extend({}, process.env, - ATOM_INTEGRATION_TESTS_ENABLED: true - ) - - else if process.platform is 'win32' - options = - cmd: process.env.comspec - args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", '--log-file=ci.log', coreSpecsPath] - opts: - env: _.extend({}, process.env, - ATOM_INTEGRATION_TESTS_ENABLED: true - ) - - if logOutput - options.opts.stdio = 'inherit' + options = + cmd: appPath + args: ['--test', "--resource-path=#{resourcePath}", coreSpecsPath, "--user-data-dir=#{temp.mkdirSync('atom-user-data-dir')}"] + opts: + env: _.extend({}, process.env, {ATOM_INTEGRATION_TESTS_ENABLED: true, ELECTRON_ENABLE_LOGGING: true}) + stdio: 'inherit' grunt.log.ok "Launching core specs." - spawn options, (error, results, code) -> - if process.platform is 'win32' - process.stderr.write(fs.readFileSync('ci.log')) if error - fs.unlinkSync('ci.log') - else - # TODO: Restore concurrency on Windows - packageSpecQueue?.concurrency = concurrency - logDeprecations('Core Specs', results) - + spawn options, (error, results) -> callback(null, error) grunt.registerTask 'run-specs', 'Run the specs', -> done = @async() startTime = Date.now() - method = - if concurrency is 1 - async.series - else - async.parallel - - # If we're just running the core specs then we won't have any output to - # indicate the tests actually *are* running. This upsets Travis: - # https://github.com/atom/atom/issues/10837. So pass the test output - # through. - runCoreSpecsWithLogging = (callback) -> runCoreSpecs(callback, true) specs = if process.env.ATOM_SPECS_TASK is 'packages' [runPackageSpecs] else if process.env.ATOM_SPECS_TASK is 'core' - [runCoreSpecsWithLogging] + [runCoreSpecs] else [runCoreSpecs, runPackageSpecs] - method specs, (error, results) -> + async.series specs, (error, results) -> failedPackages = [] coreSpecFailed = null @@ -159,13 +83,10 @@ module.exports = (grunt) -> [coreSpecFailed, failedPackages] = results elapsedTime = Math.round((Date.now() - startTime) / 100) / 10 - grunt.log.ok("Total spec time: #{elapsedTime}s using #{concurrency} cores") + grunt.log.ok("Total spec time: #{elapsedTime}s") failures = failedPackages failures.push "atom core" if coreSpecFailed grunt.log.error("[Error]".red + " #{failures.join(', ')} spec(s) failed") if failures.length > 0 - if process.platform is 'win32' and process.env.JANKY_SHA1 - done() - else - done(not coreSpecFailed and failedPackages.length is 0) + done(not coreSpecFailed and failedPackages.length is 0) From 147fed31234c6ed74d7f12aa6c5f3fc73dcd1a25 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2016 15:46:50 +0200 Subject: [PATCH 4/7] Revert "Remove this commit if it works on travis" This reverts commit 303bb8c74e5274fcc2585acd53ca0d0df9459d95. --- spec/fake-spec.coffee | 3 --- spec/jasmine-test-runner.coffee | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 spec/fake-spec.coffee diff --git a/spec/fake-spec.coffee b/spec/fake-spec.coffee deleted file mode 100644 index c14cdbb94..000000000 --- a/spec/fake-spec.coffee +++ /dev/null @@ -1,3 +0,0 @@ -fdescribe "remove this", -> - it "remove me", -> - require("grim").deprecate("foo") diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index fd0187298..dd8386f5d 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -25,7 +25,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 740e371e75b29f5aa777a084f979c8e344109303 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 14 Apr 2016 16:04:30 +0200 Subject: [PATCH 5/7] Put back multi-platform specs --- build/tasks/spec-task.coffee | 91 ++++++++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index b806ffcb7..c1067231c 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -5,6 +5,13 @@ temp = require('temp').track() _ = require 'underscore-plus' async = require 'async' +# TODO: This should really be parallel on every platform, however: +# - On Windows, our fixtures step on each others toes. +if process.platform is 'win32' + concurrency = 1 +else + concurrency = 2 + module.exports = (grunt) -> {isAtomPackage, spawn} = require('./task-helpers')(grunt) @@ -12,7 +19,13 @@ module.exports = (grunt) -> getAppPath = -> contentsDir = grunt.config.get('atom.contentsDir') - path.join(contentsDir, 'MacOS', 'Atom') + switch process.platform + when 'darwin' + path.join(contentsDir, 'MacOS', 'Atom') + when 'linux' + path.join(contentsDir, 'atom') + when 'win32' + path.join(contentsDir, 'atom.exe') runPackageSpecs = (callback) -> failedPackages = [] @@ -20,16 +33,32 @@ module.exports = (grunt) -> resourcePath = process.cwd() appPath = getAppPath() + # Ensure application is executable on Linux + fs.chmodSync(appPath, '755') if process.platform is 'linux' + packageSpecQueue = async.queue (packagePath, callback) -> - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", path.join(packagePath, 'spec')] - opts: - cwd: packagePath - env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) + if process.platform in ['darwin', 'linux'] + options = + cmd: appPath + args: ['--test', "--resource-path=#{resourcePath}", path.join(packagePath, 'spec')] + opts: + cwd: packagePath + env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) + else if process.platform is 'win32' + options = + cmd: process.env.comspec + args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", "--log-file=ci.log", path.join(packagePath, 'spec')] + opts: + cwd: packagePath + env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) grunt.log.ok "Launching #{path.basename(packagePath)} specs." - spawn options, (error) -> + spawn options, (error, results, code) -> + if process.platform is 'win32' + if error + process.stderr.write(fs.readFileSync(path.join(packagePath, 'ci.log'))) + fs.unlinkSync(path.join(packagePath, 'ci.log')) + failedPackages.push path.basename(packagePath) if error callback() @@ -40,7 +69,7 @@ module.exports = (grunt) -> continue unless isAtomPackage(packagePath) packageSpecQueue.push(packagePath) - packageSpecQueue.concurrency = 1 + packageSpecQueue.concurrency = Math.max(1, concurrency - 1) packageSpecQueue.drain = -> callback(null, failedPackages) runCoreSpecs = (callback) -> @@ -48,20 +77,41 @@ module.exports = (grunt) -> resourcePath = process.cwd() coreSpecsPath = path.resolve('spec') - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", coreSpecsPath, "--user-data-dir=#{temp.mkdirSync('atom-user-data-dir')}"] - opts: - env: _.extend({}, process.env, {ATOM_INTEGRATION_TESTS_ENABLED: true, ELECTRON_ENABLE_LOGGING: true}) - stdio: 'inherit' + if process.platform in ['darwin', 'linux'] + options = + cmd: appPath + args: ['--test', "--resource-path=#{resourcePath}", coreSpecsPath, "--user-data-dir=#{temp.mkdirSync('atom-user-data-dir')}"] + opts: + env: _.extend({}, process.env, {ELECTRON_ENABLE_LOGGING: true, ATOM_INTEGRATION_TESTS_ENABLED: true}) + stdio: 'inherit' + + else if process.platform is 'win32' + options = + cmd: process.env.comspec + args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", '--log-file=ci.log', coreSpecsPath] + opts: + env: _.extend({}, process.env, {ELECTRON_ENABLE_LOGGING: true, ATOM_INTEGRATION_TESTS_ENABLED: true}) + stdio: 'inherit' grunt.log.ok "Launching core specs." - spawn options, (error, results) -> + spawn options, (error, results, code) -> + if process.platform is 'win32' + process.stderr.write(fs.readFileSync('ci.log')) if error + fs.unlinkSync('ci.log') + else + # TODO: Restore concurrency on Windows + packageSpecQueue?.concurrency = concurrency + callback(null, error) grunt.registerTask 'run-specs', 'Run the specs', -> done = @async() startTime = Date.now() + method = + if concurrency is 1 + async.series + else + async.parallel specs = if process.env.ATOM_SPECS_TASK is 'packages' @@ -71,7 +121,7 @@ module.exports = (grunt) -> else [runCoreSpecs, runPackageSpecs] - async.series specs, (error, results) -> + method specs, (error, results) -> failedPackages = [] coreSpecFailed = null @@ -83,10 +133,13 @@ module.exports = (grunt) -> [coreSpecFailed, failedPackages] = results elapsedTime = Math.round((Date.now() - startTime) / 100) / 10 - grunt.log.ok("Total spec time: #{elapsedTime}s") + grunt.log.ok("Total spec time: #{elapsedTime}s using #{concurrency} cores") failures = failedPackages failures.push "atom core" if coreSpecFailed grunt.log.error("[Error]".red + " #{failures.join(', ')} spec(s) failed") if failures.length > 0 - done(not coreSpecFailed and failedPackages.length is 0) + if process.platform is 'win32' and process.env.JANKY_SHA1 + done() + else + done(not coreSpecFailed and failedPackages.length is 0) From c95412b451c332d09513893e3562fe5f0ba5406f Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Thu, 14 Apr 2016 14:39:59 -0700 Subject: [PATCH 6/7] Add ELECTRON_NO_ATTACH_CONSOLE in BufferedNodeProcess (cherry picked from commit 5f0ad9e015a3e36b337182bca152783b9f9f637e) --- src/buffered-node-process.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/buffered-node-process.coffee b/src/buffered-node-process.coffee index 3b4916b24..406775277 100644 --- a/src/buffered-node-process.coffee +++ b/src/buffered-node-process.coffee @@ -47,6 +47,7 @@ class BufferedNodeProcess extends BufferedProcess options ?= {} options.env ?= Object.create(process.env) options.env['ELECTRON_RUN_AS_NODE'] = 1 + options.env['ELECTRON_NO_ATTACH_CONSOLE'] = 1 args = args?.slice() ? [] args.unshift(command) From b05ec8f6839fbe3ab0863faa6f777662efb39c49 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Fri, 15 Apr 2016 11:14:47 -0400 Subject: [PATCH 7/7] :arrow_up: exception-reporting@0.38.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d43459ba..62bb8d5f1 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "deprecation-cop": "0.54.1", "dev-live-reload": "0.47.0", "encoding-selector": "0.21.0", - "exception-reporting": "0.38.0", + "exception-reporting": "0.38.1", "fuzzy-finder": "1.0.4", "git-diff": "1.0.1", "find-and-replace": "0.198.0",