Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
You need to sign in or sign up before continuing.
Commit 93814d5a
authored
May 20, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3741 from briandamaged/master
Call stacks are computed properly
2 parents
926bab6e
1a82d8ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
lib/utils.js
test/unit/utils.js
lib/utils.js
View file @
93814d5
...
...
@@ -294,11 +294,11 @@ var Utils = module.exports = {
},
stack
:
function
()
{
stack
:
function
_stackGrabber
()
{
var
orig
=
Error
.
prepareStackTrace
;
Error
.
prepareStackTrace
=
function
(
_
,
stack
)
{
return
stack
;
};
var
err
=
new
Error
();
Error
.
captureStackTrace
(
err
,
this
);
Error
.
captureStackTrace
(
err
,
_stackGrabber
);
var
errStack
=
err
.
stack
;
Error
.
prepareStackTrace
=
orig
;
return
errStack
;
...
...
test/unit/utils.js
View file @
93814d5
...
...
@@ -114,4 +114,30 @@ suite(Support.getTestDialectTeaser('Utils'), function() {
});
});
});
suite
(
'stack'
,
function
()
{
test
(
'stack trace starts after call to Util.stack()'
,
function
this_here_test
()
{
function
a
()
{
return
b
();
}
function
b
()
{
return
c
();
}
function
c
()
{
return
Utils
.
stack
();
}
var
stack
=
a
();
expect
(
stack
[
0
].
getFunctionName
()).
to
.
eql
(
'c'
);
expect
(
stack
[
1
].
getFunctionName
()).
to
.
eql
(
'b'
);
expect
(
stack
[
2
].
getFunctionName
()).
to
.
eql
(
'a'
);
expect
(
stack
[
3
].
getFunctionName
()).
to
.
eql
(
'this_here_test'
);
});
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment