manuerwin / joplin-plugin-attache

Mass replacement of resources such as resized image files.
GNU General Public License v3.0
11 stars 0 forks source link

Jest testing won't import joplin from api #1

Closed manuerwin closed 2 years ago

manuerwin commented 2 years ago

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.......