From 6159a6a62fff660461bff54ae8f7cc8f8d12ef5b Mon Sep 17 00:00:00 2001 From: Joris van der Wel Date: Mon, 8 Jan 2024 00:06:00 +0100 Subject: [PATCH] [Fix] `npm test` on windows The version of "nyc" (v9) that was being used was not launching `tap` properly on windows. So a dev dependency has been added for the latest nyc (v15), which appears to fix the issue. Note that version 9 of "nyc" was actually being installed indirectly, as a dependency of "tap". I think using indirect dependencies is a bad idea, and also it appears that newer versions of tap no longer have nyc as a dependency anyway. (Updating tap is a lot more work, so I want to avoid that for now). Also, the windows shell does not understand single quotes, so an extra npm run script is required. --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d71a5d0f..b5dd98a3 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "js-yaml": "^3.14.0", "npm-run-posix-or-windows": "^2.0.2", "npmignore": "^0.3.0", + "nyc": "^15.1.0", "safe-publish-latest": "^2.0.0", "tap": "^8.0.1", "tap-parser": "^5.4.0" @@ -80,9 +81,10 @@ "prelint": "npm-run-posix-or-windows eclint", "lint": "eslint --ext .js,.cjs,.mjs . bin/*", "pretest": "npm run lint", - "test": "npm run tests-only", + "test": "npm-run-posix-or-windows tests-only", "posttest": "aud --production", "tests-only": "nyc tap 'test/*.js'", + "tests-only:windows": "nyc tap test/*.js", "test:example": "find example -name '*.js' | grep -v fail | grep -v static | xargs tap" }, "testling": {