This mostly reverts #815, and #827. The Node regressions they fixed were resolved in Node 6.2.0. The new behavior is just to print a warning message so people know how to fix it.
From the [`node-glob` docs](https://github.com/isaacs/node-glob#options):
> At the very least, you may pass in shared symlinks, statCache, realpathCache, and cache options, so that parallel glob operations will be sped up by sharing information about the filesystem.
* RunStatus#prefixTitle(), replace this.base only if it occurs at the beggining of path
* RunStatus#prefixTitle, filter out __tests__ from path
* added tests for RunStatus#prefixTitle
* Remove timestamp from non-watch test runs
* Fix mini reporter tests
* Pass options object to reporter constructor with watching boolean
* Refactor reporter options
* Move timestamp lines to watcher test
* refactor watcher tests
* move some methods from watcher to AvaFiles
* add some tests for ava-files
* add more test coverage
* fix linter error after merge
* PR Feedback
* use cross-platform split
* Basic macro support.
This adds basic macro support as discussed in #695.
It does not completely implement the spec outlined there, specifically:
- The macro can only specify the title using a function in `macroFn.title`. We discussed allowing `macroFn.title` to also be a string, and allowing some form of template language for extracting a title. However, using ES2015 string templates is already pretty easy, so we may just skip this.
- We discussed allowing groups of tests to be created using arrays.
Both the above proposals are found in [this comment](https://github.com/sindresorhus/ava/issues/695#issuecomment-205929738). They both enhance the implementation found in this commit, and would not break the contract. So I don't think there is anything preventing us from shipping this now.
* fix readme indentation
* spread arguments
* Allow arrays of macros
* pass providedTitle as first argument to title function.
* improve docs
If a non-function, non-promise, non-observable argument (i.e. a string) is passed to `t.throws`, the assertion passes. This obviously isn't what we want.
* change failing test hint
* mark .failing as code in readme
* group and reword failing tests
The tests are better when grouped together. I tried to give them more consistent titles too.
* remove spurious trailing space in t.end error message
Fixes#474
* add after.always, afterEach.always hook
* update readme about always modifier
* add test for verifying throw
* add tests for verifying always hook are added
* update readme for better "always" explaination
* fix typo in test/test-collection.js
* better always checking and implement
* modify error message for only
* fix build error
* add always to default in test
Fixes#699. The watcher tracks how many failures (actual failures, but also
rejections and uncaught exceptions) occurred for each test file. After each run,
if there are failures from files that were not rerun, the count is added to the
logger output.
Since #713 the API no longer emits 'dependencies' events. These are emitted
instead by the RunStatus, which can be obtained by listening to the 'test-run'
event on the API.
The watcher tests use a mocked API object which wasn't updated to reflect these
changes. Consequently dependency tracking was broken since #713 was merged.
This commit fixes the watcher and the corresponding tests. I've also added an
integration test which does not rely on mocking, helping us detect breakage
sooner.
* display current time when mini & verbose reporters finish
I'm using toLocaleTimeString() which works even back to Node.js 0.10. Forcing a
24-hour clock because we're geeks.
* watcher: restart logger on subsequent runs
The CLI starts the logger so the watcher shouldn't reset it on its first run.
Restart the logger after resetting, this allows the mini reporter to render its
spinner.
* better api.run stub in watcher test
Return an object for the runStatus, add assertions to verify this object is
passed to logger.finish()
* assert that r/rs reruns all tests
* clear mini reporter in watch mode
Clear the mini reporter unless the previous run had failures, or "r\n" was
entered on stdin.
* consistent empty lines in finish output
Always print two empty lines before each error/rejection/exception when the mini
and verbose reporters finish. Remove trailing whitespace from stack traces.
Always print an empty line after the finish output.
Add a test helper to more easily compare line output, with useful debug
information. At the moment this new helper is only used for failing tests.
* print line if reporter was not be cleared
Watch mode won't clear the mini reporter if there were errors, or "r\n" was
entered on stdin. The verbose reporter can't be cleared at all. To improve the
separation between multiple test runs, write a horizontal line when starting a
new test run and the reporter was not cleared.
* remove debug output from cli test
* watcher: correctly test if source is in the cwd
Make sure the path starts with ../ (after platform-specific slashes have been
corrected). Clarify existing test and add a case where the source starts with
two dots but is still in the current working directory.
* change handling of negated source patterns
Fixes#614. Allow negated source patterns to be specified without unsetting the
default negation patterns.
Allow source patterns to override the default negation patterns if they start
with one of the ignored directories.
* update watch mode docs
* Suggest `watch:test` as the npm script
* Document how to always enable watch mode using the ava section in package.json
* Recommend source patterns are configured through the ava section in package.json
* Suggest using the verbose reporter when debugging
* detect improper use of t.throws
Protects against a common misuse of t.throws (Like that seen in #739).
This required the creation of a custom babel plugin.
https://github.com/jamestalmage/babel-plugin-ava-throws-helper
* relative file path and colors
* protect against null/undefined in _setAssertError
* use babel-code-frame to do syntax highlighting on the Error
* require `babel-code-frame` inline. It has a sizable dependency graph
* remove middle section of message. It is redundant given code-frame
* further tests and add documentation.
* update readme.md
* extract files processing from api
* extract test-data class from API
* fix breakage from rebase
* pass testData to reporters in every method
* rename testData to runStatus
* runStatus.listenToTestRun => runStatus.observeFork
* rename test-data.js to run-status.js
* fix failing watcher test
The watcher used dir**/*.js as the recursive pattern when the initial pattern
matched a directory. This should be dir/**/*.js instead. Before this fix tests
were matched as sources, causing all tests to be rerun.
* refactor `ok` to `truthy` and `notOk` to `falsy`
* update tests to be more explicit
* update docs to use a better assertion api
* realign power-assert output
* quick typo fix
* update assertions