From 7e8dd9647f5259012a492fcd6c23c73329877872 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 13 Apr 2018 10:49:02 -0700 Subject: [PATCH] Add testing section to README --- README.md | 9 +++++++++ gulpfile.js | 6 +++--- package.json | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 26f98382..0355e682 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,15 @@ Then open http://127.0.0.1:3000 in a web browser to access the demo. *Note: Do not use ConEmu, as it seems to break the demo for some reason.* +## Testing + +Tests are run using the following npm scripts: + +- `npm test`: This will run both unit tests and the linter +- `npm run test-suite `: This will run all tests within a particular file, <file> is the test file name excluding the extension (eg. "Linkifier.test") +- `npm run test-debug`: This will run unit tests with `--inspect-brk`, this can then be automatically debugged using [VS Code auto attach](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_auto-attach-feature) or manually attached to by a debugger +- `npm run lint`: This will run the linter only + ## Releases Xterm.js follows a monthly release cycle roughly. diff --git a/gulpfile.js b/gulpfile.js index f3a23e80..e701ef39 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -163,10 +163,10 @@ gulp.task('mocha-coverage', ['instrument-test'], function () { }); /** - * Run single test file by file name(without file extension). Example of the command: - * gulp mocha-test --test InputHandler.test + * Run single test suite (file) by file name (without file extension). Example of the command: + * gulp mocha-suite --test InputHandler.test */ -gulp.task('mocha-test', [], function () { +gulp.task('mocha-suite', [], function () { let testName = util.env.test; util.log("Run test by Name: " + testName); return gulp.src([`${outDir}/${testName}.js`, `${outDir}/**/${testName}.js`], {read: false}) diff --git a/package.json b/package.json index bfcb0e26..3b802689 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "lint": "tslint src/*.ts src/**/*.ts", "test": "npm-run-all mocha lint", "test-debug": "node --inspect-brk node_modules/.bin/gulp test", + "test-suite": "gulp mocha-suite --test", "mocha": "gulp test", "build:docs": "jsdoc -c jsdoc.json", "tsc": "tsc",