diff --git a/README.md b/README.md index 180779a..d03888e 100644 --- a/README.md +++ b/README.md @@ -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 +``` \ No newline at end of file diff --git a/tests/package.json b/tests/package.json index 00953a1..12a0cbe 100644 --- a/tests/package.json +++ b/tests/package.json @@ -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" } } diff --git a/tests/test.ts b/tests/test.ts index c0c4c96..3c76fdf 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -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"); } } \ No newline at end of file