Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7806150c
...
7806150ca114e35c99a36d10d098262f26b76197
authored
2013-06-20 07:29:35 +0200
by
Laurent Jouanneau
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixes jshint issues
1 parent
adff559f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
25 deletions
bin/bootstrap.js
modules/tester.js
modules/utils.js
bin/bootstrap.js
View file @
7806150
...
...
@@ -29,7 +29,7 @@
*/
/*global process, console, phantom, require:true*/
/*jshint maxstatements:3
3
, maxcomplexity:10*/
/*jshint maxstatements:3
4
, maxcomplexity:10*/
// node check
if
(
'process'
in
this
&&
process
.
title
===
"node"
)
{
...
...
modules/tester.js
View file @
7806150
...
...
@@ -1219,6 +1219,33 @@ Tester.prototype.pass = function pass(message) {
});
};
function
getStackEntry
(
error
,
testFile
)
{
"use strict"
;
if
(
"stackArray"
in
error
)
{
// PhantomJS has changed the API of the Error object :-/
// https://github.com/ariya/phantomjs/commit/c9cf14f221f58a3daf585c47313da6fced0276bc
return
error
.
stackArray
.
filter
(
function
(
entry
)
{
return
testFile
===
entry
.
sourceURL
;
})[
0
];
}
if
(
!
(
'stack'
in
error
))
return
null
;
var
r
=
/^
\s
*
(
.*
)
@
(
.*
)
:
(\d
+
)\s
*$/gm
;
var
m
;
while
((
m
=
r
.
exec
(
error
.
stack
)))
{
var
sourceURL
=
m
[
2
];
if
(
sourceURL
.
indexOf
(
'->'
)
!==
-
1
)
{
sourceURL
=
sourceURL
.
split
(
'->'
)[
1
].
trim
();
}
if
(
sourceURL
===
testFile
)
{
return
{
sourceURL
:
sourceURL
,
line
:
m
[
3
]}
}
}
return
null
;
}
/**
* Processes an assertion error.
*
...
...
@@ -1230,27 +1257,7 @@ Tester.prototype.processAssertionError = function(error) {
testFile
=
this
.
currentTestFile
,
stackEntry
;
try
{
if
(
"stackArray"
in
error
)
{
// PhantomJS has changed the API of the Error object :-/
// https://github.com/ariya/phantomjs/commit/c9cf14f221f58a3daf585c47313da6fced0276bc
stackEntry
=
error
.
stackArray
.
filter
(
function
(
entry
)
{
return
testFile
===
entry
.
sourceURL
;
})[
0
];
}
else
if
(
'stack'
in
error
)
{
var
r
=
/^
\s
*
(
.*
)
@
(
.*
)
:
(\d
+
)\s
*$/gm
;
var
m
;
while
((
m
=
r
.
exec
(
e
.
stack
)))
{
var
sourceURL
=
m
[
2
];
if
(
sourceURL
.
indexOf
(
'->'
)
!=
-
1
)
{
sourceURL
=
sourceURL
.
split
(
'->'
)[
1
].
trim
();
}
if
(
sourceURL
==
testFile
)
{
stackEntry
=
{
sourceURL
:
sourceURL
,
line
:
m
[
3
]}
break
;
}
}
}
stackEntry
=
getStackEntry
(
error
,
testFile
);
}
catch
(
e
)
{}
if
(
stackEntry
)
{
result
.
line
=
stackEntry
.
line
;
...
...
modules/utils.js
View file @
7806150
...
...
@@ -53,9 +53,9 @@ function betterTypeOf(input) {
default
:
try
{
var
type
=
Object
.
prototype
.
toString
.
call
(
input
).
match
(
/^
\[
object
\s(
.*
)\]
$/
)[
1
].
toLowerCase
();
if
(
type
==
'object'
&&
phantom
.
casperEngine
!=
"phantomjs"
&&
'__type'
in
input
)
{
if
(
type
==
=
'object'
&&
phantom
.
casperEngine
!==
"phantomjs"
&&
'__type'
in
input
)
{
type
=
input
.
__type
;
}
return
type
;
...
...
Please
register
or
sign in
to post a comment