The package rpms/nodejs-make-error.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/nodejs-make-error.git/commit/?id=74b....
Change: +ExclusiveArch: %{nodejs_arches} noarch
Thanks.
Full change: ============
commit 74b69584c35033fb501c2e60b406eac4970762a2 Author: Jared Smith jsmith@fedoraproject.org Date: Thu May 24 15:11:20 2018 -0400
Initial packaging
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b83d85 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/make-error-1.3.4.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 29241b3..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nodejs-make-error - -'Make your own error types!' \ No newline at end of file diff --git a/index.spec.js b/index.spec.js new file mode 100644 index 0000000..5c9ba88 --- /dev/null +++ b/index.spec.js @@ -0,0 +1,151 @@ +'use strict' + +/* eslint-env jest */ + +// =================================================================== + +var makeError = require('./') +var BaseError = makeError.BaseError + +// =================================================================== + +function getCommonLastItems (arr1, arr2, butFirsts) { + var n = Math.min(arr1.length, arr2.length) - (butFirsts || 0) + + return [ + arr1.slice(-n), + arr2.slice(-n) + ] +} + +function compareStacks (actual, expected) { + actual = actual.split(/\r?\n/) + expected = expected.split(/\r?\n/) + + // We want to compare only the beginning (bottom) of the stack and + // we don't want to compare the first (from head) two items. + var tmp = getCommonLastItems(actual, expected, 2) + actual = tmp[0] + expected = tmp[1] + + expect(actual).toEqual(expected) +} + +function randomString () { + return Math.random().toString(36).slice(2) +} + +// =================================================================== + +var factories = { + 'makeError(name)': makeError, + 'makeError(constructor)': function (name, super_) { + function MyError (message) { + MyError.super.call(this, message) + } + Object.defineProperty(MyError, 'name', { value: name }) + + expect(makeError(MyError, super_)).toBe(MyError) + return MyError + }, + 'ES3 inheritance': function (name, super_) { + function MyError (message) { + BaseError.call(this, message) + } + Object.defineProperty(MyError, 'name', { + value: name + }) + + function Tmp () { + this.constructor = MyError + } + Tmp.prototype = super_.prototype + MyError.prototype = new Tmp() + + return MyError + }, + 'ES5 inheritance': function (name, super_) { + function MyError (message) { + super_.call(this, message) + } + Object.defineProperty(MyError, 'name', { + value: name + }) + + // Manually inherits from BaseError. + MyError.prototype = Object.create(super_.prototype, { + constructor: { + configurable: true, + value: MyError, + writable: true + } + }) + + return MyError + }, + 'ES6 inheritance': typeof Reflect !== 'undefined' && function (name, super_) { + return Object.defineProperty(class extends super_ {}, 'name', { + value: name + }) + } +} + +var keys = Object.keys(factories) + +it('makeError throws on invalid arguments', function () { + expect(function () { + makeError(42) + }).toThrow(TypeError) + expect(function () { + makeError('MyError', 42) + }).toThrow(TypeError) +}) + +keys.forEach(function (title) { + var factory = factories[title] + ;(factory ? describe : describe.skip)(title, function () { + it('creates a new error class', function () { + var name = randomString() + var MyError = factory(name, BaseError) + + var message = randomString() + var e = new MyError(message) + var stack = new Error().stack + + expect(e).toBeInstanceOf(Error) + expect(e).toBeInstanceOf(BaseError) + expect(e).toBeInstanceOf(MyError) + + expect(e.name).toBe(name) + expect(e.message).toBe(message) + expect(typeof e.stack).toBe('string') + compareStacks(e.stack, stack) + }) + + describe('derivable with', function () { + keys.forEach(function (title2) { + var factory2 = factories[title2] + ;(factory2 ? it : it.skip)(title2, function () { + var baseName = randomString() + var MyBaseError = factory(baseName, BaseError) + var derivedName = randomString() + var MyDerivedError = factory2(derivedName, MyBaseError) + + var message = randomString() + var e = new MyDerivedError(message) + var stack = new Error().stack + + expect(e).toBeInstanceOf(Error) + expect(e).toBeInstanceOf(BaseError) + expect(e).toBeInstanceOf(MyBaseError) + expect(e).toBeInstanceOf(MyDerivedError) + + expect(e.name).toBe(derivedName) + expect(e.message).toBe(message) + expect(typeof e.stack).toBe('string') + compareStacks(e.stack, stack) + }) + }) + }) + }) +}) diff --git a/nodejs-make-error.spec b/nodejs-make-error.spec new file mode 100644 index 0000000..d99aff9 --- /dev/null +++ b/nodejs-make-error.spec @@ -0,0 +1,64 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename make-error + +# tests disabled due to missing npm(jest) +%global enable_tests 0 + +Name: nodejs-make-error +Version: 1.3.4 +Release: 1%{?dist} +Summary: Make your own error types! + +License: ISC +URL: https://github.com/JsCommunity/make-error.git +Source0: https://registry.npmjs.org/%%7Bpackagename%7D/-/%%7Bpackagename%7D-%%7Bversi... +# The test files are not included in the npm tarball. +Source1: https://raw.githubusercontent.com/JsCommunity/make-error/v%%7Bversion%7D/ind... + + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging + +%if 0%{?enable_tests} +BuildRequires: jest +%endif + +%description +Make your own error types! + + +%prep +%autosetup -n package +# setup the tests +cp -p %{SOURCE1} . + + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json index.js dist/ \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +%{_bindir}/jest +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc *.md +%{nodejs_sitelib}/%{packagename} + +%changelog +* Wed May 23 2018 Jared K. Smith jsmith@fedoraproject.org - 1.3.4-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..958e538 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (make-error-1.3.4.tgz) = d0369be5bb4a54f8626d26a573d4065dbe79f440fb1bb88b8c55c16a3f56abc3b7be8aee791e4ae63684de1906e99408372840fc9806e90938a9d1508ec615ea
arch-excludes@lists.fedoraproject.org