Common CLI Commands

The following command can be used when the @sudoo/triforce package is installed, and the setup process done.

See Setup Testing and Linting for setup procedure.


The easiest way to use testing and linting feature is a makefile config. The following command is what package created by Sudoo normally use, a explanation is provided in this document.

mocha := node_modules/.bin/mocha
eslint := node_modules/.bin/eslint

	@echo "[INFO] Testing with Mocha"
	@NODE_ENV=test \
    	$(mocha) --config test/.mocharc.json

	@echo "[INFO] Testing with Nyc and Mocha"
	@NODE_ENV=test \
	nyc $(mocha) --config test/.mocharc.json

	@echo "[INFO] Linting"
	@NODE_ENV=production \
    	$(eslint) \
    	. --ext .ts,.tsx --config ./typescript/.eslintrc.json

	@echo "[INFO] Linting and Fixing"
    	@NODE_ENV=development \
	$(eslint) \
    	. --ext .ts,.tsx --config ./typescript/.eslintrc.json --fix


@sudoo/triforce recommend Mocha library for testing.

Run the following code to start testing

NODE_ENV=test \
node_modules/.bin/mocha \
--config test/.mocharc.json

replace the location of test/.mocharc.json to the .mocharc file you created before.

nyc is a coverage collection package work perfectly with @sudoo/triforce. Install nyc by run.

yarn global add nyc
# Or
npm install nyc -g

To use it, add the following configuration in your package.json.

    "...": {},
    "nyc": {
    "extension": [
    "include": [
    "instrument": true,
    "reporter": [
    "report-dir": "coverage",
    "sourceMap": true
  "...": {}

And run the following command to start a test with coverage.

NODE_ENV=test \
nyc \
node_modules/.bin/mocha \
--config test/.mocharc.json