Upgrade to version 5.0.0
This commit is contained in:
parent
5cb48c9c60
commit
0ea010cc7d
@ -1,7 +1,7 @@
|
||||
%global enable_tests 0
|
||||
%global module_name resolve-from
|
||||
Name: nodejs-%{module_name}
|
||||
Version: 4.0.0
|
||||
Version: 5.0.0
|
||||
Release: 1
|
||||
Summary: Resolve the path of a module like require.resolve() but from a given path
|
||||
License: MIT
|
||||
@ -45,5 +45,8 @@ node test.js
|
||||
%{nodejs_sitelib}/%{module_name}
|
||||
|
||||
%changelog
|
||||
* Thu Jun 23 2022 SimpleUpdate Robot <tc@openeuler.org> - 5.0.0-1
|
||||
- Upgrade to version 5.0.0
|
||||
|
||||
* Fri Aug 14 2020 wangyue <wangyue92@huawei.com> - 4.0.0-1
|
||||
- Package init
|
||||
|
||||
Binary file not shown.
BIN
resolve-from-5.0.0.tgz
Normal file
BIN
resolve-from-5.0.0.tgz
Normal file
Binary file not shown.
22
test.js
22
test.js
@ -1,30 +1,30 @@
|
||||
import test from 'ava';
|
||||
import m from '.';
|
||||
import resolveFrom from '.';
|
||||
|
||||
test('resolveFrom()', t => {
|
||||
t.throws(() => m(1, './fixture'), /got `number`/);
|
||||
t.throws(() => m('fixture'), /got `undefined`/);
|
||||
t.throws(() => resolveFrom(1, './fixture'), /got `number`/);
|
||||
t.throws(() => resolveFrom('fixture'), /got `undefined`/);
|
||||
|
||||
t.regex(m('fixture', './fixture'), /fixture\/fixture\.js$/);
|
||||
t.regex(resolveFrom('fixture', './fixture'), /fixture\/fixture\.js$/);
|
||||
|
||||
const moduleNotFoundError = t.throws(() => {
|
||||
m('fixture', './nonexistent');
|
||||
resolveFrom('fixture', './nonexistent');
|
||||
}, Error);
|
||||
t.is(moduleNotFoundError.code, 'MODULE_NOT_FOUND');
|
||||
t.is(moduleNotFoundError.message, 'Cannot find module \'./nonexistent\'');
|
||||
|
||||
const resolveFromfixture = m.bind(null, 'fixture');
|
||||
const resolveFromfixture = resolveFrom.bind(null, 'fixture');
|
||||
t.regex(resolveFromfixture('./fixture'), /fixture\/fixture\.js$/);
|
||||
|
||||
t.truthy(m('./fixture/fixture-for-symlinks/symlink-target', 'foo'));
|
||||
t.truthy(resolveFrom('./fixture/fixture-for-symlinks/symlink-target', 'foo'));
|
||||
});
|
||||
|
||||
test('resolveFrom.silent()', t => {
|
||||
t.regex(m.silent('fixture', './fixture'), /fixture\/fixture\.js$/);
|
||||
t.is(m.silent('fixture', './nonexistent'), null);
|
||||
t.regex(resolveFrom.silent('fixture', './fixture'), /fixture\/fixture\.js$/);
|
||||
t.is(resolveFrom.silent('fixture', './nonexistent'), undefined);
|
||||
|
||||
const silentResolveFromfixture = m.silent.bind(null, 'fixture');
|
||||
const silentResolveFromfixture = resolveFrom.silent.bind(null, 'fixture');
|
||||
t.regex(silentResolveFromfixture('./fixture'), /fixture\/fixture\.js$/);
|
||||
|
||||
t.is(m.silent('fixture-not-exists', './fixture'), null);
|
||||
t.is(resolveFrom.silent('fixture-not-exists', './fixture'), undefined);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user