mocha icon indicating copy to clipboard operation
mocha copied to clipboard

🐛 Bug: --delay and grep not working reliably

Open plasticrake opened this issue 6 years ago • 2 comments

Prerequisites

  • [x] Checked that your issue isn't already filed by cross referencing issues with the common mistake label
  • [x] Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • [x] 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • [x] Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend avoiding the use of globally installed Mocha.

Description

I am running mocha with --delay and calling run(). Grep works unreliable with my tests unless I specify the exact file.

Steps to Reproduce

I created a gist to replicate: https://gist.github.com/plasticrake/71e6a69de1c9bf8d8234ab597cde6a77

mocha --delay

  Sync Mocha
    Will it grep3?
      ✓ it grepped3!

  Async Mocha
    Will it grep1?
      ✓ it grepped1!

  Async Mocha
    Will it grep2?
      ✓ it grepped2!

  3 passing (5ms)

grep1 works

mocha --delay -f grep1

  Async Mocha
    Will it grep1?
      ✓ it grepped1!

  1 passing (4ms)

grep3 works

mocha --delay -f grep3

  Sync Mocha
    Will it grep3?
      ✓ it grepped3!

  1 passing (4ms)

grep2 does not work

mocha --delay -f grep2


  0 passing (1ms)

However grep2 works if I specify the file:

mocha --delay test/mi2.js -f grep2


  Async Mocha
    Will it grep2?
      ✓ it grepped2!


  1 passing (5ms)

Expected behavior: grep to work consistantly

Actual behavior: grep fail to match SOME tests, but not all

Reproduces how often: always for certain files

Versions

mocha 3.5.3 node v8.5.0

Additional Information

plasticrake avatar Sep 18 '17 20:09 plasticrake