Closed lazd closed 10 years ago
Thanks for the detailed work around steps as I'm facing the same issues. Would be great to see this merged.
@danielflower, you can use my fork as a dependency in the mean time, see the npm docs on Github URLs for more info and a package.json that uses my fork.
Also, see my sample repo, wellTested, for the new changes in action.
Steps
Install grunt-phantomcss from master:
Copy grunt-phantomcss' test suite
Setup grunt to use grunt-phantomcss:
Run grunt
Expected
Visual tests run successfully (that's very hopeful, heh).
Result
The following output is given
Workarounds
Point to the correct location of phantomjs
phantomjs
is not in the$PATH
, so it doesn't start. It is, however, installed in thenode_modules
folder of the project that usesgrunt-phantomcss
asphantomjs
is a peer dependency forgrunt-phantomcss
.In
grunt-phantomcss/tasks/phantomcss.js
change the location of thephantomjs
binary in the spawn command to the location of the phantomjs binary as installed innode_modules
:With the above changes in place, the output is:
Install phantomcss bower component
node_modules/grunt-phantomcss/tasks/phantomcss.js
expectsbower_components/phantomcss
to be available. The folder doesn't exist; no bower install was performed when the module was installed.Do a
bower install
in thenode_modules/grunt-phantomcss
folder to fix this.Fix the location of the test suite
Since the
cwd
passed togrunt.util.spawn
isbower_components/phantomcss
, then expected test suite file is not available. The path needs to be resolved correctly innode_modules/grunt-phantomcss/tasks/phantomcss.js
when a customconfigFile
option is passed:With the above changes in place, the new output is:
Make
phantom.casperPath
absoluteBoth
node_modules/grunt-phantomcss/config/compare.js
andnode_modules/grunt-phantomcss/config/testsuite.js
use a relative path forphantom.casperPath
. This works when includingphantom.casperPath + '/bin/bootstrap.js'
, but it doesn't work whenbootstrap.js
tries to require additional modules.Import the
fs
module and usefs.workingDirectory
to build an absolute path.After this change, the tests run: