From f7f78a22ae5d97fef69b4709510c8ad896c08f63 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 16 Oct 2019 12:24:21 +1100 Subject: [PATCH 1/2] New: Add a script for testing with more control --- docs/developer-guide/unit-tests.md | 6 +++++- package.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/developer-guide/unit-tests.md b/docs/developer-guide/unit-tests.md index 3c45d67a418..9b9bd440744 100644 --- a/docs/developer-guide/unit-tests.md +++ b/docs/developer-guide/unit-tests.md @@ -12,6 +12,10 @@ This automatically starts Mocha and runs all tests in the `tests` directory. You If you want to quickly run just one test, you can do so by running Mocha directly and passing in the filename. For example: - ./node_modules/.bin/mocha tests/lib/rules/no-wrap-func.js + npm test:cli tests/lib/rules/no-wrap-func.js Running individual tests is useful when you're working on a specific bug and iterating on the solution. You should be sure to run `npm test` before submitting a pull request. + +## More Control on Unit Testing + +`npm test:cli` is an alias of the Mocha cli in `./node_modules/.bin/mocha`. [Options](https://mochajs.org/#command-line-usage) are available to be provided to help to better control the test to run. diff --git a/package.json b/package.json index 39d8967d778..1d124f70af0 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "main": "./lib/api.js", "scripts": { "test": "node Makefile.js test", + "test:cli": "./node_modules/.bin/mocha", "lint": "node Makefile.js lint", "fix": "node Makefile.js lint -- fix", "fuzz": "node Makefile.js fuzz", From b886043d8835720822c7171067514ecc4bcee425 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 16 Oct 2019 15:09:04 +1100 Subject: [PATCH 2/2] ac --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d124f70af0..fde3e45f3ba 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "main": "./lib/api.js", "scripts": { "test": "node Makefile.js test", - "test:cli": "./node_modules/.bin/mocha", + "test:cli": "mocha", "lint": "node Makefile.js lint", "fix": "node Makefile.js lint -- fix", "fuzz": "node Makefile.js fuzz",