Skip to content
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

Angular 19.0.6 breaks karma/jasmine on our build server by trying to load jasmine.css as a script module #29190

Closed
1 task done
hamfastgamgee opened this issue Dec 19, 2024 · 1 comment · Fixed by #29193
Closed
1 task done

Comments

@hamfastgamgee
Copy link

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

19.0.5

Description

After the 19.0.6 release (and presumably 19.1.0-next.2, although I have not tested that), our build server cannot execute tests appropriately because the new AngularPolyfillsPlugin executed to fix jasmine.clock turns the tag that is supposed to load jasmine.css into a <script type="module"> tag, which is clearly inappropriate for CSS. Interestingly, "ng test" executes fine on my local workstation (although the styles in karma if you load it up in the browser are broken) even with this change, but on our build server this results in the following error:

Chrome Headless 131.0.0.0 (Windows 10) ERROR
Uncaught Error loading node_modules/jasmine-core/lib/jasmine-core/jasmine.css
at http://localhost:9876/context.html:255:289

Rolling back to a pinned 19.0.5 works; obviously the bug that was addressed would be broken, but we don't use jasmine.clock in our tests. As far as I can tell, adding some additional logic around line 151 to ignore CSS files in application_builder.ts should do the trick.

Minimal Reproduction

Run "ng test" and observe the source code generated in the karma server, noting that the CSS file is improperly referenced as <script type="module">.

(I do not know why our build server fails here and my workstation succeeds, even running the same commands on the same Chrome version.)

Exception or Error

Chrome Headless 131.0.0.0 (Windows 10) ERROR
Uncaught Error loading node_modules/jasmine-core/lib/jasmine-core/jasmine.css
   at http://localhost:9876/context.html:255:289

Your Environment

_                      _                 ____ _     ___ 
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.0.6
Node: 20.11.1
Package Manager: npm 10.9.2
OS: win32 x64

Angular: 19.0.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.6
@angular-devkit/build-angular   19.0.6
@angular-devkit/core            19.0.6 (cli-only)
@angular-devkit/schematics      19.0.6
@angular/cdk                    19.0.4
@angular/cli                    19.0.6
@angular/material               19.0.4
@schematics/angular             19.0.6
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

jkrems added a commit to jkrems/angular-cli that referenced this issue Dec 19, 2024
We should only force the type for files that we know are JavaScript.
Otherwise we risk breaking the magic type detection done by Karma.

The previous code broke for `jasmine.css`.

Fixes angular#29190
@jkrems
Copy link
Contributor

jkrems commented Dec 19, 2024

Sorry for missing that in the initial PR! Thanks for the detailed report, created a follow-up change that will hopefully go out in the next release.

@clydin clydin closed this as completed in 916979c Dec 20, 2024
clydin pushed a commit that referenced this issue Dec 20, 2024
We should only force the type for files that we know are JavaScript.
Otherwise we risk breaking the magic type detection done by Karma.

The previous code broke for `jasmine.css`.

Fixes #29190

(cherry picked from commit 916979c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants