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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
22 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,38 +1219,45 @@ Tester.prototype.pass = function pass(message) {
});
};
/**
* Processes an assertion error.
*
* @param AssertionError error
*/
Tester
.
prototype
.
processAssertionError
=
function
(
error
)
{
function
getStackEntry
(
error
,
testFile
)
{
"use strict"
;
var
result
=
error
&&
error
.
result
||
{},
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
error
.
stackArray
.
filter
(
function
(
entry
)
{
return
testFile
===
entry
.
sourceURL
;
})[
0
];
}
else
if
(
'stack'
in
error
)
{
if
(
!
(
'stack'
in
error
))
return
null
;
var
r
=
/^
\s
*
(
.*
)
@
(
.*
)
:
(\d
+
)\s
*$/gm
;
var
m
;
while
((
m
=
r
.
exec
(
e
.
stack
)))
{
while
((
m
=
r
.
exec
(
error
.
stack
)))
{
var
sourceURL
=
m
[
2
];
if
(
sourceURL
.
indexOf
(
'->'
)
!
=
-
1
)
{
if
(
sourceURL
.
indexOf
(
'->'
)
!=
=
-
1
)
{
sourceURL
=
sourceURL
.
split
(
'->'
)[
1
].
trim
();
}
if
(
sourceURL
==
testFile
)
{
stackEntry
=
{
sourceURL
:
sourceURL
,
line
:
m
[
3
]}
break
;
}
if
(
sourceURL
===
testFile
)
{
return
{
sourceURL
:
sourceURL
,
line
:
m
[
3
]}
}
}
return
null
;
}
/**
* Processes an assertion error.
*
* @param AssertionError error
*/
Tester
.
prototype
.
processAssertionError
=
function
(
error
)
{
"use strict"
;
var
result
=
error
&&
error
.
result
||
{},
testFile
=
this
.
currentTestFile
,
stackEntry
;
try
{
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