I read a lot of posts about this problem but I didn't understand how to fix it. I tried many solutions and I have still an error.
Details:
/home/work/project/node_modules/ngx-cookie-service/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export * from './cookie-service/cookie.service';
^^^^^^
SyntaxError: Unexpected token export
15 | this.sessionStorage = sessionStorage;
16 | this.localStorage = localStorageService;
> 17 | this.cookieService = cookieService;
| ^
18 | }
19 |
20 | public set(key, value, useSessionStorage = true) {
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
at Object.<anonymous> (src/myApp/coreModule/services/storageLayer.service.ts:17:30)
at Object.<anonymous> (src/myApp/itemModule/components/category.component.ts:30:32)
So I added this to my package.json :
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!ngx-cookie-service)"
]
}
The problem is still there. Anybody can help ? Should I use "moduleNameMapper" to mock ngx-cookie-service ?
Thank you very much !
Aucun commentaire:
Enregistrer un commentaire