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

Running ng test with --include fails for IE11 #21239

Closed
1 of 15 tasks
ayonix opened this issue Jun 29, 2021 · 1 comment · Fixed by #21245
Closed
1 of 15 tasks

Running ng test with --include fails for IE11 #21239

ayonix opened this issue Jun 29, 2021 · 1 comment · Fixed by #21245

Comments

@ayonix
Copy link

ayonix commented Jun 29, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No, I don't think so.

Description

ng test --browsers=IE --include=**/*.spec.ts fails to run.

When tsconfig is targeting es5 because of IE11 support, running ng test with the --include flag replaces the const context = require.context... through the single-test-transform-plugin. The replacement is not transpiled further and thus fails to run tests in IE11.
We are using angular11, but this is still the case for angular12.

🔬 Minimal Reproduction

  • ng new test-ie
  • add Angular routing? No
  • Stylesheet? Css
  • npm install karma-ie-launcher --save-dev
  • remove not before IE11 in .browserslistrc
  • add require('karma-ie-launcher'), in karma.conf.js
  • set target to "es5" in tsconfig.json
  • run ng test --browsers=IE --include="**/*.spec.ts"

🔥 Exception or Error

Browser:

SCRIPT1002: Syntaxerror
main.js (132,32)

Console:

IE 11.0 (Windows 10) ERROR
  Syntaxerror
  at http://localhost:9876/_karma_webpack_/main.js:132:32

🌍 Your Environment


$ ng version

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

Angular CLI: 12.0.5
Node: 16.3.0
Package Manager: npm 7.15.1
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.5
@angular-devkit/build-angular   12.0.5
@angular-devkit/core            12.0.5
@angular-devkit/schematics      12.0.5
@schematics/angular             12.0.5
rxjs                            6.6.7
typescript                      4.2.4

Anything else relevant?

Just happens with IE11.

@ngbot ngbot bot modified the milestone: needsTriage Jun 29, 2021
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jun 29, 2021
@alan-agius4 alan-agius4 self-assigned this Jun 30, 2021
alan-agius4 added a commit that referenced this issue Jun 30, 2021
…n configuration

Previously, `target` was unset for `test` which caused the target to be set incorrectly.

Closes #21239
alan-agius4 added a commit that referenced this issue Jun 30, 2021
…n configuration

Previously, `target` was unset for `test` which caused the target to be set incorrectly.

Closes #21239

(cherry picked from commit 070a133)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants