diff --git a/0.2.0.tar.gz b/0.2.0.tar.gz new file mode 100644 index 0000000..f5520a9 Binary files /dev/null and b/0.2.0.tar.gz differ diff --git a/0001-Update-expected-test-values.patch b/0001-Update-expected-test-values.patch new file mode 100644 index 0000000..6c71357 --- /dev/null +++ b/0001-Update-expected-test-values.patch @@ -0,0 +1,35 @@ +From 4530bd14e6cf7be1048a5dca98cf7611fd50263e Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Mon, 5 Dec 2016 15:55:34 -0500 +Subject: [PATCH] Update expected test values + +Signed-off-by: Stephen Gallagher +--- + test/expect.js | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/expect.js b/test/expect.js +index f89563d3624af0cd1daf071122c15fadfa2a5225..97628208fae8c53e8c37ad6250526e5f1e09f883 100644 +--- a/test/expect.js ++++ b/test/expect.js +@@ -147,15 +147,15 @@ describe('expect', function () { + expect(5).to.throwException(); + }, 'expected 5 to be a function'); + + err(function () { + expect(anonItThrows).not.to.throwException(); +- }, 'expected fn not to throw an exception'); ++ }, 'expected anonItThrows not to throw an exception'); + + err(function () { + expect(anonItWorks).to.throwException(); +- }, 'expected fn to throw an exception'); ++ }, 'expected anonItWorks to throw an exception'); + + if (nameSupported) { + err(function () { + expect(itWorks).to.throwException(); + }, 'expected itWorks to throw an exception'); +-- +2.9.3 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index dd31816..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# nodejs-expect-dot-js - -#### Description -Behavior-driven development (BDD) style assertions for Node.js and the browser - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 82d1697..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# nodejs-expect-dot-js - -#### 介绍 -Behavior-driven development (BDD) style assertions for Node.js and the browser - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/nodejs-expect-dot-js-0.2.0-Add-actual-expected-property-to-the-thrown-error.patch b/nodejs-expect-dot-js-0.2.0-Add-actual-expected-property-to-the-thrown-error.patch new file mode 100644 index 0000000..6701b7c --- /dev/null +++ b/nodejs-expect-dot-js-0.2.0-Add-actual-expected-property-to-the-thrown-error.patch @@ -0,0 +1,58 @@ +From bc56c15ecaad15a48de189bf9de80b4a59ae70c1 Mon Sep 17 00:00:00 2001 +From: Gavin Huang +Date: Tue, 25 Sep 2012 13:13:37 +0800 +Subject: [PATCH 06/13] Add 'actual' & 'expected' property to the thrown error + +--- + expect.js | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/expect.js b/expect.js +index ac14ea8..776fc8c 100644 +--- a/expect.js ++++ b/expect.js +@@ -91,12 +91,18 @@ + * @api private + */ + +- Assertion.prototype.assert = function (truth, msg, error) { ++ Assertion.prototype.assert = function (truth, msg, error, expected) { + var msg = this.flags.not ? error : msg +- , ok = this.flags.not ? !truth : truth; ++ , ok = this.flags.not ? !truth : truth ++ , err; + + if (!ok) { +- throw new Error(msg.call(this)); ++ err = new Error(msg.call(this)); ++ if (arguments.length > 3) { ++ err.actual = this.obj ++ err.expected = expected ++ } ++ throw err + } + + this.and = new Assertion(this.obj); +@@ -200,7 +206,8 @@ + this.assert( + obj === this.obj + , function(){ return 'expected ' + i(this.obj) + ' to equal ' + i(obj) } +- , function(){ return 'expected ' + i(this.obj) + ' to not equal ' + i(obj) }); ++ , function(){ return 'expected ' + i(this.obj) + ' to not equal ' + i(obj) } ++ , obj); + return this; + }; + +@@ -214,7 +221,8 @@ + this.assert( + expect.eql(obj, this.obj) + , function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) } +- , function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) }); ++ , function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) } ++ , obj); + return this; + }; + +-- +1.8.2.1 + diff --git a/nodejs-expect-dot-js-0.2.0-Pass-.fail-unit-test.patch b/nodejs-expect-dot-js-0.2.0-Pass-.fail-unit-test.patch new file mode 100644 index 0000000..8bdae08 --- /dev/null +++ b/nodejs-expect-dot-js-0.2.0-Pass-.fail-unit-test.patch @@ -0,0 +1,27 @@ +From a17b21199149014a26729e79331001f976c9ee81 Mon Sep 17 00:00:00 2001 +From: Gavin Huang +Date: Tue, 25 Sep 2012 12:33:55 +0800 +Subject: [PATCH 05/13] Pass .fail() unit test + +--- + expect.js | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/expect.js b/expect.js +index ab5a1ee..ac14ea8 100644 +--- a/expect.js ++++ b/expect.js +@@ -466,8 +466,8 @@ + * @api public + */ + Assertion.prototype.fail = function (msg) { +- msg = msg || "explicit failure"; +- this.assert(false, msg, msg); ++ var error = function() { return msg || "explicit failure"; } ++ this.assert(false, error, error); + return this; + }; + +-- +1.8.2.1 + diff --git a/nodejs-expect-dot-js.spec b/nodejs-expect-dot-js.spec new file mode 100644 index 0000000..037ff8d --- /dev/null +++ b/nodejs-expect-dot-js.spec @@ -0,0 +1,47 @@ +%{?nodejs_find_provides_and_requires} +%global enable_tests 1 +Name: nodejs-expect-dot-js +Version: 0.2.0 +Release: 1 +Summary: Behavior-driven development (BDD) style assertions for Node.js and the browser +License: MIT +URL: https://github.com/Automattic/expect.js +Source0: https://github.com/Automattic/expect.js/archive/%{version}.tar.gz +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +Patch0: %{name}-0.2.0-Pass-.fail-unit-test.patch +Patch1: %{name}-0.2.0-Add-actual-expected-property-to-the-thrown-error.patch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(mocha) +%endif +Patch2: 0001-Update-expected-test-values.patch + +%description +%{summary}. + +%prep +%autosetup -n expect.js-%{version} -S git + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/expect.js +cp -pr package.json expect.js \ + %{buildroot}%{nodejs_sitelib}/expect.js +%nodejs_symlink_deps +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +%{nodejs_sitelib}/mocha/bin/mocha --require ./test/common \ + --reporter dot --growl test/expect.js +%endif + +%files +%doc History.md README.md +%{nodejs_sitelib}/expect.js + +%changelog +* Fri Aug 21 2020 leiju - 0.2.0-1 +- Package init diff --git a/nodejs-expect-dot-js.yaml b/nodejs-expect-dot-js.yaml new file mode 100644 index 0000000..5c5fd17 --- /dev/null +++ b/nodejs-expect-dot-js.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: Automattic/expect.js +tag_prefix: "^" +seperator: "."