Skip to content

Commit b6e3500

Browse files
committed
When running tests make sure to build the grammar builder
Also add task to accept baselines
1 parent c4036f9 commit b6e3500

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ npm install # Installs dependencies required for building
3030
cd ../tests
3131
npm install # Installs dependencies required for testing
3232
npm test # Compiles & runs tests
33-
```
33+
34+
npm run diff # Diffs the test baselines with generated one using tool set in environment variable DIFF
35+
npm run accept # Accepts the test baselines
36+
```

tests/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
"description": "",
66
"main": "test.ts",
77
"scripts": {
8-
"pretest": "node ../build/build.js && tsc",
9-
"test": "mocha --full-trace test.js"
8+
"pretest": "tsc -p ../build && node ../build/build.js && tsc",
9+
"test": "mocha --full-trace test.js",
10+
"diff": "cross-env-shell $DIFF baselines generated",
11+
"accept": "cpx generated/* baselines"
1012
},
1113
"dependencies": {
1214
"@types/chai": "latest",
@@ -16,5 +18,9 @@
1618
"mocha": "latest",
1719
"typescript": "latest",
1820
"vscode-textmate": "latest"
21+
},
22+
"devDependencies": {
23+
"cpx": "^1.5.0",
24+
"cross-env": "^5.1.1"
1925
}
2026
}

tests/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ function assertBaselinesMatch(file: string, generatedText: string) {
5555
if (fs.existsSync(baselineFile)) {
5656
chai.assert.equal(generatedText, fs.readFileSync(baselineFile, 'utf8'), "Expected baselines to match: " + file);
5757
} else {
58-
fs.writeFileSync(baselineFile, generatedText) ;
5958
chai.assert(false, "New generated baseline");
6059
}
6160
}

0 commit comments

Comments
 (0)