You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using version 5.1.2 and jest version 26.6.3. When using pdf-merger-js/browser, I was getting an error of "Jest encountered an unexpected token. This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript." when running my jest tests even after properly mocking.
I was eventually able to get around this by adding 'pdf-merger-js': '<rootDir>/node_modules/pdf-merger-js/browser.d.ts', to the moduleNameMapper section in my jest config file.
Also when mocking, I had to do jest.mock('pdf-merger-js') instead of jest.mock('pdf-merger-js/browser') which was a bit confusing.
Just wanted to see if this was expected. I saw no other mentions of having other people having this issue
The text was updated successfully, but these errors were encountered:
Hello!
I am using version 5.1.2 and jest version 26.6.3. When using
pdf-merger-js/browser
, I was getting an error of "Jest encountered an unexpected token. This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript." when running my jest tests even after properly mocking.I was eventually able to get around this by adding
'pdf-merger-js': '<rootDir>/node_modules/pdf-merger-js/browser.d.ts',
to themoduleNameMapper
section in my jest config file.Also when mocking, I had to do
jest.mock('pdf-merger-js')
instead ofjest.mock('pdf-merger-js/browser')
which was a bit confusing.Just wanted to see if this was expected. I saw no other mentions of having other people having this issue
The text was updated successfully, but these errors were encountered: