Socket
Socket
Sign inDemoInstall

nemo

Package Overview
Dependencies
276
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.11.1 to 4.12.0

test/lifecycle-per-test.js

3

.eslintrc.js
module.exports = {
"env": {
"node": true,
"es6": true
"es6": true,
"mocha": true
},

@@ -6,0 +7,0 @@

@@ -0,1 +1,16 @@

## 4.12.0
### Breaking Changes
- Updated `chromedriver` dependency to version 81, which requires Node 10
- Updated minimum requirement to `Node 10` from `Node 8`
### Fix
- Instantiate and injects `nemo` into context on the global `beforeEach` hook when `driverPerTest` is `true`
- Updated dependency to Mocha 7.1.1 since that is the version that fixes start event firing too early, before it can be monitored. https://github.com/mochajs/mocha/issues/2753
### Feature
- Added `before:root` event
## 4.11.1

@@ -2,0 +17,0 @@

@@ -22,4 +22,3 @@ var Table = require('cli-table');

console.log(table.toString());
let zeroExitCode = context.config.get('profiles:base:zeroExitCode') || false
let zeroExitCode = context.config.get('profiles:base:zeroExitCode') || false;
process.exitCode = zeroExitCode ? 0 : Math.min(output.totals.fail, 255);

@@ -26,0 +25,0 @@ if (context.program.exit) {

@@ -57,7 +57,11 @@ 'use strict';

if (this.nemo) {
return this.nemo && this.nemo.driver && this.nemo.driver.quit()
.then(function () {
log('destroyNemo: Quit driver');
return Promise.resolve();
});
if (this.nemo.driver) {
log('Quitting nemo driver instance');
return this.nemo.driver.quit()
.then(function () {
log('destroyNemo: Quit driver');
return Promise.resolve();
});
}
log('Nemo instance does not have a driver to quit');
}

@@ -81,8 +85,27 @@ }

function beforeRun() {
const Root = runner.suite;
runnerConfig.emitter.emit('root:before');
log('beforeRun called');
if (instanceConfig.profile.conf.driverPerTest) {
log('driverPerTest %s', instanceConfig.profile.conf.driverPerTest);
Root.beforeEach(function () {
return createNemo()
.then(bindNemo.bind(this));
});
if (Root._beforeEach.length > 0) {
Root._beforeEach.unshift(Root._beforeEach.pop());
}
Root.afterEach(destroyNemo);
return;
}
}
function beforeSuite(Suite) {
runnerConfig.emitter.emit('suite:before');
log('suite event, suite %s, root: %s', Suite.title, Suite.root);
if (instanceConfig.profile.conf.driverPerTest) {
log('driverPerTest %s', instanceConfig.profile.conf.driverPerTest);
Suite.beforeEach(function () {
if (!instanceConfig.profile.conf.driverPerTest) {
Suite.beforeAll(function () {
if (Suite.tests.length > 0) {

@@ -94,28 +117,13 @@ return createNemo()

});
if (Suite._beforeEach.length > 0) {
Suite._beforeEach.unshift(Suite._beforeEach.pop());
if (Suite._beforeAll.length > 0) {
// add nemo's beforeAll to the FRONT of the beforeAll array
Suite._beforeAll.unshift(Suite._beforeAll.pop());
}
Suite.afterEach(destroyNemo);
return;
}
// createNemo beforeAll (one nemo per suite)
Suite.beforeAll(function () {
if (Suite.tests.length > 0) {
return createNemo()
.then(bindNemo.bind(this));
}
return;
});
if (Suite._beforeAll.length > 0) {
// add nemo's beforeAll to the FRONT of the beforeAll array
Suite._beforeAll.unshift(Suite._beforeAll.pop());
// afterAll, kill nemo
Suite.afterAll(destroyNemo);
}
// afterAll, kill nemo
Suite.afterAll(destroyNemo);
}
function afterSuite(Evt) {

@@ -147,3 +155,3 @@ runnerConfig.emitter.emit('suite');

let testCircularSafe = prepareTestResult(test);
runnerConfig.emitter.emit('test:before', testCircularSafe)
runnerConfig.emitter.emit('test:before', testCircularSafe);
}

@@ -196,2 +204,3 @@ function afterEachTest(test, err) {

runner = mocha.run(afterMocha);
runner.on('start', beforeRun);
runner.on('test', beforeEachTest);

@@ -202,2 +211,3 @@ runner.on('pass', afterEachTest);

runner.on('suite end', afterSuite);
return mochaCompletePromise;

@@ -204,0 +214,0 @@ }

{
"name": "nemo",
"version": "4.11.1",
"version": "4.12.0",
"description": "Wrapper to run mocha suites with injected selenium-webdriver instance",

@@ -25,3 +25,4 @@ "scripts": {

"nemo:scaffold": "./bin/nemo -B scaffold -P pay,search,form",
"lint": "eslint ./bin/* ./lib/*"
"lint": "eslint ./bin/* ./lib/*",
"reset": "rm -rf node_modules && npm install"
},

@@ -60,3 +61,3 @@ "repository": {

"cli-table": "^0.3.1",
"commander": "^3.0.0",
"commander": "^4.0.0",
"common-path-start": "0.0.4",

@@ -75,5 +76,5 @@ "debug": "^4.1.1",

"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^6.1.4",
"mochawesome": "^4.0.1",
"mkdirp": "^1.0.0",
"mocha": "^7.1.1",
"mochawesome": "^5.0.0",
"moment": "^2.22.2",

@@ -83,7 +84,7 @@ "nemo-core": "^1.1.3",

"threads": "^0.12.1",
"uuid": "^3.3.2",
"yargs": "^14.0.0"
"uuid": "^7.0.0",
"yargs": "^15.0.1"
},
"devDependencies": {
"chromedriver": "^77.0.0",
"chromedriver": "^83.0.0",
"eslint": "^6.0.1",

@@ -90,0 +91,0 @@ "eslint-plugin-es6-recommended": "^0.1.2"

@@ -309,3 +309,3 @@ # nemo

`nemo` creates `mocha` instances programmatically. Unfortunately, not all `mocha` command line options are available when instantiating it this way. One of the arguments that is **not** supported is the `--require` flag, which useful if you want to `require` a module, e.g. `babel-register` for transpilation. Thus, we added a `"require"` property in `config.json`, which takes a string of a single npm module name, or an array of npm module names. If it is an array, `nemo` will `require` each one before instantiating the `mocha` instances.
`nemo` creates `mocha` instances programmatically. Unfortunately, not all `mocha` command line options are available when instantiating it this way. One of the arguments that is **not** supported is the `--require` flag, which useful if you want to `require` a module, e.g. `babel-register` (for Babel v6) or `@babel/register` (for Babel v7) for transpilation. Thus, we added a `"require"` property in `nemo.config.json` profile/base/mocha block, which takes a string of a single npm module name, or an array of npm module names. If it is an array, `nemo` will `require` each one before instantiating the `mocha` instances.

@@ -333,2 +333,6 @@ ## Events

### `root:before`
This event is published when root suite execution started
### `suite:before`

@@ -436,4 +440,5 @@

```
When `driverPerSuite` is `true` the global `beforeEach` hook will have a `nemo` instance injected, but not when `driverPerSuite` is `false`
Please note: When using the `driverPerTest` option, there will be no `nemo` instance in the `before`/`after` lifecycle
Please note: When using the `driverPerTest` option, there will be no reliable `nemo` instance in the `before`/`after` lifecycle
context.

@@ -440,0 +445,0 @@

@@ -53,3 +53,3 @@ {

"driverPerSuite": {
"tests": "path:./lifecycle.js",
"tests": "path:./lifecycle-suite.js",
"driverPerTest": false,

@@ -61,3 +61,3 @@ "mocha": {

"driverPerTest": {
"tests": "path:./lifecycle.js",
"tests": "path:./lifecycle-per-test.js",
"driverPerTest": true,

@@ -64,0 +64,0 @@ "mocha": {

@@ -26,2 +26,7 @@ module.exports = [{

}
},{
type: 'root:before',
listener: (context, event) => {
console.log('before root event fired', event.tags.uid);
}
}];

Sorry, the diff of this file is not supported yet

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