Bug(Tests): Testfile not launching in ESM mode
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Which Transloco package(s) are the source of the bug?
Transloco, Scoped Libs
Is this a regression?
No
Current behavior
I am using this minimum repro repository I’ve made (see in the dedicated area underneath) So it’s using Angular 14, Transloco, Spectator (it’s pretty much all, and it’s the stack i’m using in my real project so I kinda need this stack to work 🙏 )
When I launch the test from the root directory with
node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=projects/ticketing-lib-ui-library/jest.config.mjs --no-cache
I get this error :
After a bit of search, I found that when I change the import of ‘flat’ in the file node_modules@ngneat\transloco\fesm2020\ngneat-transloco.mjs
from this:
import { unflatten as unflatten$1, flatten as flatten$1 } from 'flat';
to this:
import * as flat from 'flat'; const unflatten$1 = flat.unflatten; const flatten$1 = flat.flatten;
I get another error after launching the tests:
Expected behavior
I expect the test to pass as it is only a “should init” test.
Please provide a link to a minimal reproduction of the bug
https://github.com/jnain/minimum-transloco-spectator-repro
Transloco Config
Not relevant and can be found in the repo (but not sure it is complete as I removed a lot of my project)
Please provide the environment you discovered this bug in
Transloco: ~4.1.1
Angular: ^14.1.0
Node: v16.16.0
Package Manager: npm 8.11.0
OS: Windows
Browser
Jest test framework
Additional context
No response
I would like to make a pull request for this bug
If you really help me for this I can but as it is touching to your exported types, I’m not sure I can help…
Issue Analytics
- State:
- Created a year ago
- Comments:6
I seem to have fix this problem in my PR, I would like to have some news about all of this please…
@jnain Yeah thinking of doing the same. Thanks man! Really helpful!