Skip to content

Add a script and an alias for nocha - #7

Open
maxolofsson1 wants to merge 5 commits into
mainfrom
nocha-cli
Open

Add a script and an alias for nocha#7
maxolofsson1 wants to merge 5 commits into
mainfrom
nocha-cli

Conversation

@maxolofsson1

Copy link
Copy Markdown

Run node --test by using nocha, any additional argument will be passed along to node.

@kristofferjansson

Copy link
Copy Markdown
Collaborator

I'm not entirely convinced about introducing a CLI that wraps node --test.

As we discussed, @maxolofsson1, you can define your defaults in scripts.test in package.json. For a convenient way to run both the entire test suite and individual test files, it's better not to include a glob pattern in package.json. If you omit it, the test runner will automatically pick up all files in the /test directory (see default patterns below). That way, running npm t runs the full suite, and npm t test/path/to/test-file.js runs a single test file.

If there are files in your test directory that shouldn’t be picked up, you can use --test-skip-pattern to exclude them.

By default, Node.js will run all files matching these patterns:
**/*.test.{cjs,mjs,js}
**/*-test.{cjs,mjs,js}
**/*_test.{cjs,mjs,js}
**/test-*.{cjs,mjs,js}
**/test.{cjs,mjs,js}
**/test/**/*.{cjs,mjs,js}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants