test: show diff when test:bin fails

This commit is contained in:
Nils Knappmeier
2020-01-01 21:21:24 +01:00
committed by Nils Knappmeier
parent d03b6ecfc4
commit d337f40d0e
3 changed files with 27 additions and 6 deletions
+17
View File
@@ -1394,6 +1394,23 @@
"type-detect": "^4.0.5" "type-detect": "^4.0.5"
} }
}, },
"chai-diff": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/chai-diff/-/chai-diff-1.0.1.tgz",
"integrity": "sha1-bGaJRwDYDNkDUKtORANiXU9TocE=",
"dev": true,
"requires": {
"diff": "^2.2.1"
},
"dependencies": {
"diff": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz",
"integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=",
"dev": true
}
}
},
"chalk": { "chalk": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+2 -1
View File
@@ -35,6 +35,7 @@
"babel-runtime": "^5.1.10", "babel-runtime": "^5.1.10",
"benchmark": "~1.0", "benchmark": "~1.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-diff": "^1.0.1",
"concurrently": "^5.0.0", "concurrently": "^5.0.0",
"dirty-chai": "^2.0.1", "dirty-chai": "^2.0.1",
"dtslint": "^0.5.5", "dtslint": "^0.5.5",
@@ -84,7 +85,7 @@
"scripts": { "scripts": {
"format": "prettier --write '**/*.js' && eslint --fix .", "format": "prettier --write '**/*.js' && eslint --fix .",
"check-format": "prettier --check '**/*.js'", "check-format": "prettier --check '**/*.js'",
"lint": "eslint --max-warnings 0 . ", "lint": "eslint --max-warnings 0 .",
"dtslint": "dtslint types", "dtslint": "dtslint types",
"test": "grunt", "test": "grunt",
"extensive-tests-and-publish-to-aws": "npx mocha tasks/task-tests/ && grunt --stack extensive-tests-and-publish-to-aws", "extensive-tests-and-publish-to-aws": "npx mocha tasks/task-tests/ && grunt --stack extensive-tests-and-publish-to-aws",
+8 -5
View File
@@ -1,7 +1,10 @@
const childProcess = require('child_process'), const childProcess = require('child_process');
fs = require('fs'), const fs = require('fs');
os = require('os'), const os = require('os');
expect = require('chai').expect;
const chai = require('chai');
chai.use(require('chai-diff'));
const expect = chai.expect;
module.exports = function(grunt) { module.exports = function(grunt) {
grunt.registerTask('test:bin', function() { grunt.registerTask('test:bin', function() {
@@ -18,7 +21,7 @@ module.exports = function(grunt) {
const normalizedOutput = normalizeCrlf(stdout); const normalizedOutput = normalizeCrlf(stdout);
const normalizedExpectedOutput = normalizeCrlf(expectedOutput); const normalizedExpectedOutput = normalizeCrlf(expectedOutput);
expect(normalizedOutput).to.equal(normalizedExpectedOutput); expect(normalizedOutput).not.to.be.differentFrom(normalizedExpectedOutput);
}); });
}; };