Skip to content

Commit 0bab273

Browse files
authored
Bug Fixing: Mocha doesn't run all test files
Put single quotes around the pattern you pass to Mocha to prevent it being interpreted by your shell: 'src/**/*.test.js'. What happens is that, without the quotes, your shell tries to expand that pattern and is successful. The result of expansion is src/some-other-module/some-other-module.test.js and this is what is passed to Mocha. Before you created that file, the shell still tried to expand the pattern but was not successful and left the pattern as-is. So Mocha got src/**/*.test.js, which Mocha itself interpreted as a glob. In case you wonder, in Bash, unless the globstar option is turned on, ** is equivalent to *.
1 parent 7464840 commit 0bab273

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "typescript-node-api",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
77
"start": "node dist/index.js",
8-
"test": "mocha --reporter spec --compilers ts:ts-node/register test/**/*.test.ts"
8+
"test": "mocha --reporter spec --compilers ts:ts-node/register 'test/**/*.test.ts'"
99
},
1010
"keywords": [],
1111
"author": "",

0 commit comments

Comments
 (0)