When running tests make sure to build the grammar builder

Also add task to accept baselines
This commit is contained in:
Sheetal Nandi 2017-11-03 12:38:56 -07:00
Родитель c4036f9df0
Коммит b6e350046e
3 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -30,4 +30,7 @@ npm install # Installs dependencies required for building
cd ../tests
npm install # Installs dependencies required for testing
npm test # Compiles & runs tests
```
npm run diff # Diffs the test baselines with generated one using tool set in environment variable DIFF
npm run accept # Accepts the test baselines
```

Просмотреть файл

@ -5,8 +5,10 @@
"description": "",
"main": "test.ts",
"scripts": {
"pretest": "node ../build/build.js && tsc",
"test": "mocha --full-trace test.js"
"pretest": "tsc -p ../build && node ../build/build.js && tsc",
"test": "mocha --full-trace test.js",
"diff": "cross-env-shell $DIFF baselines generated",
"accept": "cpx generated/* baselines"
},
"dependencies": {
"@types/chai": "latest",
@ -16,5 +18,9 @@
"mocha": "latest",
"typescript": "latest",
"vscode-textmate": "latest"
},
"devDependencies": {
"cpx": "^1.5.0",
"cross-env": "^5.1.1"
}
}

Просмотреть файл

@ -55,7 +55,6 @@ function assertBaselinesMatch(file: string, generatedText: string) {
if (fs.existsSync(baselineFile)) {
chai.assert.equal(generatedText, fs.readFileSync(baselineFile, 'utf8'), "Expected baselines to match: " + file);
} else {
fs.writeFileSync(baselineFile, generatedText) ;
chai.assert(false, "New generated baseline");
}
}