commit
bcf981b7af
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2011, 2013 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
BIN
nodejs-callsite-1.0.0-8d39279.tar.gz
Normal file
BIN
nodejs-callsite-1.0.0-8d39279.tar.gz
Normal file
Binary file not shown.
47
nodejs-callsite.spec
Normal file
47
nodejs-callsite.spec
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
%{?nodejs_find_provides_and_requires}
|
||||||
|
%global commit 8d3927995821596148e77f4af049ab38b03d1b99
|
||||||
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||||
|
Name: nodejs-callsite
|
||||||
|
Version: 1.0.0
|
||||||
|
Release: 1
|
||||||
|
Summary: Provides access to V8's "raw" CallSites from Node.js
|
||||||
|
License: MIT
|
||||||
|
URL: https://github.com/visionmedia/callsite
|
||||||
|
Source0: https://github.com/visionmedia/callsite/archive/%{commit}/nodejs-callsite-%{version}-%{shortcommit}.tar.gz
|
||||||
|
Source1: https://raw.github.com/tchollingsworth/callsite/8d7615a28a6507c3ef0731f072d3f1a100b3fe27/LICENSE
|
||||||
|
BuildArch: noarch
|
||||||
|
ExclusiveArch: %{nodejs_arches} noarch
|
||||||
|
Patch1: %{name}_fix-tests.patch
|
||||||
|
BuildRequires: nodejs-devel
|
||||||
|
BuildRequires: npm(mocha) npm(should)
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}.
|
||||||
|
This is useful for custom traces, C-style assertions, getting the line number in
|
||||||
|
execution, and more.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n callsite-%{commit}
|
||||||
|
%patch1 -p1
|
||||||
|
cp %{SOURCE1} LICENSE
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}%{nodejs_sitelib}/callsite
|
||||||
|
cp -pr index.js package.json %{buildroot}%{nodejs_sitelib}/callsite
|
||||||
|
%nodejs_symlink_deps
|
||||||
|
|
||||||
|
%check
|
||||||
|
%nodejs_symlink_deps --check
|
||||||
|
%{__nodejs} -e 'require("./")'
|
||||||
|
mocha --require should
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc Readme.md examples History.md
|
||||||
|
%license LICENSE
|
||||||
|
%{nodejs_sitelib}/callsite
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Aug 18 2020 leiju <leiju4@huawei.com> - 1.0.0-1
|
||||||
|
- Package init
|
||||||
4
nodejs-callsite.yaml
Normal file
4
nodejs-callsite.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: github
|
||||||
|
src_repo: visionmedia/callsite
|
||||||
|
tag_prefix: "^"
|
||||||
|
seperator: "."
|
||||||
60
nodejs-callsite_fix-tests.patch
Normal file
60
nodejs-callsite_fix-tests.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
diff --git a/test/__line.js b/test/__line.js
|
||||||
|
index 5f3f83b..2d0056f 100644
|
||||||
|
--- a/test/__line.js
|
||||||
|
+++ b/test/__line.js
|
||||||
|
@@ -3,10 +3,15 @@
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-require('../');
|
||||||
|
+var stack = require('../');
|
||||||
|
|
||||||
|
-describe('__line', function(){
|
||||||
|
+var call = stack()[1]
|
||||||
|
+ , file = call.getFileName()
|
||||||
|
+ , lineno = call.getLineNumber()
|
||||||
|
+
|
||||||
|
+describe('__line', function(site){
|
||||||
|
it('should return the current lineno', function(){
|
||||||
|
- __line.should.equal(10);
|
||||||
|
+ var nextline = 15;
|
||||||
|
+ lineno.should.equal.nextline;
|
||||||
|
})
|
||||||
|
-})
|
||||||
|
\ No newline at end of file
|
||||||
|
+})
|
||||||
|
diff --git a/test/__stack.js b/test/__stack.js
|
||||||
|
index fb3fa5d..c47394f 100644
|
||||||
|
--- a/test/__stack.js
|
||||||
|
+++ b/test/__stack.js
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-require('../');
|
||||||
|
+var stack = require('../');
|
||||||
|
|
||||||
|
describe('__stack', function(){
|
||||||
|
it('should return an array of CallSites', function(){
|
||||||
|
@@ -18,14 +18,14 @@ describe('__stack', function(){
|
||||||
|
}
|
||||||
|
|
||||||
|
function baz() {
|
||||||
|
- __stack[0].fun.should.equal(baz);
|
||||||
|
- __stack[1].fun.should.equal(bar);
|
||||||
|
- __stack[2].fun.should.equal(foo);
|
||||||
|
+ stack()[0].getFunctionName().should.deepEqual("baz");
|
||||||
|
+ stack()[1].getFunctionName().should.deepEqual("bar");
|
||||||
|
+ stack()[2].getFunctionName().should.deepEqual("foo");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should restore stack preparation', function(){
|
||||||
|
- __stack;
|
||||||
|
- new Error().stack.should.be.a('string');
|
||||||
|
+ var __stack = stack();
|
||||||
|
+ new Error().stack.should.be.a.String();
|
||||||
|
})
|
||||||
|
-})
|
||||||
|
\ No newline at end of file
|
||||||
|
+})
|
||||||
Loading…
x
Reference in New Issue
Block a user