diff --git a/fix-tests-on-nodejs65.patch b/fix-tests-on-nodejs65.patch new file mode 100644 index 0000000..c687d38 --- /dev/null +++ b/fix-tests-on-nodejs65.patch @@ -0,0 +1,272 @@ +From 3c811c45d6f12c45ed02ec05e2798f940f2e82a6 Mon Sep 17 00:00:00 2001 +From: Grant Snodgrass +Date: Sun, 4 Sep 2016 05:55:16 -0400 +Subject: [PATCH] Fix broken tests when using Node v6.5 + +Signed-off-by: Stephen Gallagher +--- + 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 + diff --git a/nodejs-chai-3.5.0.tar.gz b/nodejs-chai-3.5.0.tar.gz new file mode 100644 index 0000000..ca8cf00 Binary files /dev/null and b/nodejs-chai-3.5.0.tar.gz differ diff --git a/nodejs-chai.spec b/nodejs-chai.spec new file mode 100644 index 0000000..97f1d21 --- /dev/null +++ b/nodejs-chai.spec @@ -0,0 +1,39 @@ +Name: nodejs-chai +Version: 3.5.0 +Release: 1 +Summary: BDD/TDD assertion library for Node.js and the browser +License: MIT +URL: http://chaijs.com +Source0: https://github.com/chaijs/chai/archive/%{version}/nodejs-chai-%{version}.tar.gz +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging npm(mocha) npm(assertion-error) npm(deep-eql) +Patch0001: fix-tests-on-nodejs65.patch +%description +Chai is a BDD / TDD assertion library for node and the browser that +can be delightfully paired with any JavaScript testing framework. + +%prep +%setup -q -n chai-%{version} +%patch0001 -p1 +%nodejs_fixdep type-detect "^2.0.0" +rm -rf node_modules + +%build + +%install +mkdir -p %{buildroot}/%{nodejs_sitelib}/chai +cp -r package.json index.js chai.js lib %{buildroot}/%{nodejs_sitelib}/chai +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{nodejs_sitelib}/mocha/bin/mocha --require ./test/bootstrap --reporter dot --ui tdd test/*.js + +%files +%doc README.md CONTRIBUTING.md CODE_OF_CONDUCT.md History.md ReleaseNotes.md +%{nodejs_sitelib}/chai + +%changelog +* Mon Aug 17 2020 Shaoqiang Kang - 3.5.0-1 +- Package init diff --git a/nodejs-chai.yaml b/nodejs-chai.yaml new file mode 100644 index 0000000..0229a78 --- /dev/null +++ b/nodejs-chai.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: chaijs/chai +tag_prefix: "^" +seperator: "."