Running under Jest in a docker container is unable to find tests in v22 or v23, but can in v21. There are no problems running locally on OSX. Node version does not seem to be related.
Version 21.2.1
Stopped working in version:
I believe version 22.0.0, but based on other jest dependencies installed (jest-cli, etc.) it's hard to tell. Certainly in 22.4.4.
Minimal set of files are in this repo: https://github.com/alistairjcbrown/jest-docker-issue
With jest 21.2.1 in the package.json file, docker-compose run test which runs jest, finds files and passes.
With jest 22.4.4 in the package.json file, docker-compose run test which runs jest, fails to find test files.
With jest 22.4.4 (or above) in the package.json file, docker-compose run test should find test files and run them.
Minimal repository: https://github.com/alistairjcbrown/jest-docker-issue
npx envinfo --preset jestPaste the results here:
> $ docker-compose run test npx envinfo --preset jest
npx: installed 1 in 1.232s
System:
OS: Linux 4.9 Debian GNU/Linux 8 (jessie) 8 (jessie)
CPU: x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
Binaries:
Node: 10.6.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - /usr/local/bin/npm
npmPackages:
jest: 22.4.4 => 22.4.4
Looks like this can be worked around by creating a directory to copy files into and setting up a WORKDIR - maybe something in Jest v22 changed how it dealt with searching through top level files in a docker container? Using a work directory makes sense to me (though my docker knowledge is still fairly new).
I've created a branch off the minimal repository with the changes required to work and confirmed working with both latest v22 and v23.
Branch diff: https://github.com/alistairjcbrown/jest-docker-issue/compare/use-work-directory
@alistairjcbrown thanks man, saved my day!
Most helpful comment
Looks like this can be worked around by creating a directory to copy files into and setting up a
WORKDIR- maybe something in Jest v22 changed how it dealt with searching through top level files in a docker container? Using a work directory makes sense to me (though my docker knowledge is still fairly new).I've created a branch off the minimal repository with the changes required to work and confirmed working with both latest v22 and v23.
Branch diff: https://github.com/alistairjcbrown/jest-docker-issue/compare/use-work-directory