package init

This commit is contained in:
wang_yue111 2020-08-28 15:50:09 +08:00
parent 27e58d966e
commit badcbd86ad
6 changed files with 426 additions and 0 deletions

View File

@ -0,0 +1,136 @@
From b12f1c217b958a826c222de2a08765924636618b Mon Sep 17 00:00:00 2001
From: Jamie Nguyen <j@jamielinux.com>
Date: Sun, 23 Feb 2014 15:38:12 +0000
Subject: [PATCH] Load system modules
---
bin/nodeunit | 2 +-
examples/browser/nodeunit.js | 4 ++--
lib/core.js | 2 +-
lib/nodeunit.js | 2 +-
lib/reporters/junit.js | 4 ++--
lib/types.js | 2 +-
lib/utils.js | 2 +-
test/test-base.js | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/bin/nodeunit b/bin/nodeunit
index 4b3f4d5..f2c79ba 100755
--- a/bin/nodeunit
+++ b/bin/nodeunit
@@ -8,7 +8,7 @@ var
// lands in core.
//
// Until then, use console.log from npm (https://gist.github.com/1077544)
-require('../deps/console.log');
+require('console.log');
//require.paths.push(process.cwd());
var args = (process.ARGV || process.argv).slice(2);
diff --git a/examples/browser/nodeunit.js b/examples/browser/nodeunit.js
index af7fd0b..bca5d1f 100644
--- a/examples/browser/nodeunit.js
+++ b/examples/browser/nodeunit.js
@@ -1457,7 +1457,7 @@ assert.ifError = function (err) { if (err) {throw err;}};
*/
//var assert = require('./assert'), //@REMOVE_LINE_FOR_BROWSER
-// async = require('../deps/async'); //@REMOVE_LINE_FOR_BROWSER
+// async = require('async'); //@REMOVE_LINE_FOR_BROWSER
/**
@@ -1647,7 +1647,7 @@ exports.options = function (opt) {
* Module dependencies
*/
-//var async = require('../deps/async'), //@REMOVE_LINE_FOR_BROWSER
+//var async = require('async'), //@REMOVE_LINE_FOR_BROWSER
// types = require('./types'); //@REMOVE_LINE_FOR_BROWSER
diff --git a/lib/core.js b/lib/core.js
index 8ff031b..483a662 100644
--- a/lib/core.js
+++ b/lib/core.js
@@ -13,7 +13,7 @@
* Module dependencies
*/
-var async = require('../deps/async'), //@REMOVE_LINE_FOR_BROWSER
+var async = require('async'), //@REMOVE_LINE_FOR_BROWSER
nodeunit = require('./nodeunit'), //@REMOVE_LINE_FOR_BROWSER
types = require('./types'); //@REMOVE_LINE_FOR_BROWSER
diff --git a/lib/nodeunit.js b/lib/nodeunit.js
index 7d33c7b..7212ade 100644
--- a/lib/nodeunit.js
+++ b/lib/nodeunit.js
@@ -8,7 +8,7 @@
* Module dependencies
*/
-var async = require('../deps/async'),
+var async = require('async'),
types = require('./types'),
utils = require('./utils'),
core = require('./core'),
diff --git a/lib/reporters/junit.js b/lib/reporters/junit.js
index 5400526..ac6d545 100644
--- a/lib/reporters/junit.js
+++ b/lib/reporters/junit.js
@@ -12,10 +12,10 @@ var nodeunit = require('../nodeunit'),
utils = require('../utils'),
fs = require('fs'),
path = require('path'),
- async = require('../../deps/async'),
+ async = require('async'),
AssertionError = require('assert').AssertionError,
child_process = require('child_process'),
- ejs = require('../../deps/ejs');
+ ejs = require('ejs');
/**
diff --git a/lib/types.js b/lib/types.js
index 879edd8..65956f5 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -14,7 +14,7 @@
*/
var assert = require('./assert'), //@REMOVE_LINE_FOR_BROWSER
- async = require('../deps/async'); //@REMOVE_LINE_FOR_BROWSER
+ async = require('async'); //@REMOVE_LINE_FOR_BROWSER
/**
diff --git a/lib/utils.js b/lib/utils.js
index 898820f..dc8b736 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -8,7 +8,7 @@
* Module dependencies
*/
-var async = require('../deps/async'),
+var async = require('async'),
fs = require('fs'),
util = require('util'),
Script = require('vm').Script,
diff --git a/test/test-base.js b/test/test-base.js
index 5335046..b6ff611 100644
--- a/test/test-base.js
+++ b/test/test-base.js
@@ -10,7 +10,7 @@
*/
var assert = require('assert'), // @REMOVE_LINE_FOR_BROWSER
- async = require('../deps/async'), // @REMOVE_LINE_FOR_BROWSER
+ async = require('async'), // @REMOVE_LINE_FOR_BROWSER
nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
--
1.8.5.3

