-
- Downloads
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.
Loading
Please register or sign in to comment