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
36ca5058
...
36ca5058b2d251b4e45a757710059f165ae10d1c
authored
2012-09-22 10:52:39 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'lizjulien/master' into pr-231
2 parents
8e37f3f0
83a68850
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
18 deletions
modules/tester.js
tests/run.js
modules/tester.js
View file @
36ca505
...
...
@@ -55,7 +55,11 @@ var Tester = function Tester(casper, options) {
this
.
currentTestFile
=
null
;
this
.
exporter
=
require
(
'xunit'
).
create
();
this
.
includes
=
[];
this
.
loadIncludes
=
{
includes
:
[],
pre
:
[],
post
:
[]
};
this
.
running
=
false
;
this
.
suites
=
[];
this
.
options
=
utils
.
mergeObjects
({
...
...
@@ -721,9 +725,14 @@ var Tester = function Tester(casper, options) {
if
(
arguments
.
length
===
0
)
{
throw
new
CasperError
(
"runSuites() needs at least one path argument"
);
}
this
.
includes
.
forEach
(
function
(
include
)
{
this
.
loadIncludes
.
includes
.
forEach
(
function
(
include
)
{
phantom
.
injectJs
(
include
);
});
this
.
loadIncludes
.
pre
.
forEach
(
function
(
include
)
{
testFiles
=
testFiles
.
concat
(
include
);
});
Array
.
prototype
.
forEach
.
call
(
arguments
,
function
_forEach
(
path
)
{
if
(
!
fs
.
exists
(
path
))
{
self
.
bar
(
f
(
"Path %s doesn't exist"
,
path
),
"RED_BAR"
);
...
...
@@ -734,6 +743,11 @@ var Tester = function Tester(casper, options) {
testFiles
.
push
(
path
);
}
});
this
.
loadIncludes
.
post
.
forEach
(
function
(
include
)
{
testFiles
=
testFiles
.
concat
(
include
);
});
if
(
testFiles
.
length
===
0
)
{
this
.
bar
(
f
(
"No test file found in %s, aborting."
,
Array
.
prototype
.
slice
.
call
(
arguments
)),
"RED_BAR"
);
casper
.
exit
(
1
);
...
...
tests/run.js
View file @
36ca505
...
...
@@ -3,13 +3,12 @@ if (!phantom.casperLoaded) {
phantom
.
exit
(
1
);
}
var
colorizer
=
require
(
'colorizer'
);
var
fs
=
require
(
'fs'
);
var
utils
=
require
(
'utils'
);
var
f
=
utils
.
format
;
var
includes
=
[];
var
tests
=
[];
var
casper
=
require
(
'casper'
).
create
({
var
fs
=
require
(
'fs'
);
var
utils
=
require
(
'utils'
);
var
f
=
utils
.
format
;
var
loadIncludes
=
[
'includes'
,
'pre'
,
'post'
];
var
tests
=
[];
var
casper
=
require
(
'casper'
).
create
({
exitOnError
:
false
});
...
...
@@ -55,15 +54,18 @@ if (casper.cli.args.length) {
}
// includes handling
if
(
casper
.
cli
.
has
(
'includes'
))
{
includes
=
casper
.
cli
.
get
(
'includes'
).
split
(
','
).
map
(
function
(
include
)
{
// we can't use filter() directly because of abspath transformation
return
checkIncludeFile
(
include
);
}).
filter
(
function
(
include
)
{
return
utils
.
isString
(
include
);
});
casper
.
test
.
includes
=
utils
.
unique
(
includes
);
}
this
.
loadIncludes
.
forEach
(
function
(
include
){
var
container
;
if
(
casper
.
cli
.
has
(
include
))
{
container
=
casper
.
cli
.
get
(
include
).
split
(
','
).
map
(
function
(
file
)
{
return
checkIncludeFile
(
file
);
}).
filter
(
function
(
file
)
{
return
utils
.
isString
(
file
);
});
casper
.
test
.
loadIncludes
[
include
]
=
utils
.
unique
(
container
);
}
});
// test suites completion listener
casper
.
test
.
on
(
'tests.complete'
,
function
()
{
...
...
Please
register
or
sign in
to post a comment