Projects
openEuler:24.03:SP1:Everything
nodejs-chai
_service:tar_scm:fix-tests-on-nodejs65.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:fix-tests-on-nodejs65.patch of Package nodejs-chai
From 3c811c45d6f12c45ed02ec05e2798f940f2e82a6 Mon Sep 17 00:00:00 2001 From: Grant Snodgrass <meeber@gametypething.com> Date: Sun, 4 Sep 2016 05:55:16 -0400 Subject: [PATCH] Fix broken tests when using Node v6.5 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com> --- test/expect.js | 42 +++++++++++++++++++++++------------------- test/should.js | 50 +++++++++++++++++++++++++++----------------------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/test/expect.js b/test/expect.js index 79068e444cbf9b3b82cb08ec975d0f17a256695f..bacd451680fa0e4da141ac362848f7d6789dff52 100644 --- a/test/expect.js +++ b/test/expect.js @@ -918,79 +918,83 @@ describe('expect', function () { expect(badFn).to.throw(Error, /testing/); expect(badFn).to.throw(Error, 'testing'); err(function(){ expect(goodFn).to.throw(); - }, "expected [Function] to throw an error"); + }, /^expected \[Function(: goodFn)*\] to throw an error$/); err(function(){ expect(goodFn).to.throw(ReferenceError); - }, "expected [Function] to throw ReferenceError"); + }, /^expected \[Function(: goodFn)*\] to throw ReferenceError$/); err(function(){ expect(goodFn).to.throw(specificError); - }, "expected [Function] to throw 'RangeError: boo'"); + }, /^expected \[Function(: goodFn)*\] to throw 'RangeError: boo'$/); err(function(){ expect(badFn).to.not.throw(); - }, "expected [Function] to not throw an error but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to not throw an error but 'Error: testing' was thrown$/); err(function(){ expect(badFn).to.throw(ReferenceError); - }, "expected [Function] to throw 'ReferenceError' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to throw 'ReferenceError' but 'Error: testing' was thrown$/); err(function(){ expect(badFn).to.throw(specificError); - }, "expected [Function] to throw 'RangeError: boo' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to throw 'RangeError: boo' but 'Error: testing' was thrown$/); err(function(){ expect(badFn).to.not.throw(Error); - }, "expected [Function] to not throw 'Error' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to not throw 'Error' but 'Error: testing' was thrown$/); err(function(){ expect(refErrFn).to.not.throw(ReferenceError); - }, "expected [Function] to not throw 'ReferenceError' but 'ReferenceError: hello' was thrown"); + }, /^expected \[Function(: refErrFn)*\] to not throw 'ReferenceError' but 'ReferenceError: hello' was thrown$/); err(function(){ expect(badFn).to.throw(PoorlyConstructedError); - }, "expected [Function] to throw 'PoorlyConstructedError' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to throw 'PoorlyConstructedError' but 'Error: testing' was thrown$/); err(function(){ expect(ickyErrFn).to.not.throw(PoorlyConstructedError); - }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + }, /^(expected \[Function(: ickyErrFn)*\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(function(){ expect(ickyErrFn).to.throw(ReferenceError); - }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + }, /^(expected \[Function(: ickyErrFn)*\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(function(){ expect(specificErrFn).to.throw(new ReferenceError('eek')); - }, "expected [Function] to throw 'ReferenceError: eek' but 'RangeError: boo' was thrown"); + }, /^expected \[Function(: specificErrFn)*\] to throw 'ReferenceError: eek' but 'RangeError: boo' was thrown$/); err(function(){ expect(specificErrFn).to.not.throw(specificError); - }, "expected [Function] to not throw 'RangeError: boo'"); + }, /^expected \[Function(: specificErrFn)*\] to not throw 'RangeError: boo'$/); err(function (){ expect(badFn).to.not.throw(/testing/); - }, "expected [Function] to throw error not matching /testing/"); + }, /^expected \[Function(: badFn)*\] to throw error not matching \/testing\/$/); err(function () { expect(badFn).to.throw(/hello/); - }, "expected [Function] to throw error matching /hello/ but got 'testing'"); + }, /^expected \[Function(: badFn)*\] to throw error matching \/hello\/ but got 'testing'$/); err(function () { expect(badFn).to.throw(Error, /hello/, 'blah'); - }, "blah: expected [Function] to throw error matching /hello/ but got 'testing'"); + }, /^blah: expected \[Function(: badFn)*\] to throw error matching \/hello\/ but got 'testing'$/); err(function () { expect(badFn).to.throw(Error, 'hello', 'blah'); - }, "blah: expected [Function] to throw error including 'hello' but got 'testing'"); + }, /^blah: expected \[Function(: badFn)*\] to throw error including 'hello' but got 'testing'$/); err(function () { (customErrFn).should.not.throw(); - }, "expected [Function] to not throw an error but 'CustomError: foo' was thrown"); + }, /^expected \[Function(: customErrFn)*\] to not throw an error but 'CustomError: foo' was thrown$/); + + err(function(){ + expect(badFn).to.not.throw(Error, 'testing'); + }, /^expected \[Function(: badFn)*\] to not throw 'Error' but 'Error: testing' was thrown$/); }); it('respondTo', function(){ function Foo(){}; Foo.prototype.bar = function(){}; @@ -1022,11 +1026,11 @@ describe('expect', function () { expect(1).to.satisfy(matcher); err(function(){ expect(2).to.satisfy(matcher, 'blah'); - }, "blah: expected 2 to satisfy [Function]"); + }, /^blah: expected 2 to satisfy \[Function(: matcher)*\]$/); }); it('closeTo', function(){ expect(1.5).to.be.closeTo(1.0, 0.5); expect(10).to.be.closeTo(20, 20); diff --git a/test/should.js b/test/should.js index 0fde10b9dad878abdd9f6743f11b01b5f2c5013c..54cbd85deeb47d38105d6522da7cee5026d97784 100644 --- a/test/should.js +++ b/test/should.js @@ -744,95 +744,99 @@ describe('should', function() { should.throw(badFn, Error, /testing/); should.throw(badFn, Error, 'testing'); err(function(){ (goodFn).should.throw(); - }, "expected [Function] to throw an error"); + }, /^expected \[Function(: goodFn)*\] to throw an error$/); err(function(){ (goodFn).should.throw(ReferenceError); - }, "expected [Function] to throw ReferenceError"); + }, /^expected \[Function(: goodFn)*\] to throw ReferenceError$/); err(function(){ (goodFn).should.throw(specificError); - }, "expected [Function] to throw 'RangeError: boo'"); + }, /^expected \[Function(: goodFn)*\] to throw 'RangeError: boo'$/); err(function(){ (badFn).should.not.throw(); - }, "expected [Function] to not throw an error but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to not throw an error but 'Error: testing' was thrown$/); err(function(){ (badFn).should.throw(ReferenceError); - }, "expected [Function] to throw 'ReferenceError' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to throw 'ReferenceError' but 'Error: testing' was thrown$/); err(function(){ (badFn).should.throw(specificError); - }, "expected [Function] to throw 'RangeError: boo' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to throw 'RangeError: boo' but 'Error: testing' was thrown$/); err(function(){ (badFn).should.not.throw(Error); - }, "expected [Function] to not throw 'Error' but 'Error: testing' was thrown"); + }, /^expected \[Function(: badFn)*\] to not throw 'Error' but 'Error: testing' was thrown$/); err(function(){ (stringErrFn).should.not.throw(); - }, "expected [Function] to not throw an error but 'testing' was thrown"); + }, /^expected \[Function(: stringErrFn)*\] to not throw an error but 'testing' was thrown$/); err(function(){ (stringErrFn).should.throw(ReferenceError); - }, "expected [Function] to throw 'ReferenceError' but 'testing' was thrown"); + }, /^expected \[Function(: stringErrFn)*\] to throw 'ReferenceError' but 'testing' was thrown$/); err(function(){ (stringErrFn).should.throw(specificError); - }, "expected [Function] to throw 'RangeError: boo' but 'testing' was thrown"); + }, /^expected \[Function(: stringErrFn)*\] to throw 'RangeError: boo' but 'testing' was thrown$/); err(function(){ (stringErrFn).should.not.throw('testing'); - }, "expected [Function] to throw error not including 'testing'"); + }, /^expected \[Function(: stringErrFn)*\] to throw error not including 'testing'$/); err(function(){ (refErrFn).should.not.throw(ReferenceError); - }, "expected [Function] to not throw 'ReferenceError' but 'ReferenceError: hello' was thrown"); + }, /^expected \[Function(: refErrFn)*\] to not throw 'ReferenceError' but 'ReferenceError: hello' was thrown$/); err(function(){ (badFn).should.throw(PoorlyConstructedError); - }, "expected [Function] to throw 'PoorlyConstructedError' but 'Error: testing' was thrown") + }, /^expected \[Function(: badFn)*\] to throw 'PoorlyConstructedError' but 'Error: testing' was thrown$/); err(function(){ (ickyErrFn).should.not.throw(PoorlyConstructedError); - }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + }, /^(expected \[Function(: ickyErrFn)*\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(function(){ (ickyErrFn).should.throw(ReferenceError); - }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + }, /^(expected \[Function(: ickyErrFn)*\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(function(){ (specificErrFn).should.throw(new ReferenceError('eek')); - }, "expected [Function] to throw 'ReferenceError: eek' but 'RangeError: boo' was thrown"); + }, /^expected \[Function(: specificErrFn)*\] to throw 'ReferenceError: eek' but 'RangeError: boo' was thrown$/); err(function(){ (specificErrFn).should.not.throw(specificError); - }, "expected [Function] to not throw 'RangeError: boo'"); + }, /^expected \[Function(: specificErrFn)*\] to not throw 'RangeError: boo'$/); err(function (){ (badFn).should.not.throw(/testing/); - }, "expected [Function] to throw error not matching /testing/"); + }, /^expected \[Function(: badFn)*\] to throw error not matching \/testing\/$/); err(function () { (badFn).should.throw(/hello/); - }, "expected [Function] to throw error matching /hello/ but got \'testing\'"); + }, /^expected \[Function(: badFn)*\] to throw error matching \/hello\/ but got \'testing\'$/); err(function () { (badFn).should.throw(Error, /hello/, 'blah'); - }, "blah: expected [Function] to throw error matching /hello/ but got 'testing'"); + }, /^blah: expected \[Function(: badFn)*\] to throw error matching \/hello\/ but got 'testing'$/); err(function () { (badFn).should.throw(Error, 'hello', 'blah'); - }, "blah: expected [Function] to throw error including 'hello' but got 'testing'"); + }, /^blah: expected \[Function(: badFn)*\] to throw error including 'hello' but got 'testing'$/); err(function () { (customErrFn).should.not.throw(); - }, "expected [Function] to not throw an error but 'CustomError: foo' was thrown"); + }, /^expected \[Function(: customErrFn)*\] to not throw an error but 'CustomError: foo' was thrown$/); + + err(function(){ + (badFn).should.not.throw(Error, 'testing'); + }, /^expected \[Function(: badFn)*\] to not throw 'Error' but 'Error: testing' was thrown$/); }); it('respondTo', function(){ function Foo(){}; Foo.prototype.bar = function(){}; @@ -864,11 +868,11 @@ describe('should', function() { (1).should.satisfy(matcher); err(function(){ (2).should.satisfy(matcher, 'blah'); - }, "blah: expected 2 to satisfy [Function]"); + }, /^blah: expected 2 to satisfy \[Function(: matcher)*\]$/); }); it('closeTo', function(){ (1.5).should.be.closeTo(1.0, 0.5); -- 2.9.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2