Mailspring/spec/n1-spec-runner
Evan Morikawa 14514a3413 fix(specs): change spec scheduler back to setTimeout
Summary:
Adds a new `npm run test-window` that will launch specs in a window so you
can use the debugger

The spec window wouldn't close because `onbeforeunload` was unnecessarily
preventing close. This circumvents this in spec mode.

Most significantly I discovered we can't use the synchronous timer for the
promise scheduler anymore. Suppose you do:

```
it('should error', async () => {
  try {
    await doSomething()
    throw new Error("doSomething should have thrown!")
  } catch (err) {
    expect(err.message).toMatch(/my message/)
  }
})
```

The way async/await is transpiled, when `doSomething` throws, the error
will propagate all the way back up to the uncaughtPromiseException handler
before the `catch` gets called and registered. The transpilation method
assumes that when the function gets executed it can synchrously advance
beyond the call before the `then` or `catch` resolve. When the promise
scheduler is synchronous this doesn't happen.

I chose to use `setTimeout` instead of `process.nextTick` or
`setImmediate` as the promise scheduler. `setTimeout` seems to work better
with Chrome's async function call stacks. `nextTick` and `setImmediate`,
being Node methods, skip Chrome's async watchers.

Test Plan:
I talked with Juan about these changes, in an upcoming diff he will be
testing these in the context of our broader test suite.

Reviewers: mark, khamidou, halla, spang, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3779
2017-01-25 17:43:11 -05:00
..
console-reporter.es6 fix(decaffeination) Remove second arg from some slice calls 2016-11-02 12:40:01 -07:00
jasmine-extensions.es6
jasmine.js fix(spelling): Correct references 2016-12-06 16:05:05 -08:00
master-after-each.es6 fix(spec): add support for async specs and disable misbehaving ones 2016-12-15 13:02:00 -05:00
master-before-each.es6
n1-gui-reporter.cjsx fix(specs): change spec scheduler back to setTimeout 2017-01-25 17:43:11 -05:00
n1-spec-loader.es6
n1-spec-runner.es6 fix(spec): add support for async specs and disable misbehaving ones 2016-12-15 13:02:00 -05:00
nylas-test-constants.es6
react-test-utils-extensions.es6
spec-bootstrap.es6 fix(lint): fix linter import error 2016-11-18 11:13:21 -08:00
terminal-reporter.es6
time-override.coffee fix(specs): change spec scheduler back to setTimeout 2017-01-25 17:43:11 -05:00
time-reporter.coffee