Skip to content

Commit

Permalink
Add verification tests for Mocha's --extension option
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Mar 4, 2019
1 parent 80a9c56 commit 189e338
Show file tree
Hide file tree
Showing 9 changed files with 1,890 additions and 0 deletions.
26 changes: 26 additions & 0 deletions javascript/mocha-recursive-extensions-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Tests to verify Mocha's `--extension` behaviour

According to [Mocha's own docs](https://mochajs.org/#-extension-ext-watch-extensions-ext) one should be able to specify which extensions mocha will automatically load.

> Specifying --extension will remove .js as a test file extension; use --extension js to re-add it. For example, to load .mjs and .js test files, you must supply --extension mjs --extension js.
It quite clearly says that by specifying an extension, the default should be cleared. I have never seen this happen :-(

## Output contradicting the docs

The [`test`](./test) directory only contains a single file with the extension `bar`, so this means only one file should be loaded according to the docs. Instead, four files are loaded:
```
mocha --extension bar
This is not a test: no-test.js
normal.bar
✓ should do nothing but register the test
normal.bar.js
✓ should do nothing but register the test
normal.js
✓ should do nothing but register the test
```

0 comments on commit 189e338

Please sign in to comment.