pkalab / DiscordBot

MIT License
0 stars 0 forks source link

Tests failed #3

Open njmurarka opened 3 years ago

njmurarka commented 3 years ago

npm test

discordjs-unit-tests@1.0.0 test /Users/loquitus/src/gitcoin/bots/pkalab/DiscordBot/jest-unit-test jest

FAIL ./index.spec.ts ● Test suite failed to run

index.spec.ts:1:23 - error TS2307: Cannot find module 'cheerio/lib/api/traversing' or its corresponding type declarations.

1 import { index } from "cheerio/lib/api/traversing";
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index.spec.ts:3:32 - error TS2307: Cannot find module '/Users/polinakalabuhova/BotDisc/jest-unit-test' or its corresponding type declarations.

3 import { messageHandler } from "/Users/polinakalabuhova/BotDisc/jest-unit-test";
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 2.198 s Ran all test suites. npm ERR! Test failed. See above for more details.

pkalab commented 3 years ago

try npm init in jest-unit-test folder

pkalab commented 3 years ago

1 Navigate to jest-unit-test folder\ cd jest-unit-test 2 Install ts-jest npm install --save-dev jest typescript ts-jest @types/jest\

To run test cases npm test

njmurarka commented 3 years ago

Yes. This is what I did. I tried on Ubuntu Linux as well. Fails. Same error. It seems it is hardcoded or something, to look for something in your Mac home folder.

pkalab commented 3 years ago

Sorry for confusion. I updated the index.spec.ts with ../ instead of personal directory and removed cheerio library . It should work now with npm test