View File

@ -0,0 +1,123 @@
From 671b19bc318293063a1a636175a3c2b102a4bade Mon Sep 17 00:00:00 2001
From: Jamie Nguyen <j@jamielinux.com>
Date: Sun, 23 Feb 2014 15:45:48 +0000
Subject: [PATCH] Use system assert.js
---
lib/nodeunit.js | 2 +-
lib/reporters/default.js | 2 +-
lib/reporters/eclipse.js | 2 +-
lib/reporters/machineout.js | 2 +-
lib/reporters/nested.js | 2 +-
lib/reporters/verbose.js | 2 +-
lib/types.js | 2 +-
test/test-bettererrors.js | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/nodeunit.js b/lib/nodeunit.js
index 7212ade..3b5c527 100644
--- a/lib/nodeunit.js
+++ b/lib/nodeunit.js
@@ -13,7 +13,7 @@ var async = require('async'),
utils = require('./utils'),
core = require('./core'),
reporters = require('./reporters'),
- assert = require('./assert'),
+ assert = require('assert'),
path = require('path'),
events = require('events');
diff --git a/lib/reporters/default.js b/lib/reporters/default.js
index 0de3f23..3102038 100644
--- a/lib/reporters/default.js
+++ b/lib/reporters/default.js
@@ -13,7 +13,7 @@ var nodeunit = require('../nodeunit'),
fs = require('fs'),
track = require('../track'),
path = require('path'),
- AssertionError = require('../assert').AssertionError;
+ AssertionError = require('assert').AssertionError;
/**
* Reporter info string
diff --git a/lib/reporters/eclipse.js b/lib/reporters/eclipse.js
index c56a4b8..1d3a64a 100644
--- a/lib/reporters/eclipse.js
+++ b/lib/reporters/eclipse.js
@@ -13,7 +13,7 @@ var nodeunit = require('../nodeunit'),
fs = require('fs'),
track = require('../track'),
path = require('path'),
- AssertionError = require('../assert').AssertionError;
+ AssertionError = require('assert').AssertionError;
/**
* Reporter info string
diff --git a/lib/reporters/machineout.js b/lib/reporters/machineout.js
index c58ee40..c35d451 100644
--- a/lib/reporters/machineout.js
+++ b/lib/reporters/machineout.js
@@ -17,7 +17,7 @@ var nodeunit = require('../nodeunit'),
fs = require('fs'),
track = require('../track'),
path = require('path'),
- AssertionError = require('../assert').AssertionError;
+ AssertionError = require('assert').AssertionError;
/**
* Reporter info string
diff --git a/lib/reporters/nested.js b/lib/reporters/nested.js
index 62f3d79..8545614 100644
--- a/lib/reporters/nested.js
+++ b/lib/reporters/nested.js
@@ -13,7 +13,7 @@ var nodeunit = require('../nodeunit'),
fs = require('fs'),
track = require('../track'),
path = require('path'),
- AssertionError = require('../assert').AssertionError;
+ AssertionError = require('assert').AssertionError;
/**
* Reporter info string
diff --git a/lib/reporters/verbose.js b/lib/reporters/verbose.js
index 6c6083a..1d7e849 100644
--- a/lib/reporters/verbose.js
+++ b/lib/reporters/verbose.js
@@ -13,7 +13,7 @@ var nodeunit = require('../nodeunit'),
fs = require('fs'),
track = require('../track'),
path = require('path');
- AssertionError = require('../assert').AssertionError;
+ AssertionError = require('assert').AssertionError;
/**
* Reporter info string
diff --git a/lib/types.js b/lib/types.js
index 65956f5..1b3b181 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -13,7 +13,7 @@
* Module dependencies
*/
-var assert = require('./assert'), //@REMOVE_LINE_FOR_BROWSER
+var assert = require('assert'), //@REMOVE_LINE_FOR_BROWSER
async = require('async'); //@REMOVE_LINE_FOR_BROWSER
diff --git a/test/test-bettererrors.js b/test/test-bettererrors.js
index 4cae570..e924d1a 100644
--- a/test/test-bettererrors.js
+++ b/test/test-bettererrors.js
@@ -2,7 +2,7 @@
* Test utils.betterErrors. utils.betterErrors should provide sensible error messages even when the error does not
* contain expected, actual or operator.
*/
-var assert = require("../lib/assert");
+var assert = require("assert");
var should = require("should");
var types = require("../lib/types");
var util = require('util');
--
1.8.5.3

