Socket
Socket
Sign inDemoInstall

testee-client

Package Overview
Dependencies
41
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0-pre.5 to 0.4.0-pre.6

11

package.json
{
"name": "testee-client",
"version": "0.4.0-pre.5",
"version": "0.4.0-pre.6",
"description": "Testee testing framework client adapters",

@@ -50,3 +50,6 @@ "main": "src/index",

"homepage": "https://github.com/bitovi/testee-client",
"dependencies": {},
"dependencies": {
"feathers-rest": "^1.5.0",
"superagent": "^2.3.0"
},
"devDependencies": {

@@ -56,2 +59,3 @@ "chai": "^3.5.0",

"feathers": "^2.0.1",
"feathers-client": "^1.6.1",
"feathers-socketio": "^1.4.1",

@@ -70,5 +74,4 @@ "grunt": "^1.0.1",

"steal": "^1.0.0-rc.3",
"steal-tools": "^1.0.0-rc.1",
"wolfy87-eventemitter": "^5.1.0"
"steal-tools": "^1.0.0-rc.1"
}
}

@@ -5,28 +5,65 @@ # Testee client adapters

Testee client side adapters for Mocha, QUnit and Jasmine that convert test results into Feathers service socket calls (`runs`, `suites` and `tests`).
Testee client side adapters for Mocha, QUnit and Jasmine (1 and 2) that convert test results into Feathers service calls (`runs`, `suites`, `tests` and `coverages`).
## Initializing options
In you test page you can set Testee options using `window.Testee`. To report to a different server for example set:
In your test page you can set Testee options using `window.Testee`.
### BaseURL
By default, the client will use the url the tests are running at (`window.location.protocol + '//' + window.location.host`). you can change this using the `baseURL` option:
```html
<script type="text/javascript">
window.Testee = {
socket: io('http://testee-server.com/')
baseURL: 'http://testee-server.com/'
}
</script>
<script type="text/javascript" src="http://testee-server.com/socket.io/socket.io.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
```
When loading files asynchronously:
### Provider
By default, the client will use socket.io to make Feathers service calls. You can change this to use REST by specifying the `provider` option:
```html
<script type="text/javascript">
window.Testee = {
autoInit: false
provider: {
type: 'rest'
}
}
</script>
<script type="text/javascript" src="testee-client.js"></script>
```
define(['testee-client', 'qunit'], function() {
window.Testee.init();
### Socket
You can provide your own socket instance to make Feathers service calls using the `socket` option:
```html
<script type="text/javascript" src="http://testee-server.com/socket.io/socket.io.js"></script>
<script type="text/javascript">
window.Testee = {
socket: io('http://testee-server.com/')
}
</script>
<script type="text/javascript" src="testee-client.js"></script>
```
## Asynchronous Loading
When loading files asynchronously, you need to stop your testing framework from running until all test files are loaded. Then call `window.Testee.init()`. If you're using [steal](https://www.npmjs.com/package/steal), you can use the [steal-mocha](https://www.npmjs.com/package/steal-mocha), [steal-qunit](https://www.npmjs.com/package/steal-qunit) or [steal-jasmine](https://www.npmjs.com/package/steal-jasmine) libraries.
### Mocha
```html
<script type="text/javascript" src="//best/cdn/ever/mocha/mocha.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
mocha.run();
});

@@ -36,2 +73,35 @@ </script>

### QUnit
```html
<script type="text/javascript" src="//best/cdn/ever/qunit.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
QUnit.config.autorun = false;
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
QUnit.load();
});
</script>
```
### Jasmine
```html
<script type="text/javascript" src="//best/cdn/ever/jasmine/jasmine.js"></script>
<script type="text/javascript" src="//best/cdn/ever/jasmine/jasmine-html.js"></script>
<script type="text/javascript" src="//best/cdn/ever/jasmine/boot.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
window.onload();
});
</script>
```
## A test flow:

@@ -38,0 +108,0 @@

@@ -7,3 +7,3 @@ var _ = {

var TesteeReporter = function (runner) {
var TesteeReporter = function(runner) {
this.runner = runner;

@@ -20,3 +20,3 @@ this.suites = {};

id: function(obj, id) {
if(obj[id]) {
if (obj[id]) {
return obj[id];

@@ -28,3 +28,3 @@ }

reportRunnerStarting: function () {
reportRunnerStarting: function() {
var id = this.runId = guid();

@@ -39,3 +39,3 @@ this.runner.start({

reportRunnerResults: function () {
reportRunnerResults: function() {
this.runner.end({

@@ -49,3 +49,3 @@ id: this.runId,

reportSpecResults: function (spec) {
reportSpecResults: function(spec) {
if (spec.results_.failedCount) {

@@ -77,3 +77,3 @@ var message = spec.results_.items_[0].message;

startSuite: function (suite) {
startSuite: function(suite) {
if (suite.parentSuite !== null) {

@@ -96,3 +96,3 @@ if (!suite.parentSuite.started) {

id: this.id(this.suites, suite.id),
parent: this.runId
parent: this.runId
});

@@ -104,3 +104,3 @@ }

reportSpecStarting: function (spec) {
reportSpecStarting: function(spec) {
if (!spec.suite.started) {

@@ -120,3 +120,3 @@ this.startSuite(spec.suite);

reportSuiteResults: function (suite) {
reportSuiteResults: function(suite) {
if (suite.started) {

@@ -130,6 +130,6 @@ this.runner.suiteEnd({

module.exports = function (jasmine, runner) {
module.exports = function(jasmine, runner) {
jasmine.getEnv().addReporter(new TesteeReporter(runner));
};
module.exports.Reporter = TesteeReporter;
module.exports.Reporter = TesteeReporter;
var _ = {
extend: require('lodash/assign'),
noop: require('lodash/noop'),
each: require('lodash/each'),
bind: require('lodash/bind'),
indexOf: require('lodash/indexOf'),
clone: require('lodash/clone')
extend: require('lodash/assign'),
noop: require('lodash/noop'),
each: require('lodash/each'),
bind: require('lodash/bind'),
indexOf: require('lodash/indexOf'),
clone: require('lodash/clone')
};

@@ -66,3 +66,3 @@ var guid = require('./../guid');

var diff = self.diff(data);
if(data.root) {
if (data.root) {
diff.parent = self.runId;

@@ -99,8 +99,8 @@ }

var isPrivate = key.indexOf('_') === 0 || key.indexOf('$') === 0;
if(typeof value === 'object' && !isPrivate) {
if (typeof value === 'object' && !isPrivate) {
var idx = _.indexOf(self.ids, value);
if(!!~idx) {
if (!!~idx) {
result[key] = self.uuids[idx];
}
} else if(typeof value !== 'function' && !isPrivate && value !== undefined) {
} else if (typeof value !== 'function' && !isPrivate && value !== undefined) {
result[key] = value;

@@ -118,3 +118,3 @@ }

if(!~idx) {
if (!~idx) {
idx = self.ids.push(obj) - 1;

@@ -125,3 +125,3 @@ self.uuids[idx] = guid();

_.each(current, function(value, key) {
if(self.last[idx][key] !== value) {
if (self.last[idx][key] !== value) {
result[key] = value;

@@ -144,2 +144,2 @@ }

module.exports.Reporter = TesteeReporter;
module.exports.Reporter = TesteeReporter;
var guid = require('./../guid');
module.exports = function (QUnit, Runner, win) {
module.exports = function(QUnit, Runner, win) {
var suites = []; // Contains all currently active suites (nested)
// Returns the id of the currently active test suite (last one pushed)
var suiteId = function () {
var suiteId = function() {
return suites[suites.length - 1];
};
var endSuite = function () {
Runner.suiteEnd({
id: suiteId()
});
suites.pop();
};
var endSuite = function() {
Runner.suiteEnd({
id: suiteId()
});
suites.pop();
};
var runId = guid();

@@ -21,3 +21,3 @@

QUnit.begin(function () {
QUnit.begin(function() {
var titleEl = win.document.getElementsByTagName('title')[0] || document.getElementsByTagName('h1')[0];

@@ -39,3 +39,3 @@ var suite = guid();

id: suite,
parent: runId
parent: runId
});

@@ -46,3 +46,3 @@

QUnit.moduleStart(function (data) {
QUnit.moduleStart(function(data) {
var id = guid();

@@ -58,3 +58,3 @@

QUnit.moduleDone(function (data) {
QUnit.moduleDone(function(data) {
Runner.suiteEnd({

@@ -68,3 +68,3 @@ failed: data.failed,

QUnit.testStart(function (data) {
QUnit.testStart(function(data) {
var id = guid();

@@ -82,3 +82,3 @@

QUnit.log(function (data) {
QUnit.log(function(data) {
var testId = guid();

@@ -117,5 +117,5 @@ var errorMessage = '';

QUnit.done(function (data) {
QUnit.done(function(data) {
data.id = runId;
endSuite();
endSuite();
Runner.end(data);

@@ -125,2 +125,2 @@ });

return QUnit;
};
};

@@ -7,3 +7,3 @@ var domReadyCallback = function() {};

$.isReady = false;
if(typeof callback === "function") {
if (typeof callback === "function") {
domReadyCallback = callback;

@@ -19,3 +19,3 @@ }

var DOMContentLoaded = function() {
if(doc.addEventListener) {
if (doc.addEventListener) {
doc.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);

@@ -33,5 +33,5 @@ } else {

// Make sure that the DOM is not already loaded
if(!$.isReady) {
if (!$.isReady) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if(!doc.body) {
if (!doc.body) {
return setTimeout(domReady, 1);

@@ -50,3 +50,3 @@ }

if(readyBound) {
if (readyBound) {
return;

@@ -58,3 +58,3 @@ }

// browser event has already occurred.
if(doc.readyState !== "loading") {
if (doc.readyState !== "loading") {
domReady();

@@ -64,3 +64,3 @@ }

// Mozilla, Opera and webkit nightlies currently support this event
if(doc.addEventListener) {
if (doc.addEventListener) {
// Use the handy event callback

@@ -71,3 +71,3 @@ doc.addEventListener("DOMContentLoaded", DOMContentLoaded, false);

// If IE event model is used
} else if(doc.attachEvent) {
} else if (doc.attachEvent) {
// ensure firing before onload,

@@ -82,5 +82,4 @@ // maybe late but safe also for iframes

toplevel = window.frameElement == null;
} catch(e) {
}
if(doc.documentElement.doScroll && toplevel) {
} catch (e) {}
if (doc.documentElement.doScroll && toplevel) {
doScrollCheck();

@@ -93,3 +92,3 @@ }

var doScrollCheck = function() {
if($.isReady) {
if ($.isReady) {
return;

@@ -101,3 +100,3 @@ }

doc.documentElement.doScroll("left");
} catch(error) {
} catch (error) {
setTimeout(doScrollCheck, 1);

@@ -113,2 +112,2 @@ return;

module.exports = $;
module.exports = $;

@@ -7,3 +7,4 @@ var md5 = require('md5');

var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
var r = Math.random() * 16 | 0,
v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);

@@ -16,2 +17,2 @@ });

return md5(guid + navigator.useragent);
};
};
require('core-js/client/core');
var _ = {
defaults: require('lodash/defaults'),
delay: require('lodash/delay')
defaults: require('lodash/defaults'),
delay: require('lodash/delay')
};
var feathers = require('feathers/client');
var rest = require('feathers-rest/client');
var superagent = require('superagent/lib/client');
var io = require('socket.io-client/socket.io');
var feathers = require('feathers/client');
var socketio = require('feathers-socketio/client');

@@ -20,6 +22,13 @@

var options = window.Testee = window.Testee || {};
options.baseURL = options.baseURL || window.location.protocol + '//' + window.location.host;
if(!options.app) {
options.socket = options.socket || io();
options.app = feathers().configure(socketio(options.socket));
if(options.provider && options.provider.type === 'rest') {
var restService = rest(options.baseURL).superagent(superagent);
options.app = feathers().configure(restService);
} else {
options.socket = options.socket || io(options.baseURL);
options.app = feathers().configure(socketio(options.socket));
}
}

@@ -37,3 +46,3 @@

runner: function() {
if(!this._runner) {
if (!this._runner) {
this._runner = Runner(options);

@@ -46,3 +55,3 @@ }

return window.QUnit || (window.jasmine && window.jasmine.version_ && window.jasmine.version_.major === 1) ||
(window.jasmine && window.jasmine.version && window.jasmine.version.split('.')[0] === '2') || (window.mocha && window.Mocha);
(window.jasmine && window.jasmine.version && window.jasmine.version.split('.')[0] === '2') || (window.mocha && window.Mocha);
},

@@ -93,3 +102,3 @@

if(!options.socket.connected) {
if (options.socket && !options.socket.connected) {
options.socket.on('connect', done);

@@ -102,5 +111,5 @@ } else {

if(options.canInitialize()) {
if (options.canInitialize()) {
options.init();
}
});
});

@@ -1,7 +0,11 @@

var _ = { toArray: require('lodash/toArray') };
var _ = {
toArray: require('lodash/toArray')
};
module.exports = function (options) {
var file = { file: window.location.toString() };
module.exports = function(options) {
var file = {
file: window.location.toString()
};
return Object.assign({
return Object.assign({
call: function(path, method) {

@@ -18,3 +22,3 @@ var args = _.toArray(arguments).slice(2);

args.push(function(error, data) {
if(error) {
if (error) {
reject(data);

@@ -32,63 +36,73 @@ } else {

start: function (data) {
data = Object.assign({
start: function(data) {
data = Object.assign({
status: 'running'
}, file, data);
this.call('runs', 'create', data);
},
},
suite: function (data) {
data = Object.assign({
suite: function(data) {
data = Object.assign({
status: 'running'
}, file, data);
this.call('suites', 'create', data);
},
this.call('suites', 'create', data);
},
test: function (data) {
test: function(data) {
data = Object.assign({}, file, data);
this.call('tests', 'create', data);
},
this.call('tests', 'create', data);
},
pending: function (data) {
data = Object.assign({ status: 'pending' }, file, data);
this.call('tests', 'create', data);
},
pending: function(data) {
data = Object.assign({
status: 'pending'
}, file, data);
this.call('tests', 'create', data);
},
pass: function (data) {
data = Object.assign({ status: 'passed' }, data);
this.call('tests', 'patch', data.id, data);
},
pass: function(data) {
data = Object.assign({
status: 'passed'
}, data);
this.call('tests', 'patch', data.id, data);
},
fail: function (data) {
data = Object.assign({ status: 'failed' }, data);
this.call('tests', 'patch', data.id, data);
},
fail: function(data) {
data = Object.assign({
status: 'failed'
}, data);
this.call('tests', 'patch', data.id, data);
},
testEnd: function () {},
testEnd: function() {},
suiteEnd: function (data) {
data = Object.assign({ status: 'finished' }, data);
this.call('suites', 'patch', data.id, data);
},
suiteEnd: function(data) {
data = Object.assign({
status: 'finished'
}, data);
this.call('suites', 'patch', data.id, data);
},
end: function (data) {
data = Object.assign({ status: 'finished' }, data);
end: function(data) {
data = Object.assign({
status: 'finished'
}, data);
var socket = this.socket;
if (window.__coverage__ && this.coverages) {
this.call('coverages', 'create', {
id: data.id,
if (window.__coverage__ && this.coverages) {
this.call('coverages', 'create', {
id: data.id,
run: data,
coverage: window.__coverage__
});
}
coverage: window.__coverage__
});
}
this.call('runs', 'patch', data.id, data).then(function() {
if(typeof socket.disconnect === 'function') {
this.call('runs', 'patch', data.id, data).then(function() {
if (socket && typeof socket.disconnect === 'function') {
socket.disconnect();
}
});
}
}, options);
};
}
}, options);
};
// Recursively compares if an actual object has the same properties
var compare = window.compare = function (reference, actual, name) {
var compare = window.compare = function(reference, actual, name) {
var expected, current;
for(var key in reference) {
for (var key in reference) {
expected = reference[key];
current = actual[key];
if(expected instanceof RegExp) {
if (expected instanceof RegExp) {
ok(expected.test(current), name + ': ' + current + ' matches ' + expected.toString());
} else if(typeof reference[key] === 'object') {
} else if (typeof reference[key] === 'object') {
compare(expected, current, name + ' ' + key);

@@ -15,40 +15,39 @@ } else {

}
}
}
};
window.walkExpected = function(expected, socket) {
var index = 0;
window.getTesteeOptions = function(name, expected) {
// Create a client-side service that checks that the proper calls are happening
var index = 0;
var app = window.feathers();
var check = function(name, data, cb) {
var current = expected[index];
// This one goes through all the expected events, binds once to the fake Socket
// and checks if the object we got from the test is the same as the one we expect
return function expectNext() {
var current = expected[index];
compare(current.data, data, current.name);
socket.once(current.name, function(data, other) {
var callback = arguments[arguments.length - 1];
cb(null, data);
// move data for patch requests which pass the id first
if(typeof data === 'string') {
data = other;
}
compare(current.data, data, current.name);
callback(null, data);
if(++index === expected.length) {
return start();
}
expectNext();
});
};
};
window.getTesteeOptions = function(name) {
if (++index === expected.length) {
start();
}
};
var expectationService = function(name) {
return {
create: function(data, params, cb) {
check(name + '::create', data, cb);
},
patch: function(id, data, params, cb) {
check(name + '::patch', data, cb);
}
};
};
app.use('api/runs', expectationService('api/runs'));
app.use('api/suites', expectationService('api/suites'));
app.use('api/tests', expectationService('api/tests'));
app.use('api/coverages', expectationService('api/coverages'));
var options = window.Testee[name] = {
socket: new window.EventEmitter()
app: app
};
options.socket.connected = true;
return options;
};
};

@@ -1,124 +0,108 @@

(function (window, undefined) {
var options = window.getTesteeOptions('Jasmine1');
(function(window, undefined) {
module('Jasmine 1.x adapter test');
var expected = [
{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Jasmine",
"file": /jasmine-1\/jasmine\.html/
var expected = [{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Jasmine",
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"root": true,
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Fails",
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected false to be truthy."
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"root": true,
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"file": /jasmine-1\/jasmine\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Test ran!"
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Jasmine coverage"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /jasmine-1\/jasmine\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Fails",
"file": /jasmine-1\/jasmine\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected false to be truthy."
}
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"file": /jasmine-1\/jasmine\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"file": /jasmine-1\/jasmine\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Test ran!"
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Jasmine coverage"
}
}
},
{
"name": "api/runs::patch",
"data": {
"failed": 1,
"passed": 1,
"status": "finished",
"total": 2
}
}
];
}, {
"name": "api/runs::patch",
"data": {
"failed": 1,
"passed": 1,
"status": "finished",
"total": 2
}
}];
test('runs the Jasmine test and writes expected data to socket', function () {
window.getTesteeOptions('Jasmine1', expected);
test('runs the Jasmine test and writes expected data', function() {
// Insert the iframe with the test
var iframe = document.createElement('iframe');
var walker = window.walkExpected(expected, options.socket);

@@ -129,4 +113,3 @@ iframe.src = 'jasmine-1/jasmine.html';

stop();
walker();
});
})(this);

@@ -1,4 +0,4 @@

describe('Test module', function () {
describe('Test module', function() {
describe('It does something', function () {
describe('It does something', function() {
xit('Skipped test', function() {

@@ -15,3 +15,3 @@ expect(false).toBeTruthy();

describe('Nested suite', function() {
it('Test ran!', function () {
it('Test ran!', function() {
expect(true).toBeTruthy();

@@ -22,2 +22,2 @@ });

});
});

@@ -1,131 +0,114 @@

(function (window, undefined) {
var options = window.getTesteeOptions('Jasmine');
(function(window, undefined) {
module('Jasmine 2.x adapter test');
var expected = [
{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Jasmine",
"file": /jasmine\/jasmine\.html/
var expected = [{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Jasmine",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"root": true,
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Skipped test",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Fails",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected false to be truthy."
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"root": true,
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"file": /jasmine\/jasmine\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Test ran!"
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Jasmine coverage"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /jasmine\/jasmine\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Skipped test",
"file": /jasmine\/jasmine\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Fails",
"file": /jasmine\/jasmine\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected false to be truthy."
}
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"file": /jasmine\/jasmine\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"file": /jasmine\/jasmine\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Test ran!"
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Jasmine coverage"
}
}
},
{
"name": "api/runs::patch",
"data": {
"failed": 1,
"passed": 1,
"status": "finished",
"total": 2
}
}
];
}, {
"name": "api/runs::patch",
"data": {
"failed": 1,
"passed": 1,
"status": "finished",
"total": 2
}
}];
test('runs the Jasmine test and writes expected data to socket', function () {
window.getTesteeOptions('Jasmine', expected);
test('runs the Jasmine test and writes expected data', function() {
// Insert the iframe with the test
var iframe = document.createElement('iframe');
var walker = window.walkExpected(expected, options.socket);

@@ -136,4 +119,3 @@ iframe.src = 'jasmine/jasmine.html';

stop();
walker();
});
})(this);

@@ -1,4 +0,4 @@

describe('Test module', function () {
describe('Test module', function() {
describe('It does something', function () {
describe('It does something', function() {
xit('Skipped test', function() {

@@ -15,3 +15,3 @@ expect(false).toBeTruthy();

describe('Nested suite', function() {
it('Test ran!', function () {
it('Test ran!', function() {
expect(true).toBeTruthy();

@@ -22,2 +22,2 @@ });

});
});
(function(window, undefined) {
var options = window.getTesteeOptions('Mocha');
module('Mocha adapter test');
var expected = [
{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Mocha",
"file": /mocha\/mocha\.html/
var expected = [{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "Mocha",
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "",
"pending": false,
"root": true,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Skipped test",
"sync": true,
"timedOut": false,
"pending": true,
"type": "test",
"status": "pending",
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Fails",
"async": 0,
"sync": true,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "failed",
"state": "failed",
"err": {
"message": "expected false to equal true"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "",
"pending": false,
"root": true,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Test ran!",
"async": 0,
"sync": true,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed",
"duration": 0,
"state": "passed"
}
}, {
"name": "api/tests::create",
"data": {
"title": "Runs async",
"async": 1,
"sync": false,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed",
"state": "passed"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Mocha coverage"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Skipped test",
"sync": true,
"timedOut": false,
"pending": true,
"type": "test",
"status": "pending",
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Fails",
"async": 0,
"sync": true,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "failed",
"state": "failed",
"err": {
"message": "expected false to equal true"
}
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Some other suite",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Nested suite",
"pending": false,
"root": false,
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Test ran!",
"async": 0,
"sync": true,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed",
"duration": 0,
"state": "passed"
}
},
{
"name": "api/tests::create",
"data": {
"title": "Runs async",
"async": 1,
"sync": false,
"timedOut": false,
"pending": false,
"type": "test",
"file": /mocha\/mocha\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed",
"state": "passed"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Mocha coverage"
}
}
},
{
"name": "api/runs::patch",
"data": {
"status": "finished",
"total": 4,
"failed": 1,
"pending": 1,
"passed": 2
}
}
];
}, {
"name": "api/runs::patch",
"data": {
"status": "finished",
"total": 4,
"failed": 1,
"pending": 1,
"passed": 2
}
}];
test('runs the Mocha test and writes expected data to socket', function() {
window.getTesteeOptions('Mocha', expected);
test('runs the Mocha test and writes expected data', function() {
// Insert the iframe with the test
var iframe = document.createElement('iframe');
var walker = window.walkExpected(expected, options.socket);

@@ -198,4 +177,3 @@ iframe.src = 'mocha/mocha.html';

stop();
walker();
});
})(this);
})(this);

@@ -1,4 +0,4 @@

describe('Test module', function () {
describe('Test module', function() {
describe('It does something', function () {
describe('It does something', function() {
it.skip('Skipped test', function() {

@@ -15,3 +15,3 @@ expect(false).to.equal(true);

describe('Nested suite', function() {
it('Test ran!', function () {
it('Test ran!', function() {
expect(true).to.equal(true);

@@ -18,0 +18,0 @@ });

@@ -1,167 +0,145 @@

(function (window, undefined) {
var options = window.getTesteeOptions('QUnit');
(function(window, undefined) {
module('QUnit adapter test');
var expected = [
{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "QUnit",
"file": /qunit\/qunit\.html/
var expected = [{
"name": "api/runs::create",
"data": {
"status": "running",
"environment": navigator.userAgent,
"runner": "QUnit",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "QUnit example",
"root": true,
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "A failing test",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "This test should fail",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected B but was A"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "QUnit example",
"root": true,
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Test ran!",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished",
"failed": 1,
"total": 2
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Other module",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something async",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::create",
"data": {
"title": "Async test ran!",
"file": /qunit\/qunit\.html/
}
}, {
"name": "api/tests::patch",
"data": {
"status": "passed"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished"
}
}, {
"name": "api/suites::patch",
"data": {
"status": "finished",
"failed": 0,
"total": 1
}
}, {
"name": "api/suites::patch"
}, {
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Qunit coverage"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Test module",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "A failing test",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "This test should fail",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "failed",
"err": {
"message": "Expected B but was A"
}
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Test ran!",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished",
"failed": 1,
"total": 2
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "Other module",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/suites::create",
"data": {
"status": "running",
"title": "It does something async",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::create",
"data": {
"title": "Async test ran!",
"file": /qunit\/qunit\.html/
}
},
{
"name": "api/tests::patch",
"data": {
"status": "passed"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished"
}
},
{
"name": "api/suites::patch",
"data": {
"status": "finished",
"failed": 0,
"total": 1
}
},
{
"name": "api/suites::patch"
},
{
"name": "api/coverages::create",
"data": {
coverage: {
"test": "Qunit coverage"
}
}
},
{
"name": "api/runs::patch",
"data": {
"status": "finished",
"failed": 1,
"passed": 2,
"total": 3
}
}
];
}, {
"name": "api/runs::patch",
"data": {
"status": "finished",
"failed": 1,
"passed": 2,
"total": 3
}
}];
test('runs the QUnit test and writes expected data to socket', function () {
window.getTesteeOptions('QUnit', expected);
test('runs the QUnit test and writes expected data', function() {
// Insert the iframe with the test
var iframe = document.createElement('iframe');
var walker = window.walkExpected(expected, options.socket);

@@ -172,4 +150,3 @@ iframe.src = 'qunit/qunit.html';

stop();
walker();
});
})(this);
})(this);
module('Test module');
test('A failing test', function() {
equal('A', 'B', 'This test should fail');
equal('A', 'B', 'This test should fail');
});
test('It does something', function() {
ok(true, 'Test ran!');
ok(true, 'Test ran!');
});

@@ -14,7 +14,7 @@

test('It does something async', function() {
stop();
setTimeout(function() {
ok(true, 'Async test ran!');
start();
}, 200);
});
stop();
setTimeout(function() {
ok(true, 'Async test ran!');
start();
}, 200);
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc