Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Last active November 15, 2015 18:52
Show Gist options
  • Save amitaibu/156236d28adddf1c1f16 to your computer and use it in GitHub Desktop.
Save amitaibu/156236d28adddf1c1f16 to your computer and use it in GitHub Desktop.
var jsdom = require("jsdom");
jsdom.env({
html: "<html><body></body></html>",
done: function(errs, window) {
global.window = window;
module.exports =
(function(){
window = {Date: Date};
if (typeof Elm === undefined) { throw "elm-io config error: Elm is not defined. Make sure you call elm-io with a real Elm output file"}
if (typeof Elm.Main === undefined ) { throw "Elm.Main is not defined, make sure your module is named Main." };
var worker = Elm.worker(Elm.Main);
})();
}
});
npm install jsdom
# You may need to adapt the path of the TestRunner
elm-make ./src/elm/TestRunner.elm --output tests.js
curl https://gist.githubusercontent.com/amitaibu/156236d28adddf1c1f16/raw/ebef859fa441f7fc05ae242bf854430c47e5b586/add_jsdom.js > add_jsdom.js
cat add_jsdom.js >> tests.js
# Run the tests
node ./tests.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment