* Make the Runner manage the snapshot state. Thread an accessor to the
`t.snapshot()` assertion.
* Save snapshots when runner has finished. Fixes#1218.
* Use jest-snapshot directly, without serializing values. Use jest-diff
to generate the diff if the snapshot doesn't match. This does mean the
output is not colored and has other subtle differences with how other
assertions format values, but that's OK for now. Fixes#1220, #1254.
* Pin jest-snapshot and jest-diff versions. This isn't ideal but we're
using private APIs and making other assumptions, so I'm not comfortable
with using a loose SemVer range.
Show instructions on how to use `t.throws()` with the test results,
without writing them to stderr. Detect the improper usage even if user
code swallows the error, meaning that tests will definitely fail.
Assume that errors thrown, or emitted from an observable, or if the
returned promise was rejected, that that error is due to the improper
usage of `t.throws()`.
Assume that if a test has a pending throws assertion, and an error leaks
as an uncaught exception or an unhandled rejection, the error was
thrown due to the pending throws assertion. Attribute it to the test.
Rather than keeping an infinite timer open, waiting for `t.end()` to be
called, fail the callback test if it is not ended when the event loop
empties.
Similarly, fail promise/observable returning tests if the promise hasn't
fulfilled or the observable hasn't completed when the event loop
empties.
Note that user code can keep the event loop busy, e.g. if it's listening
on a socket or starts long timers. Even after this change, async tests
may hang if the event loop is kept busy.
* Properly dump errors
* Only print actual and expected values if they're present, and strings.
This assumes they're serialized in the test workers
* Strip ANSI from actual and expected values
* Print additional name & message properties
* Determine 'at' value similar to serialize-error.js. Recompute since
here we want the full line
* Print unhandled errors using the same logic
* package-hash@^2
* Allow precompiler setup to be asynchronous
* Consistently refer to babel-config module as babelConfigHelper
* Manage Babel config using hullabaloo
Fixes#707
* Disable Babel cache when precompiling
`flow check` is easily taking 30 seconds on my development machine,
presumably it's checking too many files. Move the .flowconfig into
the flow-types test directory and only include the index.js.flow file
to improve check speed.
* Resolve absolute source file path when serializing errors
Fixes#1270.
* Bail excerpting code if file cannot be read
* temp-write@^3.1.0
* Restrict code excerpts to tests/helpers/sources
Don't show code excerpts for dependencies or code outside the project
directory. Determine where the source lives when serializing the error.
Then, when excerpting the code, bail if it lives outside the project
or is a dependency.
Closes#1224.
This adds flow-bin, adds it to the test running script, and adds some regression tests based on prior issues.
In an immediate proof of value (and proof of my own prior sloppiness) it spotted an issue that #1219 sought to fix and did not do so. Fix included along with test.
2m 35sec → 1m 14s
Went with 4 cores as that seemed the most optimal. I've experienced that number being the most optimal for other things in the past too.
Current
2m 35sec
2 cores
1m 37s
3 cores
1m 29s
4 cores
1m 14s
6 cores
1m 31s
* Avoid running XO on older Node.js versions
* xo@^0.17.0
* Split up cli.js
Move the actual implementation into lib/cli.js to avoid top-level
returns. xo@^0.17.0 cannot parse the file with those returns present.
Throw errors from lib/cli.js and write them to stderr in cli.js before
exiting. XO doesn't appreciate process.exit() calls in modules.
Note that the error for invalid Babel config is now written to stderr,
which seems like an improvement to me.
* Actually register loud-rejection
Some older versions that are still matched by semver were buggy and some users were somehow getting those versions. Maybe from a stale npm cache.
Fixes#1058