Standalone watch mode for mocha.

Package has been renamed to imocha
Last updated 2 years ago by gustavnikolaj .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @gustavnikolaj/mocha-watch 
SYNC missed versions from official npm registry.


npm version Build Status Coverage Status

In development - work in progress!

Run tests associated to changed files (based on git status).

$ npm install --save-dev @gustavnikolaj/mocha-watch


$ yarn add -D @gustavnikolaj/mocha-watch

Run the tests related to the changed files:

$ mocha-watch


When the cli is started, it will map out the test files and each of the source files that they depend on - this is done through the SourceGraph class.

Then it looks at the dirty files (determined by running git status) and checks which of the test files would be relevant to run based on which files has been changed.

The tests are being run by mocha itself - a process is forked off from which mocha is loaded. This happens on every single run to make sure that there is no pollution between test runs. This is the responsibility of the MochaWorker class.

The orchestration of the above, and the watching of files are handled within the MochaWatch class.

Known limitations

Dynamic imports

With require it is possible to do dynamic imports. This tool only supports dependencies that are statically analyzable.

// This will not work...

const pathToModule = "../myModule";

Current Tags

  • 0.0.2                                ...           latest (2 years ago)

2 Versions

  • 0.0.2 [deprecated]           ...           2 years ago
  • 0.0.1 [deprecated]           ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (9)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |