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
cab579d1
...
cab579d102e2e2ef7de7b3357b38cadd9ff296d3
authored
2012-01-10 18:22:22 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added the --run-tests option to auto-discover and run tests found within a given directory
1 parent
ff9e8845
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
bin/bootstrap.js
bin/usage.txt
modules/cli.js
bin/bootstrap.js
View file @
cab579d
...
...
@@ -263,16 +263,19 @@ if (!phantom.casperLoaded) {
if
(
!!
phantom
.
casperArgs
.
options
.
version
)
{
console
.
log
(
phantom
.
casperVersion
.
toString
());
phantom
.
exit
(
0
);
}
else
if
(
!!
phantom
.
casperArgs
.
get
(
'run-tests'
))
{
phantom
.
casperScript
=
fs
.
absolute
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'tests'
,
'run.js'
));
}
else
if
(
phantom
.
casperArgs
.
args
.
length
===
0
||
!!
phantom
.
casperArgs
.
options
.
help
)
{
var
phantomVersion
=
[
phantom
.
version
.
major
,
phantom
.
version
.
minor
,
phantom
.
version
.
patch
].
join
(
'.'
);
console
.
log
(
'CasperJS version '
+
phantom
.
casperVersion
.
toString
()
+
' at '
+
phantom
.
casperPath
);
console
.
log
(
'Using PhantomJS version '
+
phantomVersion
);
console
.
log
(
'Usage: casperjs script.(js|coffee) [options...]'
);
console
.
log
(
'Read the docs http://n1k0.github.com/casperjs/'
);
console
.
log
(
fs
.
read
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'bin'
,
'usage.txt'
)));
phantom
.
exit
(
0
);
}
phantom
.
casperScript
=
phantom
.
casperArgs
.
get
(
0
);
if
(
!
phantom
.
casperScript
)
{
phantom
.
casperScript
=
phantom
.
casperArgs
.
get
(
0
);
}
if
(
!
fs
.
isFile
(
phantom
.
casperScript
))
{
console
.
error
(
'Unable to open file: '
+
phantom
.
casperScript
);
...
...
bin/usage.txt
0 → 100644
View file @
cab579d
Usage:
$ casperjs [options] script.[js|coffee] [script argument [script argument ...]]
Read the docs http://n1k0.github.com/casperjs/
\ No newline at end of file
modules/cli.js
View file @
cab579d
...
...
@@ -41,10 +41,19 @@ exports.parse = function(phantomArgs) {
var
extract
=
{
args
:
[],
options
:
{},
has
:
function
(
what
)
{
if
(
utils
.
isNumber
(
what
))
{
return
what
in
this
.
args
;
}
else
if
(
utils
.
isString
(
what
))
{
return
what
in
this
.
options
;
}
else
{
throw
new
CasperError
(
"Unsupported cli arg tester "
+
typeof
what
);
}
},
get
:
function
(
what
)
{
if
(
typeof
what
===
"number"
)
{
if
(
utils
.
isNumber
(
what
)
)
{
return
this
.
args
[
what
];
}
else
if
(
typeof
what
===
"string"
)
{
}
else
if
(
utils
.
isString
(
what
)
)
{
return
this
.
options
[
what
];
}
else
{
throw
new
CasperError
(
"Unsupported cli arg getter "
+
typeof
what
);
...
...
Please
register
or
sign in
to post a comment