Skip to content

Race condition bug in nextAsync code? #562

@fatso83

Description

@fatso83

I have noticed two flaky test runs today. Both only appeared during the Sauce Labs step of one of the workflows and just on the test-edge script (but if it fails here, it will short-circuit running subsequent tests)

First run

The first was this:

  1) FakeTimers
       nextAsync
         stays side-effect free when no timers:

      Error: [assert.equals] 30000000 expected to be equal to 0
      + expected - actual

      -30000000
      +0
      
      at Object.fail (node_modules/@***/referee/lib/create-fail.js:5:20)
      at Object.fail (node_modules/@***/referee/lib/define-assertion/index.js:47:16)
      at assertion (node_modules/@***/referee/lib/define-assertion/index.js:65:10)
      at referee.<computed>.<computed> [as equals] (node_modules/@***/referee/lib/define-assertion/index.js:92:21)
      at Context.<anonymous> (test/fake-timers-test.js:1952:19)

Re-running it made the test pass.

Second run

Also in the nextAsync bit of the timers:

  1) FakeTimers
       setTickMode
         nextAsync
           works with manual calls to async tick functions
             runToLastAsync:

      Error: [assert.equals] [ 1, 2, 3, 4, 5 ] expected to be equal to [ 1, 2, 3, 4 ]
      + expected - actual

         1
         2
         3
         4
      -  5
       ]
      
      at Object.fail (node_modules/@***/referee/lib/create-fail.js:5:20)
      at Object.fail (node_modules/@***/referee/lib/define-assertion/index.js:47:16)
      at assertion (node_modules/@***/referee/lib/define-assertion/index.js:65:10)
      at referee.<computed>.<computed> [as equals] (node_modules/@***/referee/lib/define-assertion/index.js:92:21)
      at Context.<anonymous> (test/fake-timers-test.js:4312:27)

These are the only two flaky test runs I can remember for as long as we have been doing this, which makes me a bit wary ...

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