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

Yarn test fails in utils package #8

Open
jorgeruvalcaba opened this issue Dec 14, 2020 · 2 comments
Open

Yarn test fails in utils package #8

jorgeruvalcaba opened this issue Dec 14, 2020 · 2 comments

Comments

@jorgeruvalcaba
Copy link

When I run yarn jest under utils package I got this error:

FAIL  tests/deferred.test.ts
  ● Test suite failed to run

    Cannot find module '@shlack/utils' from 'tests/deferred.test.ts'

Types package works fine, I also tried with the same versions of yarn and node used in the video but the bug persists.

@joshua-owens
Copy link

I ran into a similar issue only to realize I never ran the build command for the utils package.

In the video Cleaning Out Rimraf Mike prefaces the video with a disclaimer

If you're gonna repeat what I'm doing here, I advise you also stage your files because we're gonna create some junk

Which prompted me to kick back, stop following along and just observe.

Due to the main key in package.json pointing at dist/index.js you need to run the build command to generate the dist directory for the tests to run properly.

To get the tests to run

In the packages/utils directory:

Install the missing dependencies

yarn add date-fns react
yarn add -D @types/date-fns @types/react

Run the build command

yarn build

Run the tests again:

yarn jest

The tests should run and pass now 🎉

@pjchender
Copy link

@joshua-owens Thanks. Really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants