angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Test hangs if a TSCompiler rule fails

Open rfuhrer opened this issue 8 years ago • 3 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

Angular CLI: 6.0.8
Node: 10.3.0
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

Repro steps

  1. ng new TestTest gotta give it an awesome name since you're testing the test feature
  2. Open tsconfig.json and add "noUnusedLocals": true, to the compiler options
  3. Open app.component.ts and add Input to the import: import { Component, Input } from '@angular/core';
  4. run ng test

The log given by the failure

C:\git\TestTest>ng test
 10% building modules 1/1 modules 0 active(node:26184) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
06 07 2018 12:06:29.736:WARN [karma]: No captured browser, open http://localhost:9876/
06 07 2018 12:06:29.749:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
06 07 2018 12:06:29.750:INFO [launcher]: Launching browser Chrome with unlimited concurrency
06 07 2018 12:06:29.758:INFO [launcher]: Starting browser Chrome              × 「wdm」: Hash: a560bbf6f6cb4d2aebc7
Version: webpack 4.8.3
Time: 4663ms
Built at: 07/06/2018 12:06:29 PM
       Asset      Size     Chunks  Chunk Names
     main.js  6.21 KiB       main  main
polyfills.js  6.52 KiB  polyfills  polyfills
Entrypoint main = main.js
Entrypoint polyfills = polyfills.js
[./src/polyfills.ts] 0 bytes {polyfills} [built]
[0] multi ./src/polyfills.ts 28 bytes {polyfills} [built]
[./src/test.ts] 0 bytes {main} [built]

ERROR in src/app/app.component.ts(1,21): error TS6133: 'Input' is declared but its value is never read.

The test will hang here forever, until you correct the error.

Desired functionality

It should continue building and running the tests after the error. Or at least it should end the process if you're in --watch=false mode.

Mention any other details that might be useful

This is a big problem with my CI environment. If you submit some code that has an unused variable suddenly my build server hangs for an hour until the CI system finally decides to murder the process.

If you run ng build it powers through the error and still builds. This is what leads me to believe this is an error with the Angular CLI and not the TypeScript compiler. I'm assuming ng build and ng test should trigger the same compilation from TypeScript, yet one works and one doesn't.

rfuhrer avatar Jul 06 '18 18:07 rfuhrer

Thanks for reporting this but by default ng test is run in watch mode. Thus, it hangs forever waiting for the user to fix the error.

I tried to use ng test —watch=false and the process is being terminated.

alan-agius4 avatar Aug 23 '18 14:08 alan-agius4

Looks like this was fixed some time between 6.0.8 and 6.1.2. I was running ng test --karma-config karma-ci.conf.js --source-map=false --progress=false --watch=false on my CI environment and it would hang. Now it bails out when it hits the tslint error.

Thanks for checking this though

rfuhrer avatar Aug 23 '18 15:08 rfuhrer

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.