kata-machine
kata-machine copied to clipboard
Cannot find module '@code/LinearSearchList'
Hello,
When I tried to test the search linear algorithm by running the command npx jest Linear
, I received the error message
Cannot find module '@code/LinearSearchList' or its corresponding type declarations.
same things is happaning on here
I ran node scripts/generate.js 2
and the code was generated in src/day2
Hi!
- Fix your code:
You should pass your code to test. If you have a structure:
src_tests_\YourTestFile
src\day1\YourFileName
Put it in your test instead @code/YourFileName;
In my case:
- Or try to generate files with the script: node scripts/generate
Not sure if this helps. When I cloned the repo I had to follow the Primes/Kata-machine github Read.me instructions. e.g. I had to update the ligma.js file etc and install ts-jest to get tests running: https://kulshekhar.github.io/ts-jest/docs/getting-started/installation/
- npm install
- npm run generate
- npx jest "algorithm test file" - i.e npx run LinearSearchList
I had a similar issue after doing yarn install
again (which created "day2"..) - but then wanting to re-run some code from day1. I manually edited the paths within .jest.config.json
and tsconfig.json
which fixed it.