Skip to content

Tests fail when $HOME is the same as the app directory when using yarn #2043

Closed
@jmorrell

Description

@jmorrell

Can you reproduce the problem with latest npm?

No, it is specific to the way yarn sets up its cache directory.

Description

In an environment where $HOME is also the application directory, yarn ends up creating its cache directory within the application directory. This is the case in Heroku's CI environment:

~ $ yarn cache dir
/app/.cache/yarn/v1
~ $ echo $HOME
/app
~ $ pwd
/app

Expected behavior

The default jest config should probably ignore tests found within .cache

Actual behavior

Any *.test.js files in the yarn cache end up getting executed with running yarn test, causing the tests to fail.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
~ $ yarn list react-scripts
yarn list v0.22.0
└─ react-scripts@0.9.5
  1. node -v:
~ $ node -v
v6.10.2
  1. npm -v:
~ $ yarn --version
0.22.0

Then, specify:

  1. Operating system:
~ $ uname -a
Linux fdedd5aa-0bd6-4529-b6bb-e6aef7830852 3.13.0-112-generic #159-Ubuntu SMP Fri Mar 3 15:26:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  1. Browser and version:

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions