Allow either slash in path passed to Jest
Jest takes an argument to specify which tests should be run. The argument is treated as a regular expression and matched against the filenames of potential tests. Unfortunately Jest does not normalize path separators to forward slashes when running this comparison, so (for example) `tests/unit` doesn't match anything on Windows. This change replaces the forward slash in Jest arguments with `[\\\\/]`. Ideally, that should just be `[\\/]` -- escaping the backslash so that it survives NPM's JSON parsing -- but unfortunately the Windows version of Jest parses its command line arguments differently from other platforms. Specifically, the Windows version of Jest processes backslashes one extra time. Fortunately having a redundant backslash is OK on Mac and Linux, so `[\\\\/]` ends up working on all platforms.
This commit is contained in:
1 parent
068f21cc9d
commit
7809e9470e
1 file changed
+2
-2
+2
-2
@@ -11,8 +11,8 @@
|
||||
"i18n:src": "babel src > tmp.js && rimraf tmp.js && ./scripts/build-i18n-source.js ./translations/messages/ ./translations/",
|
||||
"lint": "eslint . --ext .js,.jsx",
|
||||
"start": "npm run i18n:msgs && webpack-dev-server",
|
||||
"unit-test": "jest test/unit",
|
||||
"integration-test": "npm run build && jest --runInBand test/integration",
|
||||
"unit-test": "jest test[\\\\/]unit",
|
||||
"integration-test": "jest --runInBand test[\\\\/]integration",
|
||||
"test": "npm run lint && npm run unit-test && npm run integration-test",
|
||||
"watch": "webpack --progress --colors --watch"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user