View File

@ -0,0 +1,28 @@
commit a796685799f368964d76c788e6d41ca7dc59c295
Author: Tom Hughes <tom@compton.nu>
Date: Wed Jan 20 18:12:26 2016 +0000
Replace path.exists with fs.stat
diff --git a/test/test-runfiles.js b/test/test-runfiles.js
index ecbdfd8..2c276de 100644
--- a/test/test-runfiles.js
+++ b/test/test-runfiles.js
@@ -1,6 +1,5 @@
var assert = require('assert'),
fs = require('fs'),
- path = require('path'),
nodeunit = require('../lib/nodeunit');
@@ -116,8 +115,8 @@ exports.testEmptyDir = function (test) {
var dir2 = __dirname + '/fixtures/dir2';
// git doesn't like empty directories, so we have to create one
- path.exists(dir2, function (exists) {
- if (!exists) {
+ fs.stat(dir2, function (err) {
+ if (err) {
fs.mkdirSync(dir2, 0777);
}

View File

@ -0,0 +1,53 @@
commit 3c5b085ca59478b68f6fa0d9425405b68104b5ac
Author: Tom Hughes <tom@compton.nu>
Date: Sat Nov 21 12:24:47 2015 +0000
Fix tests for newer versions of should
diff --git a/test/test-bettererrors.js b/test/test-bettererrors.js
index 35ac798..dc05e8f 100644
--- a/test/test-bettererrors.js
+++ b/test/test-bettererrors.js
@@ -15,9 +15,9 @@ function betterErrorStringFromError(error) {
}
function performBasicChecks(betterErrorString) {
- betterErrorString.should.include("AssertionError");
- betterErrorString.should.include("test-bettererrors");
- //betterErrorString.should.not.include("undefined");
+ betterErrorString.should.containEql("AssertionError");
+ betterErrorString.should.containEql("test-bettererrors");
+ //betterErrorString.should.not.containEql("undefined");
}
/**
@@ -30,9 +30,9 @@ exports.testEqual = function (test) {
} catch (error) {
var betterErrorString = betterErrorStringFromError(error);
performBasicChecks(betterErrorString);
- betterErrorString.should.include("true");
- betterErrorString.should.include("false");
- betterErrorString.should.include("==");
+ betterErrorString.should.containEql("true");
+ betterErrorString.should.containEql("false");
+ betterErrorString.should.containEql("==");
test.done();
}
};
@@ -66,11 +66,11 @@ exports.testErrorIsNotAssertion = function (test) {
throw new Error("test error");
} catch (error) {
var betterErrorString = betterErrorStringFromError(error);
- betterErrorString.should.not.include("AssertionError");
- betterErrorString.should.include("Error");
- betterErrorString.should.include("test error");
- betterErrorString.should.include("test-bettererrors");
- betterErrorString.should.not.include("undefined");
+ betterErrorString.should.not.containEql("AssertionError");
+ betterErrorString.should.containEql("Error");
+ betterErrorString.should.containEql("test error");
+ betterErrorString.should.containEql("test-bettererrors");
+ betterErrorString.should.not.containEql("undefined");
test.done();
}
};

BIN
nodeunit-0.9.1.tgz Normal file

Binary file not shown.

86
nodeunit.spec Normal file
View File

@ -0,0 +1,86 @@
%{?nodejs_find_provides_and_requires}
%global enable_tests 1
Name: nodeunit
Version: 0.9.1
Release: 1
Summary: Easy asynchronous unit testing framework for Node.js
License: MIT
URL: https://github.com/caolan/nodeunit
Source0: https://registry.npmjs.org/nodeunit/-/nodeunit-%{version}.tgz
Patch0: %{name}-0.8.6-Load-system-modules.patch
Patch1: %{name}-0.8.6-Use-system-assert.js.patch
Patch2: %{name}-0.9.1-Use-newer-should.patch
Patch3: %{name}-0.9.1-Use-fs-stat.patch
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: coffee-script expresso npm(async) npm(console.log) npm(ejs) npm(paperboy)
BuildRequires: npm(should) npm(tap)
%endif
%description
Nodeunit provides an easy asynchronous unit testing framework for Node.js:
- helps you avoid common pitfalls when testing asynchronous code
- easy to add test cases with setUp and tearDown functions if you wish
- flexible reporters for custom output
- built-in support for HTML and jUnit XML
- allows the use of mocks and stubs
%prep
%setup -q -n package
rm -rf deps/
rm -f lib/assert.js
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%nodejs_fixdep async '^1.5.0'
%nodejs_fixdep console.log '~0.1'
%nodejs_fixdep ejs '~1.0'
%nodejs_fixdep tap
%build
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/nodeunit
cp -pr package.json index.js lib/ \
%{buildroot}%{nodejs_sitelib}/nodeunit
install -p -D -m0755 bin/nodeunit \
%{buildroot}%{nodejs_sitelib}/nodeunit/bin/nodeunit
mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/nodeunit/bin/nodeunit \
%{buildroot}%{_bindir}/nodeunit
install -p -D -m0644 man1/nodeunit.1 \
%{buildroot}%{_mandir}/man1/nodeunit.1
mkdir -p %{buildroot}%{_datadir}/nodeunit/bin
install -p -D -m0644 bin/nodeunit.json \
%{buildroot}%{_datadir}/nodeunit/bin/nodeunit.json
cp -pr share/ %{buildroot}%{_datadir}/nodeunit
mkdir -p %{buildroot}%{nodejs_sitelib}/nodeunit/bin
ln -sf %{_datadir}/nodeunit/bin/nodeunit.json \
%{buildroot}%{nodejs_sitelib}/nodeunit/bin/nodeunit.json
ln -sf %{_datadir}/nodeunit/share \
%{buildroot}%{nodejs_sitelib}/nodeunit/share
%nodejs_symlink_deps
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
rm -f test/test-httputil.js
%__nodejs ./bin/nodeunit test --reporter tap
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif
%files
%doc CONTRIBUTORS.md README.md doc/ examples/
%license LICENSE
%{nodejs_sitelib}/nodeunit
%{_bindir}/nodeunit
%{_datadir}/nodeunit
%{_mandir}/man1/nodeunit.1*
%changelog
* Sat Aug 22 2020 wangyue <wangyue92@huawei.com> - 0.9.1-1
- package init