Comments (15)
I tried this config
with this package.json ("@angular/core": "^13.0.0")
and still i have this shit
bro wtf, there is no winning, whatever I use in whatever sense - always an issue
from jest-preset-angular.
Did you check https://thymikee.github.io/jest-preset-angular/docs/guides/angular-13+?
from jest-preset-angular.
@ahnpnl yes, I did, I started with it, but there are always the same or similiar issues, mainly comming from node_modules
from jest-preset-angular.
The error I can see coming from a library you are using angular-support-bot
, this would mean you need to tell Jest to transform the library files via transformIgnoredPatterns
. That library has a folder node_modules
which Jest complains about.
from jest-preset-angular.
No, this isnt a library, its an app that I try to use the jest in
from jest-preset-angular.
It isnt even clear from the link u sent - should I use the jest.config.ts from here
or from example?
from jest-preset-angular.
It isnt even clear from the link u sent - should I use the jest.config.ts from here
or from example?
This is the part if you want to use ESM mode (The title "Use ES modules" seems to be not clear enough)
In your case, js
or ts
config file isn't related. The problem is about Jest can't transform files from your node_modules
for some reasons. The only way to fix is modifying transformIgnorePatterns
.
If your project doesn't have any custom config on transforming files, perhaps you can compare your project config with example project https://github.com/thymikee/jest-preset-angular/blob/main/examples/example-app-v13/jest.config.js?
Another way is configuring moduleNameMapper
to tell Jest where to load things.
from jest-preset-angular.
I also noticed that u enable this - skipNgcc: false,
but whenever I dont turn it to true, the following happens:
can it be somehow related?
I follow the exact config as u have in example for esm modules (npm run test-esm)
from jest-preset-angular.
If i skip it, following happens:
am i mentally challanged? something seems off whatever i try to do
from jest-preset-angular.
I'd recommend to keep skipNgcc: false
, this ensures you are compatible with future Angular versions, in v16 they removed View Engine.
It's hard to check about this without a repo. Maybe you can somehow replicate the issue in the example-app-v13
?
from jest-preset-angular.
@ahnpnl brother, i added this to the mjs config
but i get those errors now:
could u advise me to what direction should i look for?
from jest-preset-angular.
I can see that you are running Jest in ESM mode. The 2nd screenshot has a lib called cytiva-cui-design-ng
and the js of this lib is loaded with umd
. Maybe you can use moduleNameMapper
to instruct Jest to load mjs
file instead?
Moving to ESM mode is a very big thing btw. Normally I make CJS mode work first before trying out ESM mode.
from jest-preset-angular.
@ahnpnl thank u for your patience and responding to me, I managed to get past the config with your guidance and tests are almost working, I have one issue left to which I cannot comprehend and to which I cannot find a clear answer
I get this error while trying to use modules from my components library
This is how my library is in dist folder:
(I think it may be related) As I mentioned before, I have issue with running ngcc which produces following error
Could you perhaps point me to direction I should take to resolve this?
from jest-preset-angular.
I managed to tell ngcc to ignore the lib via this config:
But didnt resolve my issue
from jest-preset-angular.
Bumping to angular ver 14 didnt resolve nothing also
from jest-preset-angular.
Related Issues (20)
- [Feature]: Support Angular 16 HOT 5
- Unable to run tests [Bug]: HOT 1
- Angular 17 Support
- [Feature]: Angular 17 Support HOT 2
- [Bug]: ProxyZone not found when using jest functions imported from @jest/globals HOT 1
- [Bug]: Could not parse CSS stylesheet HOT 11
- [Bug]: jest-preset-angular 13.1.4 - `spyOn` no longer works for functions imported with `import * as` HOT 1
- [Feature]: Angular 17 support HOT 5
- [Bug]: Cannot read properties of undefined (reading 'each') of zone-testing HOT 3
- [Bug]: Drop support Angular versions
- [Bug]: Input signals in components cause tests to error out (Angular v17.1.0) HOT 8
- [Bug]: It is not work After config useESM: true HOT 3
- [Feature]: Support viewChild query from 17.2 HOT 4
- [Feature]: Support for contentChild signal functions HOT 1
- Unexpected tokenyntaxError: Unexpected token '??=' at wrapSafe (internal/modules/cjs/loader.js:1001:16) HOT 6
- [Bug]: Import in component is undefined under test HOT 2
- [Bug]: jest-global-mocks should set the value of `CSS` to undefined and not null
- [Feature]: Package Updation HOT 1
- [Bug]: input.required signals cannot be set in TestBed HOT 5
- [Feature]: Support `outputFromObservable` interop function for `output`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-preset-angular.