intern

How to use Internjs in watch mode


I'm setting up my test environment and I want to use Internjs to peform my unit tests. I'm using typescript and when I type npx intern my tests are executed correctly. But I can't configure Internjs in watch mode and the doc's didn't gave any help. Someone can help me to configure Intern to run the unit tests when any change in my files are made?


Solution

  • There isn't currently a built-in watch mode in Intern.

    You can implement a custom watcher using chokidar (install chokidar-cli for the command line tool). Run tsc --watch to rebuild your code as necessary, and use chokidar to watch for changes and re-run intern:

    $ chokidar '**/*.js' -c 'npx intern' -d 1000