Skip to content

Race condition on ng test #293

Closed
Closed

Description

@filipesilva

There might be a race condition when running ng test. On a newly generated project I got the following output when running ng test once, killing it, then running again:

(on the first run notice the karma watcher warnings before build is done, and that 0 tests run)

filipe.silva@DESKTOP-7ND6T3R MINGW64 /E/dev/ideablade/testing/testproj6 (master)
$ ng test
Building11 03 2016 11:17:08.275:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.js" does not match any file.
11 03 2016 11:17:08.278:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.html" does not match any file.
11 03 2016 11:17:08.279:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.css" does not match any file.
11 03 2016 11:17:08.280:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.ts" does not match any file.
11 03 2016 11:17:08.281:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.js.map" does not match any file.
Building...

Build successful - 2595ms.

Slowest Trees                                 | Total
----------------------------------------------+---------------------
DiffingTSCompiler                             | 2359ms

Slowest Trees (cumulative)                    | Total (avg)
----------------------------------------------+---------------------
DiffingTSCompiler (1)                         | 2359ms

11 03 2016 11:17:11.229:WARN [karma]: No captured browser, open http://localhost:9876/
11 03 2016 11:17:11.240:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
11 03 2016 11:17:11.259:INFO [launcher]: Starting browser Chrome
11 03 2016 11:17:18.699:INFO [Chrome 48.0.2564 (Windows 10 0.0.0)]: Connected on socket /#_70pkh4fF_89rpxsAAAA with id 37874958
Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'

Chrome 48.0.2564 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.004 secs / 0 secs)


filipe.silva@DESKTOP-7ND6T3R MINGW64 /E/dev/ideablade/testing/testproj6 (master)
$ ng test
Building11 03 2016 11:17:34.176:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.css" does not match any file.
Building.11 03 2016 11:17:36.771:WARN [karma]: No captured browser, open http://localhost:9876/
11 03 2016 11:17:36.791:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
11 03 2016 11:17:36.798:INFO [launcher]: Starting browser Chrome
Building...

Build successful - 2505ms.

Slowest Trees                                 | Total
----------------------------------------------+---------------------
DiffingTSCompiler                             | 2287ms

Slowest Trees (cumulative)                    | Total (avg)
----------------------------------------------+---------------------
DiffingTSCompiler (1)                         | 2287ms

11 03 2016 11:17:44.364:INFO [Chrome 48.0.2564 (Windows 10 0.0.0)]: Connected on socket /#a-Kii2MGcnRXTJ97AAAA with id 51965993
Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'

Chrome 48.0.2564 (Windows 10 0.0.0): Executed 2 of 2 SUCCESS (0.019 secs / 0.013 secs)

/cc @Brocco

