alitnk / monopay

💳 A node.js package for making payment transactions with different payment gateways
https://monopay.js.org
MIT License
114 stars 19 forks source link

Cannot find module `drivers/behpardakht` from `src/drivers.ts` #31

Closed Keivan-sf closed 2 years ago

Keivan-sf commented 2 years ago

I was trying to test a new feature then I've faced this:

Cannot find module 'drivers/behpardakht' from 'src/drivers.ts'

    Require stack:
      src/drivers.ts
      src/drivers/behpardakht/behpardakht.spec.ts

    > 1 | import { Behpardakht, BehpardakhtAPI } from 'drivers/behpardakht';
        | ^
      2 | import { IdPay, IdPayAPI } from 'drivers/idpay';
      3 | import { NextPay, NextPayAPI } from 'drivers/nextpay';
      4 | import { Parsian, ParsianAPI } from 'drivers/parsian';

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:487:11)
      at Object.<anonymous> (src/drivers.ts:1:1)
      at Object.<anonymous> (src/drivers/behpardakht/behpardakht.spec.ts:1:1)

The results are the same while testing every other driver.

To reproduce: yarn test

Expected behavior: run the tests without error

Fix: bringing back ./ to import routes in drivers.ts seems to have fixed the issue for me

How ever yarn prebuild and yarn build have no problem. I'm starting to think there's something wrong with my own general jest config cause it had happened before.

If the tests are generally failing for every one, let me know to create a pull request

alitnk commented 2 years ago

Happens for me as well - must have broken when moving the test files. I'll fix it and add you as a co-author. Having you do it might result in some conflicts as I'm making a bunch of huge changes right now.