nodeunit/nodeunit.spec

87 lines
2.8 KiB
RPMSpec
Raw Permalink Normal View History

2020-08-28 15:50:09 +08:00
%{?nodejs_find_provides_and_requires}
2020-09-10 10:32:17 +08:00
%global enable_tests 0
2020-08-28 15:50:09 +08:00
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
2020-09-10 10:32:17 +08:00
Source0: https://github.com/caolan/nodeunit/archive/0.9.1.tar.gz
2020-08-28 15:50:09 +08:00
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
2020-09-11 10:12:19 +08:00
BuildRequires: nodejs-packaging nodejs-async nodejs-ejs
2020-08-28 15:50:09 +08:00
%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
2020-09-10 10:32:17 +08:00
%setup -q -n %{name}-%{version}
2020-08-28 15:50:09 +08:00
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