Closed victoragung closed 1 year ago
The fix for this is in an outstanding PR here: https://github.com/getsaf/shallow-render/pull/223
I'm seeing the same problem in an Angular 15
application, although the error message looks a bit different. Hoping this helps other people find this issue if they're experiencing the same problem.
/usr/src/app/node_modules/shallow-render/dist/index.d.ts:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { Shallow } from './lib/shallow';
^^^^^^
SyntaxError: Unexpected token 'export'
9 | import { MockSharedFeatureOrganisationModule } from '../libs/shared/feature-organisation/src/testing.index';
10 | import { SharedFeatureOrganisationModule } from '../libs/shared/feature-organisation/src/index';
> 11 | import { Shallow } from 'shallow-render';
| ^
12 |
13 | import '@angular/localize/init';
14 |
at Runtime.createScriptFromCode (../../../node_modules/jest-runtime/build/index.js:1796:14)
at Object.<anonymous> (../../../jest/setupJest.ts:11:1)
Thanks for your suggested fix @victoragung, I've patch-packaged
it into my repo for now, until this fix gets merged.
This should be fixed in v14.2.0
or v14.2.1
, thanks for the PR @victoragung!
Thank you! Credit should go to @develobrix :)
I created a new Angular 14.2 project and replaced karma with jest v28. I am able to get tests running using TestBed, however when I installed shallow-render@14 just running a simple test the Shallow object fails to resolve.
Here's a snapshot of the error
We have another project on Angular 13 with jest28 and that seems fine.