Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of console, stdout, and stderr in Jasmine tests #18863

Merged
merged 1 commit into from Feb 17, 2019

Conversation

Projects
None yet
1 participant
@smashwilson
Copy link
Member

commented Feb 17, 2019

Requirements for Contributing a Bug Fix

Identify the Bug

Possibly related to #15868? I'll need to verify if this helps in that scenario. But this is an annoyance that I encountered trying to debug #18857, which is a failure we're seeing only in CI. Basically: when running specs that use the default Jasmine spec runner in a headless window, console.log and console.error do nothing.

Description of the Change

When launching a headless spec runner, initialize console.log, console.error, process.stdout, and process.stderr to point to the standard out and err streams exposed through Electron's "remote" module.

All credit to @BinaryMuse for giving me the code to yank from our Mocha runner, which doesn't have this problem:

https://github.com/BinaryMuse/atom-mocha-test-runner/blob/e69077dec77e11d28a22b09e40b999f84cb5c495/lib/create-runner.js#L51-L59

Alternate Designs

N/A

Possible Drawbacks

Other console methods (console.table, console.dirxml...) still have their output eaten. They're a little less obvious to stub, though, and are less widespread for good old-fashioned printf-style debugging.

Verification Process

I'm verifying that this works properly by focusing a spec and adding console.log and console.error statements to its beginning. Ideally, they should be visible:

  • locally
    • when headless;
    • when using the graphical spec runner;
  • in CI;
    • on Windows;
    • on macOS;
    • on Linux.

Release Notes

  • console.log and console.error output to standard out and error when invoked from the headless test runner..

@smashwilson smashwilson force-pushed the aw/console-in-tests branch from 01be166 to f0fb288 Feb 17, 2019

@smashwilson smashwilson merged commit 1acf913 into master Feb 17, 2019

2 of 3 checks passed

Atom Pull Requests #20190217.10 failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@smashwilson smashwilson deleted the aw/console-in-tests branch Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.