Skip to content

Instantly share code, notes, and snippets.

@oktavianidewi
Created May 23, 2018 03:22
Show Gist options
  • Select an option

  • Save oktavianidewi/60aeb8f61f4abbe51df7dec811fd8994 to your computer and use it in GitHub Desktop.

Select an option

Save oktavianidewi/60aeb8f61f4abbe51df7dec811fd8994 to your computer and use it in GitHub Desktop.
how to test only a subdirectory using mocha and chai in node

open your package.json file, change the test under the script key:

"scripts": {
    "clean": "rm -rf ./lib",
    "build": "tsc",
    "test": "NODE_ENV=test mocha --require ts-node/register 'test/repos/bot/*.ts' --bail --exit",

the previous test routed to test/**/*.ts directory, then I changed it into its subdirectory test/repos/bot/*.ts. you can write npm test command, and only test file under test/repo/bot is tested.

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