Skip to content
Snippets Groups Projects
Commit 7809e947 authored by Christopher Willis-Ford's avatar Christopher Willis-Ford
Browse files

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.
parent 068f21cc
No related branches found
Tags 0.1.0-prerelease.20191120165309
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment