Jest testing won't import joplin from api
Closed this issue · 0 comments
manuerwin commented
Can't figure out what I'm missing, the import works in the app
import joplin from 'api';
However the same import in my test.ts file fails when I run 'npm test'
> joplin-plugin-replace-resources@0.9.1 test
> jest
FAIL __tests__/replaceResources.test.ts
● Test suite failed to run
Cannot find module 'api' from '__tests__/replaceResources.test.ts'
1 | import * as fs from 'fs-extra';
2 | import * as path from 'path';
> 3 | import joplin from 'api';
| ^
4 |
5 | const testBaseDir = path.join(__dirname, "ReplaceResourcesTest");
6 | const ext = ".png";
at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
at Object.<anonymous> (__tests__/replaceResources.test.ts:3:1)
Guessing it's some sort of jest path problem.......