-
Notifications
You must be signed in to change notification settings - Fork 364
Testing
Joel Holdbrooks edited this page Mar 12, 2014
·
2 revisions
If you're planning to run tests with phantomjs
, it's important to include a polyfill for Function.prototype.bind
otherwise your tests may fail to run with an error such as:
Running ClojureScript test: phantom
TypeError: 'undefined' is not a function (evaluating 'RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
)')
Mozilla's developer website has code available here which you copy and save to a location in your project directory. You may also want check this file into source control so others can run your tests without issues.
After you've added this code to your project, you'll need to update your :test-commands
configuration to look something like the following.
:test-commands {"phantom" ["phantomjs" :runner "path/to/polyfill.js" "target/generated/js/test.js"]
Alternatively you can use slimerjs
which uses a more modern JavaScript runtime.