Skip to content

Instantly share code, notes, and snippets.

@jason0x43
Last active May 11, 2016 02:47
Show Gist options
  • Save jason0x43/b961c24aaf19ab4351f5bb559eae2bb6 to your computer and use it in GitHub Desktop.
Save jason0x43/b961c24aaf19ab4351f5bb559eae2bb6 to your computer and use it in GitHub Desktop.
Intern execute test
// tests/intern.js
define({
environments: [ { browserName: 'chrome' } ],
tunnel: 'NullTunnel',
functionalSuites: [ 'tests/functional' ],
excludeInstrumentation: /^(?:tests|node_modules)\//
});
// tests/functional.js
define([
'require',
'intern!object'
], function (
require,
registerSuite
) {
registerSuite({
name: 'test',
foo: function () {
return this.remote.get(require.toUrl('./index.html'))
.execute(function () {
return window.location;
})
.then(function (loc) {
console.log(loc);
});
}
});
});
// tests/index.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
// Run intern with `intern-runner config=tests/intern`
//
// Output should look like:
//
// ~/T/intern-execute ❯ intern-runner config=tests/intern
// Listening on 0.0.0.0:9000
// Tunnel started
// ‣ Created session chrome on any platform (bcb7523c-149e-4327-a1d8-3b1a551ba781)
// { origin: 'http://localhost:9000',
// replace: {},
// ancestorOrigins: [],
// pathname: '/tests/index.html',
// hostname: 'localhost',
// protocol: 'http:',
// search: '',
// reload: {},
// port: '9000',
// host: 'localhost:9000',
// href: 'http://localhost:9000/tests/index.html',
// hash: '',
// assign: {} }
// ✓ chrome on any platform - test - foo (0.294s)
// No unit test coverage for chrome on any platform
// chrome on any platform: 0/1 tests failed
//
// TOTAL: tested 1 platforms, 0/1 tests failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment