Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jasminewd2

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasminewd2 - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

15

CHANGELOG.md
# Changelog for jasminewd2
# 0.0.10
- ([ff2e624](https://github.com/angular/jasminewd/commit/ff2e624159344cd83b04c6a6648334ba12e78ea6))
fix(webdriver): Pass in the control flow.
BREAKING CHANGE: The control flow now needs to be passed in when using jasminewd. This fixes
an issue where having multiple versions of selenium-webdriver in a package's dependency tree would
result in jasminewd and protractor using different control flows. You now have to initialize
jasminewd before you can use it, like so: `require('jasminewd2').init(webdriver.promise.controlFlow());`
See https://github.com/angular/protractor/issues/3505
- ([db26b1a](https://github.com/angular/jasminewd/commit/db26b1a1e66477a6f526dac56ecaaa50d2cf4700))
fix(stacktrace): do not crash if beforeEach block is rejected without any stated reason (#45)
# 0.0.9

@@ -4,0 +19,0 @@

57

index.js

@@ -9,4 +9,2 @@ /**

var flow = webdriver.promise.controlFlow();
/**

@@ -71,3 +69,3 @@ * Wraps a function so that all passed arguments are ignored.

*/
function wrapInControlFlow(globalFn, fnName) {
function wrapInControlFlow(flow, globalFn, fnName) {
return function() {

@@ -102,2 +100,6 @@ var driverError = new Error();

}, 'Run ' + fnName + description + ' in control flow').then(seal(done), function(err) {
if (!err) {
err = new Error('Unknown Error');
err.stack = '';
}
err.stack = err.stack + '\nFrom asynchronous test: \n' + driverError.stack;

@@ -143,14 +145,37 @@ done.fail(err);

global.it = wrapInControlFlow(global.it, 'it');
global.fit = wrapInControlFlow(global.fit, 'fit');
global.beforeEach = wrapInControlFlow(global.beforeEach, 'beforeEach');
global.afterEach = wrapInControlFlow(global.afterEach, 'afterEach');
global.beforeAll = wrapInControlFlow(global.beforeAll, 'beforeAll');
global.afterAll = wrapInControlFlow(global.afterAll, 'afterAll');
/**
* Initialize the JasmineWd adapter with a particlar webdriver instance. We
* pass webdriver here instead of using require() in order to ensure Protractor
* and Jasminews are using the same webdriver instance.
* @param {Object} flow. The ControlFlow to wrap tests in.
*/
function initJasmineWd(flow) {
if (jasmine.JasmineWdInitialized) {
throw Error('JasmineWd already initialized when init() was called');
}
jasmine.JasmineWdInitialized = true;
global.it = wrapInControlFlow(flow, global.it, 'it');
global.fit = wrapInControlFlow(flow, global.fit, 'fit');
global.beforeEach = wrapInControlFlow(flow, global.beforeEach, 'beforeEach');
global.afterEach = wrapInControlFlow(flow, global.afterEach, 'afterEach');
global.beforeAll = wrapInControlFlow(flow, global.beforeAll, 'beforeAll');
global.afterAll = wrapInControlFlow(flow, global.afterAll, 'afterAll');
// On timeout, the flow should be reset. This will prevent webdriver tasks
// from overflowing into the next test and causing it to fail or timeout
// as well. This is done in the reporter instead of an afterEach block
// to ensure that it runs after any afterEach() blocks with webdriver tasks
// get to complete first.
jasmine.getEnv().addReporter(new OnTimeoutReporter(function() {
console.warn('A Jasmine spec timed out. Resetting the WebDriver Control Flow.');
flow.reset();
}));
}
var originalExpect = global.expect;
global.expect = function(actual) {
if (actual instanceof webdriver.WebElement) {
throw 'expect called with WebElement argument, expected a Promise. ' +
'Did you mean to use .getText()?';
throw Error('expect called with WebElement argument, expected a Promise. ' +
'Did you mean to use .getText()?');
}

@@ -271,10 +296,2 @@ return originalExpect(actual);

// On timeout, the flow should be reset. This will prevent webdriver tasks
// from overflowing into the next test and causing it to fail or timeout
// as well. This is done in the reporter instead of an afterEach block
// to ensure that it runs after any afterEach() blocks with webdriver tasks
// get to complete first.
jasmine.getEnv().addReporter(new OnTimeoutReporter(function() {
console.warn('A Jasmine spec timed out. Resetting the WebDriver Control Flow.');
flow.reset();
}));
module.exports.init = initJasmineWd;

@@ -15,5 +15,6 @@ {

"devDependencies": {
"jasmine": "2.4.1",
"jshint": "2.5.0",
"jasmine": "2.4.1",
"selenium-webdriver": "2.52.0"
"selenium-webdriver": "2.53.3",
"typescript": "^2.0.0"
},

@@ -26,7 +27,7 @@ "repository": {

"scripts": {
"pretest": "node_modules/.bin/jshint index.js spec",
"pretest": "node_modules/.bin/jshint index.js spec --exclude spec/asyncAwaitSpec.js; tsc -t ES2015 spec/asyncAwaitSpec.ts",
"test": "scripts/test.sh"
},
"license": "MIT",
"version": "0.0.9"
"version": "0.0.10"
}
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