New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hermione

Package Overview
Dependencies
Maintainers
2
Versions
401
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hermione - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 0.5.1 - 2016-02-18
* Fixed `NoSessionIdError` in parallel run
## 0.5.0 - 2016-02-17

@@ -2,0 +6,0 @@ * Plugin support added

73

lib/runner/mocha-runner/index.js
'use strict';
var MochaAdapter = require('./mocha-adapter'),
ProxyReporter = require('./proxy-reporter'),
utils = require('q-promise-utils'),
logger = require('../../utils').logger,
QEmitter = require('qemitter'),

@@ -16,3 +14,2 @@

this._browserAgent = browserAgent;
this._browser = null;
},

@@ -31,68 +28,10 @@

_createMocha: function(suiteFile, filterFn) {
var mocha = new MochaAdapter(this._sharedMochaOpts);
mocha.addFile(suiteFile);
this._attachBrowser(mocha.suite);
this._attachTestFilter(mocha.suite, filterFn);
this._listenMochaEvents(mocha);
return mocha;
},
_attachBrowser: function(suite) {
var _this = this,
savedEnableTimeouts = suite.enableTimeouts();
suite.enableTimeouts(false);
suite.beforeAll(function() {
return _this._browserAgent.getBrowser()
.then(function(browser) {
_this._browser = browser;
suite.ctx.browser = browser.publicAPI;
});
});
suite.afterAll(function() {
return _this._browser
&& _this._browserAgent.freeBrowser(_this._browser)
.catch(function(e) {
logger.warn('WARNING: can not release browser: ' + e);
});
}.bind(this));
suite.enableTimeouts(savedEnableTimeouts);
},
_attachTestFilter: function(suite, shouldRunTest) {
var browser = this._browserAgent.browserId;
listenSuite_(suite);
function listenSuite_(suite) {
suite.on('suite', listenSuite_);
suite.on('test', filterTest_);
}
function filterTest_(test) {
if (!shouldRunTest(test, browser)) {
test.parent.tests.pop();
}
}
},
getBrowser: function() {
return this._browser;
},
_listenMochaEvents: function(mocha, getBrowser) {
mocha.reporter(ProxyReporter, {
browserId: this._browserAgent.browserId,
getBrowser: this.getBrowser.bind(this),
emit: this.emit.bind(this)
});
return new MochaAdapter(this._sharedMochaOpts, this._browserAgent)
.addFile(suiteFile)
.attachTestFilter(filterFn)
.attachEmitFn(this.emit.bind(this));
}
}, {
create: function(config, browser) {
return new MochaRunner(config, browser);
create: function(config, browserAgent) {
return new MochaRunner(config, browserAgent);
}

@@ -99,0 +38,0 @@ });

'use strict';
var inherit = require('inherit'),
var ProxyReporter = require('./proxy-reporter'),
logger = require('../../utils').logger,
inherit = require('inherit'),
Mocha = require('mocha'),

@@ -15,6 +17,10 @@ path = require('path'),

module.exports = inherit({
__constructor: function(opts) {
__constructor: function(opts, browserAgent) {
this._mocha = new Mocha(opts);
this._mocha.fullTrace();
this.suite = this._mocha.suite;
this._browserAgent = browserAgent;
this._browser = null;
this._attachBrowser();
},

@@ -27,8 +33,64 @@

this._mocha.files = [];
return this;
},
reporter: function(reporter, opts) {
this._mocha.reporter(reporter, opts);
_attachBrowser: function() {
var savedEnableTimeouts = this.suite.enableTimeouts();
this.suite.enableTimeouts(false);
this.suite.beforeAll(this._requestBrowser.bind(this));
this.suite.afterAll(this._freeBrowser.bind(this));
this.suite.enableTimeouts(savedEnableTimeouts);
},
_requestBrowser: function() {
return this._browserAgent.getBrowser()
.then(function(browser) {
this._browser = browser;
this.suite.ctx.browser = browser.publicAPI;
}.bind(this));
},
_freeBrowser: function() {
return this._browser
&& this._browserAgent.freeBrowser(this._browser)
.catch(function(e) {
logger.warn('WARNING: can not release browser: ' + e);
});
},
attachTestFilter: function(shouldRunTest) {
var browser = this._browserAgent.browserId;
listenSuite_(this.suite);
return this;
function listenSuite_(suite) {
suite.on('suite', listenSuite_);
suite.on('test', filterTest_);
}
function filterTest_(test) {
if (!shouldRunTest(test, browser)) {
test.parent.tests.pop();
}
}
},
attachEmitFn: function(emit) {
this._mocha.reporter(ProxyReporter, {
getBrowser: this._getBrowser.bind(this),
emit: emit
});
return this;
},
_getBrowser: function() {
return this._browser || {id: this._browserAgent.browserId};
},
run: function() {

@@ -35,0 +97,0 @@ return q.Promise(this._mocha.run.bind(this._mocha));

@@ -24,3 +24,2 @@ 'use strict';

this._getBrowser = options.reporterOptions.getBrowser;
this._browserId = options.reporterOptions.browserId;

@@ -90,6 +89,6 @@ this._listenEvents(runner);

return _.extend(data, {
sessionId: browser && browser.sessionId,
browserId: this._browserId
sessionId: browser.sessionId,
browserId: browser.id
});
}
});
{
"name": "hermione",
"version": "0.5.0",
"version": "0.5.1",
"description": "Tests framework based on mocha and wdio",

@@ -5,0 +5,0 @@ "main": "lib/hermione.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc