diff --git a/0001-Fix-flaky-tests.patch b/0001-Fix-flaky-tests.patch new file mode 100644 index 0000000..cfb29cf --- /dev/null +++ b/0001-Fix-flaky-tests.patch @@ -0,0 +1,66 @@ +From 4a83d6ed61f212fdf84a7de70e5bf8ef18779b07 Mon Sep 17 00:00:00 2001 +From: Denis Bardadym +Date: Fri, 10 Jun 2016 13:59:33 +0300 +Subject: [PATCH] Fix flaky tests + +--- + test/ext/match.test.js | 8 ++++---- + test/ext/property.test.js | 6 +++--- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/test/ext/match.test.js b/test/ext/match.test.js +index 537be32632a716bfbbfea63b31c608ad22878eee..81417de5dc49eb99b53613f8a022eea31daecddf 100644 +--- a/test/ext/match.test.js ++++ b/test/ext/match.test.js +@@ -119,21 +119,21 @@ describe('match', function() { + d.should.not.match(ds); + ds.should.not.match(d); + + err(function() { + ({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should +- .match({ a: 11, b: /c$/, c: function(it) { ++ .match({ a: 11, b: /c$/, c: function c(it) { + return it.should.have.property('d', 10); + }}); +- }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } to match Object { a: 11, b: /c$/, c: Function { name: '' } }\n not matched properties: a (10)\n matched properties: b, c"); ++ }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } to match Object { a: 11, b: /c$/, c: Function { name: 'c' } }\n not matched properties: a (10)\n matched properties: b, c"); + + err(function() { + ({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should.not +- .match({ a: 10, b: /c$/, c: function(it) { ++ .match({ a: 10, b: /c$/, c: function c(it) { + return it.should.have.property('d', 10); + }}); +- }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } not to match Object { a: 10, b: /c$/, c: Function { name: '' } }\n matched properties: a, b, c (false negative fail)"); ++ }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } not to match Object { a: 10, b: /c$/, c: Function { name: 'c' } }\n matched properties: a, b, c (false negative fail)"); + }); + + it('test each property match(function)', function() { + [10, 11, 12].should.matchEach(function(it) { + return it >= 10; +diff --git a/test/ext/property.test.js b/test/ext/property.test.js +index 4695882eccb1e5b9e3ab53787383e02f5949ddfa..8aa17b885803b7d86674bd28b9c178c93abe509c 100644 +--- a/test/ext/property.test.js ++++ b/test/ext/property.test.js +@@ -49,15 +49,15 @@ describe('property', function() { + err(function() { + 'asd'.should.not.have.property('length', 3); + }, "expected 'asd' not to have property length of 3 (false negative fail)"); + + err(function() { +- var obj = { f: function() {} }; +- var f1 = function() {}; ++ var obj = { f: function f() {} }; ++ var f1 = function f1() {}; + f1.a = 1; + obj.should.have.property('f', f1); +- }, "expected Object { f: Function { name: '' } } to have property f of Function { a: 1, name: '' } (got Function { name: '' })"); ++ }, "expected Object { f: Function { name: 'f' } } to have property f of Function { a: 1, name: 'f1' } (got Function { name: 'f' })"); + + err(function() { + ({a: {b: 1}}).should.have.property('a') + .and.have.property('b', 100); + }, "expected Object { b: 1 } to have property b of 100 (got 1)"); +-- +2.9.3 + diff --git a/nodejs-should.spec b/nodejs-should.spec new file mode 100644 index 0000000..e499ff8 --- /dev/null +++ b/nodejs-should.spec @@ -0,0 +1,60 @@ +%{?nodejs_find_provides_and_requires} +%global enable_tests 1 +Name: nodejs-should +Version: 8.4.0 +Release: 1 +Summary: A test framework agnostic BDD-style assertions for Node.js +License: MIT +URL: https://github.com/shouldjs/should.js +Source0: https://registry.npmjs.org/should/-/should-%{version}.tgz +#git clone git://github.com/shouldjs/should.js.git +#cd should.js +#git archive --prefix="test/" --format=tar tags/%{version}:test/ | bzip2 > tests-%{version}.tar.bz2 +Source1: tests-%{version}.tar.bz2 +Obsoletes: nodejs-should-promised < 0.3.1-2 +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(mocha) npm(bluebird) npm(should-equal) npm(should-format) npm(should-type) +%endif +Patch0001: 0001-Fix-flaky-tests.patch +%description +should is an expressive, readable, test framework agnostic, behavior-driven +development (BDD)-style assertion library for Node.js. +It extends the Object prototype with a single non-enumerable getter that +allows you to express how that object should behave. +should literally extends Node's assert module. For example, +should.equal(str, 'foo') will work, just as assert.equal(str, 'foo') would, +and should.AssertionError is assert.AssertionError, meaning any test framework +supporting this constructor will function properly with should. + +%prep +%setup -q -n package +%setup -q -T -D -a 1 -n package +%patch0001 -p1 +rm -f should.min.js +find . -type f -exec chmod -x '{}' \; + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/should +cp -pr package.json index.js lib/ should.js \ + %{buildroot}%{nodejs_sitelib}/should +%nodejs_symlink_deps +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +%{nodejs_sitelib}/mocha/bin/mocha --ui exports test/**/*.test.js +%endif + +%files +%doc Readme.md History.md CONTRIBUTING.md +%license LICENSE +%{nodejs_sitelib}/should + +%changelog +* Thu Aug 20 2020 wangyue - 8.4.0-1 +- package init diff --git a/nodejs-should.yaml b/nodejs-should.yaml new file mode 100644 index 0000000..48c8fc1 --- /dev/null +++ b/nodejs-should.yaml @@ -0,0 +1,5 @@ +git_url: https://github.com/shouldjs/should.js +version_control: github +src_repo: shouldjs/should.js +tag_prefix: "^" +seperator: "." diff --git a/should-8.4.0.tgz b/should-8.4.0.tgz new file mode 100644 index 0000000..ee25a0f Binary files /dev/null and b/should-8.4.0.tgz differ diff --git a/tests-8.4.0.tar.bz2 b/tests-8.4.0.tar.bz2 new file mode 100644 index 0000000..a567f1b Binary files /dev/null and b/tests-8.4.0.tar.bz2 differ