Activity

  1. filipesilva commented on Mar 11, 2016

    @filipesilva
    ContributorAuthor

    I've another log that seems to show something fishy is going on. When working on #292. I added a route and then ran ng test, and the tests ended up running twice back to back with no file change in between:

    11 03 2016 11:22:04.073:INFO [karma]: Delaying execution, these browsers are not ready: Chrome 48.0.2564 (Windows 10 0.0.0)
    Chrome 48.0.2564 (Windows 10 0.0.0): Executed 2 of 2 SUCCESS (0.017 secs / 0.012 secs)
    Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'
    
    Chrome 48.0.2564 (Windows 10 0.0.0): Executed 6 of 6 SUCCESS (0.167 secs / 0.156 secs)
    

    It seems karma is running before the build is done, and then running afterwards when it sees the built files.

    Full log:

    filipe.silva@DESKTOP-7ND6T3R MINGW64 /E/dev/ideablade/testing/testproj6 (master)
    $ ng g route hero
    installing route
      add route hero
      create src\app\hero\hero-detail.component.css
      create src\app\hero\hero-detail.component.html
      create src\app\hero\hero-detail.component.spec.ts
      create src\app\hero\hero-detail.component.ts
      create src\app\hero\hero-list.component.css
      create src\app\hero\hero-list.component.html
      create src\app\hero\hero-list.component.spec.ts
      create src\app\hero\hero-list.component.ts
      create src\app\hero\hero-root.component.ts
      create src\app\hero\hero.service.spec.ts
      create src\app\hero\hero.service.ts
    installing route-config
      create src\app\route-config.ts
    filipe.silva@DESKTOP-7ND6T3R MINGW64 /E/dev/ideablade/testing/testproj6 (master)
    $ ng test
    Building11 03 2016 11:21:56.830:WARN [watcher]: Pattern "E:/dev/ideablade/testing/testproj6/dist/**/*.css" does not match any file.
    Building.11 03 2016 11:21:59.852:WARN [karma]: No captured browser, open http://localhost:9876/
    11 03 2016 11:21:59.863:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
    11 03 2016 11:21:59.869:INFO [launcher]: Starting browser Chrome
    Building...
    
    Build successful - 2926ms.
    
    Slowest Trees                                 | Total
    ----------------------------------------------+---------------------
    DiffingTSCompiler                             | 2677ms
    
    Slowest Trees (cumulative)                    | Total (avg)
    ----------------------------------------------+---------------------
    DiffingTSCompiler (1)                         | 2677ms
    
    11 03 2016 11:22:03.490:INFO [Chrome 48.0.2564 (Windows 10 0.0.0)]: Connected on socket /#dCp4Rmfh94NifwBDAAAA with id 58008592
    11 03 2016 11:22:03.820:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-detail.component.html".
    11 03 2016 11:22:03.824:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-detail.component.css".
    11 03 2016 11:22:03.825:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-detail.component.js".
    11 03 2016 11:22:03.825:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-detail.component.spec.js".
    11 03 2016 11:22:03.830:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-list.component.css".
    11 03 2016 11:22:03.831:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-list.component.js".
    11 03 2016 11:22:03.832:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-list.component.html".
    11 03 2016 11:22:03.833:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-list.component.spec.js".
    11 03 2016 11:22:03.834:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero-root.component.js".
    11 03 2016 11:22:03.834:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero.service.js".
    11 03 2016 11:22:03.841:INFO [watcher]: Added file "E:/dev/ideablade/testing/testproj6/dist/app/hero/hero.service.spec.js".
    Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'
    
    11 03 2016 11:22:04.073:INFO [karma]: Delaying execution, these browsers are not ready: Chrome 48.0.2564 (Windows 10 0.0.0)
    Chrome 48.0.2564 (Windows 10 0.0.0): Executed 2 of 2 SUCCESS (0.017 secs / 0.012 secs)
    Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'
    
    Chrome 48.0.2564 (Windows 10 0.0.0): Executed 6 of 6 SUCCESS (0.167 secs / 0.156 secs)
    
    
    filipe.silva@DESKTOP-7ND6T3R MINGW64 /E/dev/ideablade/testing/testproj6 (master)
    $ ng test
    Building.11 03 2016 11:22:29.479:WARN [karma]: No captured browser, open http://localhost:9876/
    11 03 2016 11:22:29.491:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
    11 03 2016 11:22:29.499:INFO [launcher]: Starting browser Chrome
    Building...
    
    Build successful - 2458ms.
    
    Slowest Trees                                 | Total
    ----------------------------------------------+---------------------
    DiffingTSCompiler                             | 2222ms
    
    Slowest Trees (cumulative)                    | Total (avg)
    ----------------------------------------------+---------------------
    DiffingTSCompiler (1)                         | 2222ms
    
    11 03 2016 11:22:33.089:INFO [Chrome 48.0.2564 (Windows 10 0.0.0)]: Connected on socket /#sF1H9SoaDyNSf09DAAAA with id 14110543
    Chrome 48.0.2564 (Windows 10 0.0.0) WARN: 'DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask'
    
    Chrome 48.0.2564 (Windows 10 0.0.0): Executed 6 of 6 SUCCESS (0.148 secs / 0.136 secs)
    
  2. added a commit that references this issue on Mar 18, 2016
    1afbc7e
  3. added 2 commits that reference this issue on Mar 18, 2016
    d8bdbee
    8aceee2
  4. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    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.

  5. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions