-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Last version 4.18.2 breaks unit test in the proyect. #5786
Comments
I was experiencing the same error, so I had to add this override in my package.json to make it work:
It's a temporary workaround until it's resolved. |
Thanks for the issue! This issue has been labeled as Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed. If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue. For a guide on how to create a good reproduction, see our Contributing Guide. |
seems like adoptedStyleSheets is not supported by jsdom. question is why this stencil code is executed now and not before. because this code part is there in the stencil code for a long time. jsdom/jsdom#3444 i am getting this error in an ionic project using ionic/angular/standalone components and jest i can confirm it is working with 4.18.1 |
If you use |
I'm facing a similar issue since I updated my Ionic-Project from v7 to v8. I created a basic demo project. Just do "npm install" and "ng test". When adding the workaround with stencil version 4.18.1 like mentioned above, it's working. Github Repo with example: https://github.com/Floscho2402/ionic-8-jest-issue |
Thank you @Floscho2402 for providing the reproduction case. I will take a look as soon as i can. |
@Floscho2402 I checked out your reproduction case and struggle to reproduce the case. I've done the following: ❯ g clone https://github.com/Floscho2402/ionic-8-jest-issue.git
Cloning into 'ionic-8-jest-issue'...
...
Resolving deltas: 100% (2/2), done.
❯ cd ionic-8-jest-issue/
❯ npm i
...
added 1735 packages, and audited 1736 packages in 38s
219 packages are looking for funding
run `npm fund` for details
2 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
❯ npx ng test
...
PASS src/app/pages/maintenance/components/demo/demo.component.spec.ts (15.494 s)
DemoComponent
✓ should create (43 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 16.988 s
Ran all test suites. Even after removing the given Stencil dependency from |
@christian-bromann I am really surprised. I have no idea why it works for you. Before I uploaded the code, I checked it with a colleague and he also gets the same error as me. To be sure I tried it again and deleted my node_modules, ran "npm cache clear --force" and "jest --clearCache". Then I reinstalled everything and still got the error. I don't know, if it's relevant for you, but this is my ionic info output: Ionic: Ionic CLI : 7.2.0 (C:\Users\flori\AppData\Roaming\npm\node_modules@ionic\cli) Utility: cordova-res : not installed globally System: NodeJS : v18.15.0 (C:\Program Files\nodejs\node.exe) |
This will be fixed in #5838. You can use a dev release by running |
Prerequisites
Stencil Version
4.18.2
Current Behavior
When running unit test error appeared.
ERROR: 'Unhandled Promise rejection:', 'Failed to set the 'adoptedStyleSheets' property on 'Document': Failed to convert value to 'CSSStyleSheet'.', '; Zone:', '', '; Task:', 'requestAnimationFrame', '; Value:', TypeError: Failed to set the 'adoptedStyleSheets' property on 'Document': Failed to convert value to 'CSSStyleSheet'.
TypeError: Failed to set the 'adoptedStyleSheets' property on 'Document': Failed to convert value to 'CSSStyleSheet'.
at addStyle (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@stencil/core/internal/client/index.js:664:44)
at attachStyles (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@stencil/core/internal/client/index.js:674:20)
at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@stencil/core/internal/client/index.js:1458:5
Expected Behavior
Run test
System Info
Steps to Reproduce
npm install and run unit test
Code Reproduction URL
Additional Information
The text was updated successfully, but these errors were encountered: