purescript-simple-dom
purescript-simple-dom copied to clipboard
Support PureScript 0.9 and use purescript-spec for tests
I can split this into 2 separate PRs if needed.
So far I have a problem with running tests. I have updated them to use purescript-spec
, but still couldn't run them in browser. Right now when I open test/test.html
I get this error:
TypeError: undefined is not an object (evaluating '$foreign.process.stdout.isTTY')
I'd appreciate any hints, since I'm new to PureScript.
Also new to purescript, but hopefully this will be of some vague use. Looks like something in the browser is expecting certain nodejs properties to be available - isTTY
is a property on the nodejs global process.stdout object. Not sure what exactly is expecting it to be there though!
purescript-spec
has a dependency on purescript-node-process
which adds types for it, so could be that? Looks like you might need to run the tests with mocha/karma for purescript-spec to behave as expected, rather than just opening the tests in a browser window.
Thanks for taking the time to take a look at this btw :)
Had a little go at this myself. No luck getting the spec tests to run unfortunately, but I switched back to the quickcheck ones and got those running ok (although maybe you did too? :) ) - only one failure which I haven't investigated yet.
The changes I made are here: https://github.com/actionshrimp/purescript-simple-dom/commit/caad64f42aedab5971196dfacd83d33b69892343
And I ran:
pulp browserify --main Test.Main -I test --standalone runTests > test/test-main.js
to generate the test bundle. Then had to call runTests.main()();
in the html file (- not sure why leaving --standalone ..
off didn't work, it seemed to call the outer main function but not the __do
function inside?)
Would love to see this get more attention and help. Wish I could offer it myself!
Hi! Maybe I could help (original author of purescript-spec). Not sure really what's going on here, but at a quick glance I see you're using the standard runner, which is for NodeJS, but it seems you are manipulating the DOM and need to run tests in a browser. Correct? In that case you should try https://github.com/owickstrom/purescript-spec-mocha instead, which bypasses the Node stuff and runs tests using the Mocha API.