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
428f8000
...
428f8000c0241794179890be346fea5cafe72cee
authored
2012-09-04 18:57:58 +0200
by
Julien Moulin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
First init of pre/post modification
1 parent
5ed461e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
modules/tester.js
tests/run.js
modules/tester.js
View file @
428f800
...
...
@@ -56,6 +56,8 @@ var Tester = function Tester(casper, options) {
this
.
currentTestFile
=
null
;
this
.
exporter
=
require
(
'xunit'
).
create
();
this
.
includes
=
[];
this
.
pre
=
[];
this
.
post
=
[];
this
.
running
=
false
;
this
.
suites
=
[];
this
.
options
=
utils
.
mergeObjects
({
...
...
@@ -729,7 +731,9 @@ var Tester = function Tester(casper, options) {
self
.
bar
(
f
(
"Path %s doesn't exist"
,
path
),
"RED_BAR"
);
}
if
(
fs
.
isDirectory
(
path
))
{
testFiles
=
testFiles
.
concat
(
this
.
pre
);
testFiles
=
testFiles
.
concat
(
self
.
findTestFiles
(
path
));
testFiles
=
testFiles
.
concat
(
this
.
post
);
}
else
if
(
fs
.
isFile
(
path
))
{
testFiles
.
push
(
path
);
}
...
...
tests/run.js
View file @
428f800
...
...
@@ -3,13 +3,14 @@ if (!phantom.casperLoaded) {
phantom
.
exit
(
1
);
}
var
colorizer
=
require
(
'colorizer'
);
var
fs
=
require
(
'fs'
);
var
utils
=
require
(
'utils'
);
var
f
=
utils
.
format
;
var
fs
=
require
(
'fs'
);
var
utils
=
require
(
'utils'
);
var
f
=
utils
.
format
;
var
includes
=
[];
var
tests
=
[];
var
casper
=
require
(
'casper'
).
create
({
var
pre
=
[];
var
post
=
[];
var
tests
=
[];
var
casper
=
require
(
'casper'
).
create
({
exitOnError
:
false
});
...
...
@@ -65,6 +66,28 @@ if (casper.cli.has('includes')) {
casper
.
test
.
includes
=
utils
.
unique
(
includes
);
}
// pre handling
if
(
casper
.
cli
.
has
(
'pre'
))
{
pre
=
casper
.
cli
.
get
(
'pre'
).
split
(
','
).
map
(
function
(
unique_pre
)
{
// we can't use filter() directly because of abspath transformation
return
checkIncludeFile
(
unique_pre
);
}).
filter
(
function
(
unique_pre
)
{
return
utils
.
isString
(
unique_pre
);
});
casper
.
test
.
pre
=
utils
.
unique
(
pre
);
}
// post handling
if
(
casper
.
cli
.
has
(
'post'
))
{
post
=
casper
.
cli
.
get
(
'post'
).
split
(
','
).
map
(
function
(
unique_post
)
{
// we can't use filter() directly because of abspath transformation
return
checkIncludeFile
(
unique_post
);
}).
filter
(
function
(
unique_post
)
{
return
utils
.
isString
(
unique_post
);
});
casper
.
test
.
post
=
utils
.
unique
(
post
);
}
// test suites completion listener
casper
.
test
.
on
(
'tests.complete'
,
function
()
{
this
.
renderResults
(
true
,
undefined
,
casper
.
cli
.
get
(
'xunit'
)
||
undefined
);
...
...
Please
register
or
sign in
to post a comment