Jest: "No tests found" on docker with Jest v22 and v23

Created on 11 Jul 2018  路  2Comments  路  Source: facebook/jest

馃挜 Regression Report

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.

Last working version

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.

To Reproduce

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.

Expected behavior

With jest 22.4.4 (or above) in the package.json file, docker-compose run test should find test files and run them.

Link to repl or repo (highly encouraged)

Minimal repository: https://github.com/alistairjcbrown/jest-docker-issue

Run npx envinfo --preset jest

Paste 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
Regression

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

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings