Skip to content

Mocha 7.0.1 quits watching when all tests file are removed #4169

Open

Description

Prerequisites

  • [x ] Checked that your issue hasn't already been filed by cross-referencing issues with the faq 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 that you not install Mocha globally.

Description

Mocha 7 quits watching process when the test folder is deleted

Steps to Reproduce

  1. Install mocha 7.0.1 npm i mocha@7.0.1 -D
  2. Create a simple test file in "test" folder
  3. Start mocha in watching mode: ./node_modules/.bin/mocha --watch
  4. In another terminal window, remove "test" folder: rm -r test

test.js file:

describe("test",() => {
  it('logs', ()=>{console.log(1)})
})

Expected behavior: [What you expect to happen]
Mocha continues to watching newly added files if any, mocha doesn't quit the process.

Actual behavior: [What actually happens]

Mocha 7 quits with error message: "Error: No test files found: "test""
This is not an issue in mocha@6.

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 7.0.1
  • The output of node --version: v13.3.0
  • Your operating system
    • name and version: macOS 10.13.6 (17G5019)
    • architecture (32 or 64-bit): 64
  • Your shell (e.g., bash, zsh, PowerShell, cmd): bash
  • Your browser and version (if running browser tests): none
  • Any third-party Mocha-related modules (and their versions): none
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): none

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area: node.jscommand-line-or-Node.js-specificsemver-minorimplementation requires increase of "minor" version number; "features"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