Skip to content

Commit 218d021

Browse files
Run tests in VS Code
This change runs unit tests inside of VS Code, making it possible to set breakpoints and debug test, and to let tests access VS Code services. In addition, the syntax tests are split out into a separate "npm run test-syntax" script that runs using Mocha at the command-line. The reason for this is because the onigurama package used by those tests is native-compiled, and the compiled binary does not necessarily like running in VS Code 32-bit on Windows. Ultimately, the syntax tests will be moving into their own repo, so this is just a temporary measure.
1 parent 81f3869 commit 218d021

File tree

10 files changed

+11
-5
lines changed

10 files changed

+11
-5
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@ node_js:
44
- "6"
55

66
env:
7-
- CXX=g++-4.8
7+
- CXX=g++-4.9
88

99
addons:
1010
apt:
1111
sources:
1212
- ubuntu-toolchain-r-test
1313
packages:
14-
- g++-4.8
14+
- g++-4.9
1515

1616
install:
1717
- npm install
18+
- npm run vscode:prepublish
1819
- npm run compile
1920
- npm install -g vsce
2021
- vsce package
2122

23+
script:
24+
- npm test --silent
25+
- npm run test-syntax
26+
2227
deploy:
2328
provider: releases
2429
api_key:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"vscode:prepublish": "tsc -p ./",
2323
"compile": "tsc -p ./ && gulp tslint",
2424
"watch": "tsc -watch -p ./",
25-
"test": "mocha --timeout 15000 -u tdd ./out/test/*.test.js ./out/test/**/*.test.js",
25+
"test": "node ./node_modules/vscode/bin/test",
26+
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
2627
"postinstall": "node ./node_modules/vscode/bin/install"
2728
},
2829
"dependencies": {

test/common.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { should } from 'chai';
77
import { buildPromiseChain } from '../src/common';
88

99
suite("Common", () => {
10-
before(() => should);
10+
suiteSetup(() => should());
1111

1212
test("buildPromiseChain produces a sequence of promises", () => {
1313
let array: number[] = [];

test/platform.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { should } from 'chai';
77
import { LinuxDistribution, PlatformInformation } from '../src/platform';
88

99
suite("Platform", () => {
10-
before(() => should());
10+
suiteSetup(() => should());
1111

1212
test("Retrieve correct information for Ubuntu 14.04", () => {
1313
const dist = distro_ubuntu_14_04();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)