Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not copy tests into .cache directory #2249

Closed
LegNeato opened this issue Sep 27, 2017 · 3 comments
Closed

Do not copy tests into .cache directory #2249

LegNeato opened this issue Sep 27, 2017 · 3 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@LegNeato
Copy link
Contributor

It appears gatsby caches its tests:

$ ls -1 .cache/__tests__/
__snapshots__
find-page.js
loader.js
prefetcher.js

I am using yarn's workspace support and jest. Jest by default tries to run the tests in the cache and fails with a bunch of errors like:

Loader › It stops downloading when the resourcesArray is empty

    TypeError: Cannot read property 'empty' of undefined
      
      at Object.<anonymous> (my_site/.cache/__tests__/prefetcher.js:11:15)
          at Promise (<anonymous>)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:169:7)

In order to get my tests to pass I had to add the cache directory to jests's ignores in package.json:

    "testPathIgnorePatterns": ["/node_modules/", "/\\.cache/"],
@KyleAMathews
Copy link
Contributor

Oh hmmm... that is bad. Could you put together a PR fixing the copying here?

await fs.copy(srcDir, siteDir, { clobber: true })

@LegNeato
Copy link
Contributor Author

LegNeato commented Sep 28, 2017

Hmmm, could possibly be due to my setup? I get the same error running yarn test in gatby's repo too.

I wonder if it is the same as #2244

@sebastienfi sebastienfi added API/Plugins type: bug An issue or pull request relating to a bug in Gatsby labels Oct 1, 2017
@KyleAMathews
Copy link
Contributor

Closing this issue as it's fairly old and we have far too many open issues! If you have additional problems in this area, please open a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants