bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

Phantom couldn't find the script #96

Closed ctford closed 8 years ago

ctford commented 8 years ago

I just added doo to my project - https://github.com/ctford/klangmeister/commit/68a6a7b756297ef68a3219e5053d486c0086aa62

When I try and run the tests, I get the following error:

ctford@champernowne ~/Código/klangmeister $ lein doo phantom test once

;; ======================================================================
;; Testing with Phantom:

[doo] Command to run script: [phantomjs /tmp/phantom7256146241015115745.js /tmp/phantom-shim4736512223221154542.js out/testable.js]

ERROR: Phantom couldn't find the script

This is most likely doo's fault. Please file an issue at 
http://github.com/bensu/doo and we'll sort it out together.

Subprocess failed

out/testable.js is present and appears correct. Neither of the files in tmp seem to be there - perhaps that's the source of the problem.

ctford commented 8 years ago

The problem seems to be based on webpage's treatment of file paths. There is a non-ASCII character in the path where I've checked out the project (/home/ctford/Código/klangmeister - note the accent in "Código").

So when the temporary js file outputs the HTML with fs.write(pagePath, html, 'w');, it isn't found later on with p.open("file://" + pagePath, function (status) {...}.

I've verified this by moving the project directory.

This might not be an issue that's worth your while solving. It appears to be in webpage, and it's not a common case. But one possible thing I might try and PR is putting the HTML in /tmp/ too. Is there a reason it's put in project root?

bensu commented 8 years ago

@ctford good catch. As a Spanish speaker, I feel like Código should work, but oh well.

When using :optimizations :none, the ClojureScript compiler makes certain assumptions about the relative paths between the main file :output-to and :output-dir which are somewhat tricky when :output-dir is not specified. There is an implicit assumption that the dir from where the compiler is called from (in general the root folder) is special. See CLJS-1466 for an example of issues that stem from this.

To move the html to /tmp we would need to make up for those assumptions and override :output-to and :output-dir appropriately so that the the three-way link between the html, the main file, and then required files is preserved.

If you are interested in this approach, look at boot-cljs-test which needs to do all of this since all files need to be in filesets anyway.

bensu commented 8 years ago

Hi @ctford

Since this is solved for you and we don't have a burning need to move everything to /tmp I'm going to close this issue. If more issues result from the absolute vs tmp decision, I might revise the decision.