Skip to content

🐛 Bug: --delay and grep not working reliably #3007

Open
@plasticrake

Description

@plasticrake

Prerequisites

  • Checked that your issue isn't already filed by cross referencing issues with the common mistake label
  • 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.
  • '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
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    semver-majorimplementation requires increase of "major" version number; "breaking changes"status: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions