☕️ Classic, reliable, trusted test framework for Node.js and the browser
fixup no-diff tests to use expect.js for #2536
Christopher Hiller575d83d76b97
diff --git a/lib/reporters/base.js b/lib/reporters/base.jsindex 94339f34..d5425c8a 100644--- a/lib/reporters/base.js+++ b/lib/reporters/base.js@@ -208,11 +208,8 @@ exports.list = function (failures) {if (err.uncaught) {msg = 'Uncaught ' + msg;}-// explicitly show diff- if (exports.hideDiff !== true && err.showDiff !== false && sameType(actual, expected) && expected !== undefined) {- escape = false;- if (showDiff(err)) {+ if (!exports.hideDiff && showDiff(err)) {stringifyDiffObjs(err);fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');var match = message.match(/^([^:]+): expected/);diff --git a/test/integration/no-diff.spec.js b/test/integration/no-diff.spec.jsindex 5766abce..10bb53c2 100644--- a/test/integration/no-diff.spec.js+++ b/test/integration/no-diff.spec.js@@ -4,11 +4,31 @@ var helpers = require('./helpers');var run = helpers.runMocha;describe('no-diff', function () {- it('should be honoured', function (done) {- run('no-diff.fixture.js', ['--no-diff'], function (err, res) {- res.output.should.not.match(/\+ expected/);- res.output.should.not.match(/- actual/);- done(err);+ describe('when enabled', function () {+ it('should not display a diff', function (done) {+ run('no-diff.fixture.js', ['--no-diff'], function (err, res) {+ if (err) {+ done(err);+ return;+ }+ expect(res.output).not.to.match(/\+ expected/);+ expect(res.output).not.to.match(/- actual/);+ done();+ });+ });+ });++ describe('when disabled', function () {+ it('should display a diff', function (done) {+ run('no-diff.fixture.js', ['--diff'], function (err, res) {+ if (err) {+ done(err);+ return;+ }+ expect(res.output).to.match(/\+ expected/);+ expect(res.output).to.match(/- actual/);+ done();+ });});});});diff --git a/test/reporters/base.spec.js b/test/reporters/base.spec.jsindex e9118186..087aa74f 100644--- a/test/reporters/base.spec.js+++ b/test/reporters/base.spec.js@@ -108,8 +108,8 @@ describe('Base reporter', function () {Base.hideDiff = false; // Revert to original valueerrOut = stdout.join('\n');- errOut.should.not.match(/\- actual/);- errOut.should.not.match(/\+ expected/);+ expect(errOut).to.not.match(/- actual/);+ expect(errOut).to.not.match(/\+ expected/);});});