You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phantomjs/data/slide/260-jasmine-test-runner.md

20 lines
652 B
Markdown

# Testing
```javascript
10 years ago
phantom.injectJs('../../vendor/jasmine/lib/jasmine-core/jasmine.js');
var consoleFns = require('../../vendor/jasmine/lib/console/console.js');
var jasmine = jasmineRequire.core(jasmineRequire);
consoleFns.console(consoleFns, jasmine);
var globals = jasmineRequire.interface(jasmine, jasmine.getEnv());
for (var property in globals) this[property] = globals[property];
jasmine.getEnv().addReporter(new jasmine.ConsoleReporter({
print: function print(msg) { console.log(msg); },
onComplete: function exit(success) { phantom.exit(success ? 0 : 1); }
}));
phantom.injectJs('./some-test.js');
jasmine.getEnv().execute();
```