From 2083189e7c89f4efcfaa9202d61d7916db92db3d Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Tue, 26 Feb 2019 10:06:51 -0500 Subject: [PATCH 1/4] Make npm test run tests --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eae77f7..26dda89 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "watch": "tsc -watch", "lint": "tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts' 'typings/**/*.d.ts'", "prepublish": "npm run clean && npm run compile", - "test": "npm run compile && npm run lint && atom --test build/test" + "test": "npm run compile && npm run lint && atom --test test" }, "dependencies": { "fuzzaldrin-plus": "^0.6.0", From 1ef86e9c78e6f2a4b8f70d714acf1be14cbcca17 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Tue, 26 Feb 2019 10:43:48 -0500 Subject: [PATCH 2/4] Look for correct test folder in cibuild --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index f22441a..89d3520 100644 --- a/script/cibuild +++ b/script/cibuild @@ -103,4 +103,4 @@ echo "Running lint..." npm run lint echo "Running specs..." -"$ATOM_SCRIPT_PATH" --test build/test +"$ATOM_SCRIPT_PATH" --test test From 294afee58e5b07cabc64c3f1aea8eac42a4f75b5 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Tue, 26 Feb 2019 12:40:56 -0500 Subject: [PATCH 3/4] Use npm test, not atom --test --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 89d3520..5694b41 100644 --- a/script/cibuild +++ b/script/cibuild @@ -103,4 +103,4 @@ echo "Running lint..." npm run lint echo "Running specs..." -"$ATOM_SCRIPT_PATH" --test test +npm test From 2d3813ba874ba9596e78ba1507802d63ff8c9c64 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Tue, 26 Feb 2019 13:38:42 -0500 Subject: [PATCH 4/4] Use updated test runner --- package.json | 4 +++- script/cibuild | 2 +- test/runner.js | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/runner.js diff --git a/package.json b/package.json index 26dda89..cc39d2e 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,9 @@ "watch": "tsc -watch", "lint": "tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts' 'typings/**/*.d.ts'", "prepublish": "npm run clean && npm run compile", - "test": "npm run compile && npm run lint && atom --test test" + "test": "npm run compile && npm run lint && atom --test build/test" }, + "atomTestRunner": "./test/runner", "dependencies": { "fuzzaldrin-plus": "^0.6.0", "vscode-jsonrpc": "4.0.0", @@ -21,6 +22,7 @@ "vscode-languageserver-types": "3.12.0" }, "devDependencies": { + "@smashwilson/atom-mocha-test-runner": "^1.4.0", "@types/atom": "^1.31.0", "@types/chai": "^4.1.7", "@types/fuzzaldrin-plus": "0.6.0", diff --git a/script/cibuild b/script/cibuild index 5694b41..f22441a 100644 --- a/script/cibuild +++ b/script/cibuild @@ -103,4 +103,4 @@ echo "Running lint..." npm run lint echo "Running specs..." -npm test +"$ATOM_SCRIPT_PATH" --test build/test diff --git a/test/runner.js b/test/runner.js new file mode 100644 index 0000000..c23b88b --- /dev/null +++ b/test/runner.js @@ -0,0 +1,14 @@ +const { TestRunnerParams } = require("atom"); +const { createRunner } = require('@smashwilson/atom-mocha-test-runner'); + +module.exports = createRunner({ + htmlTitle: `atom-languageclient Tests - pid ${process.pid}`, + reporter: process.env.MOCHA_REPORTER || 'list', + }, + (mocha) => { + mocha.timeout(parseInt(process.env.MOCHA_TIMEOUT || '5000', 10)); + if (process.env.APPVEYOR_API_URL) { + mocha.reporter(require('mocha-appveyor-reporter')); + } + }, +);