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
6e38aa26
...
6e38aa265f6cd1f2631c3db6754961ec612d246f
authored
2011-12-15 17:24:23 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #28 - usage of executable shouldn't be mandatory; so welcome to the phantom.casperPath variable
1 parent
de6db3a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
bin/casperjs
casper.js
tests/run.js
bin/casperjs
View file @
6e38aa2
...
...
@@ -2,4 +2,4 @@
CASPERJS_HOME
=
"
$(
cd
-P
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
cd
..
&&
pwd
)
"
phantomjs
$CASPERJS_HOME
/casper.js
$CASPERJS_HOME
$*
phantomjs
$CASPERJS_HOME
/casper.js
--casper-dir
=
$CASPERJS_HOME
$*
...
...
casper.js
View file @
6e38aa2
...
...
@@ -32,20 +32,18 @@
return
Array
.
prototype
.
join
.
call
(
arguments
,
this
.
separator
);
};
if
(
!
fs
.
isDirectory
(
phantom
.
args
[
0
])
||
!
fs
.
isFile
(
fs
.
pathJoin
(
phantom
.
args
[
0
],
'casper.js'
)))
{
console
.
log
(
'First argument must be the absolute path to casper root path.'
);
phantom
.
exit
(
1
);
}
// seeking for casperPath passed as an argument
phantom
.
args
.
forEach
(
function
(
arg
)
{
var
pathMatch
=
arg
.
match
(
/--casper-dir=
(
.+
)
/
);
if
(
pathMatch
)
{
phantom
.
casperPath
=
pathMatch
[
1
];
}
});
if
(
!
fs
.
isFile
(
phantom
.
args
[
1
]))
{
console
.
log
(
'Usage: $ casperjs script.[js|coffee]'
);
phantom
.
exit
(
1
);
if
(
!
phantom
.
casperPath
||
!
fs
.
isDirectory
(
phantom
.
casperPath
))
{
console
.
log
(
'Cannot find CasperJS home path. Did you set phantom.casperPath or pass the --casper-dir option?'
);
}
phantom
.
casperPath
=
phantom
.
args
[
0
];
phantom
.
casperScript
=
phantom
.
args
[
1
];
phantom
.
casperLibPath
=
fs
.
pathJoin
(
phantom
.
casperPath
,
'lib'
);
[
'casper.js'
,
'clientutils.js'
,
...
...
@@ -55,7 +53,7 @@
'utils.js'
,
'xunit.js'
].
forEach
(
function
(
lib
)
{
phantom
.
injectJs
(
fs
.
pathJoin
(
phantom
.
casper
LibPath
,
lib
));
phantom
.
injectJs
(
fs
.
pathJoin
(
phantom
.
casper
Path
,
'lib'
,
lib
));
});
phantom
.
injectJs
(
phantom
.
args
[
1
]);
...
...
tests/run.js
View file @
6e38aa2
var
fs
=
require
(
'fs'
);
phantom
.
injectJs
(
fs
.
pathJoin
(
phantom
.
casper
LibPath
,
'vendors'
,
'esprima.js'
));
phantom
.
injectJs
(
fs
.
pathJoin
(
phantom
.
casper
Path
,
'lib'
,
'vendors'
,
'esprima.js'
));
var
casper
=
new
phantom
.
Casper
({
faultTolerant
:
false
,
...
...
@@ -11,7 +11,7 @@ var tests = [];
if
(
phantom
.
args
.
length
>
2
&&
fs
.
isFile
(
phantom
.
args
[
2
]))
{
tests
=
[
phantom
.
args
[
2
]];
}
else
{
tests
=
[
fs
.
absolute
(
fs
.
pathJoin
(
phantom
.
casper
LibPath
,
'..'
,
'tests'
,
'suites'
))];
tests
=
[
fs
.
absolute
(
fs
.
pathJoin
(
phantom
.
casper
Path
,
'tests'
,
'suites'
))];
}
// Overriding Casper.open to prefix all test urls
...
...
Please
register
or
sign in
to post a comment