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.1.0-beta.1 to 0.1.0

4

CHANGELOG.md
# Changelog for jasminewd2
# 0.1.0
Release for the selenium-webdriver 3.0.1 upgrade.
# 0.1.0-beta.1

@@ -4,0 +8,0 @@

63

index.js

@@ -10,13 +10,2 @@ /**

/**
* Wraps a function so that all passed arguments are ignored.
* @param {!Function} fn The function to wrap.
* @return {!Function} The wrapped function.
*/
function seal(fn) {
return function() {
fn();
};
}
/**
* Validates that the parameter is a function.

@@ -64,5 +53,23 @@ * @param {Object} functionToValidate The function to validate.

/**
* Calls a function once the control flow is idle
* @param {webdriver.promise.ControlFlow} flow The Web Driver control flow
* @param {!Function} fn The function to call
*/
function callWhenIdle(flow, fn) {
if (flow.isIdle()) {
fn();
} else {
flow.once(webdriver.promise.ControlFlow.EventType.IDLE, function() {
fn();
});
}
}
/**
* Wraps a function so it runs inside a webdriver.promise.ControlFlow and
* waits for the flow to complete before continuing.
* @param {!webdriver.promise.ControlFlow} flow The WebDriver control flow.
* @param {!Function} globalFn The function to wrap.
* @param {!string} fnName The name of the function being wrapped (e.g. `'it'`).
* @return {!Function} The new function.

@@ -79,6 +86,10 @@ */

var async = fn.length > 0;
testFn = fn.bind(this);
var testFn = fn.bind(this);
flow.execute(function controlFlowExecute() {
return new webdriver.promise.Promise(function(fulfill, reject) {
function wrappedReject(err) {
var wrappedErr = new Error(err);
reject(wrappedErr);
}
if (async) {

@@ -89,6 +100,3 @@ // If testFn is async (it expects a done callback), resolve the promise of this

var proxyDone = fulfill;
proxyDone.fail = function(err) {
var wrappedErr = new Error(err);
reject(wrappedErr);
};
proxyDone.fail = wrappedReject;
testFn(proxyDone);

@@ -98,13 +106,20 @@ } else {

// be assumed to have completed synchronously.
fulfill(testFn());
var ret = testFn();
if (webdriver.promise.isPromise(ret)) {
ret.then(fulfill, wrappedReject);
} else {
fulfill(ret);
}
}
}, flow);
}, 'Run ' + fnName + description + ' in control flow').then(seal(done), function(err) {
if (!err) {
err = new Error('Unknown Error');
err.stack = '';
}, 'Run ' + fnName + description + ' in control flow').then(
callWhenIdle.bind(null, flow, done), function(err) {
if (!err) {
err = new Error('Unknown Error');
err.stack = '';
}
err.stack = err.stack + '\nFrom asynchronous test: \n' + driverError.stack;
callWhenIdle(flow, done.fail.bind(done, err));
}
err.stack = err.stack + '\nFrom asynchronous test: \n' + driverError.stack;
done.fail(err);
});
);
};

@@ -111,0 +126,0 @@ }

@@ -14,8 +14,10 @@ {

"author": "Julie Ralph <ju.ralph@gmail.com>",
"devDependencies": {
"dependencies": {
"jasmine": "2.4.1",
"jshint": "2.5.0",
"selenium-webdriver": "^3.0.0",
"typescript": "^2.0.0"
"selenium-webdriver": "3.0.1"
},
"devDependencies": {
"jshint": "^2.9.4",
"typescript": "^2.0.10"
},
"repository": {

@@ -34,5 +36,5 @@ "type": "git",

"engines": {
"node": ">= 6.9.0"
"node": ">= 6.9.x"
},
"version": "0.1.0-beta.1"
"version": "0.1.0"
}

@@ -18,2 +18,4 @@ jasminewd [![Build Status](https://travis-ci.org/angular/jasminewd.png?branch=master)](https://travis-ci.org/angular/jasminewd)

- If a test returns a promise, waits for both the control flow and the promise to resolve.
- Enhances `expect` so that it automatically unwraps promises before performing the assertion.

@@ -62,1 +64,11 @@

```
`async` functions / `await`
---------------------------
`async` functions and the `await` keyword are likely coming in ES2017 (ES8), and
available via several compilers. At the moment, they often break the WebDriver
control flow.
([GitHub issue](https://github.com/SeleniumHQ/selenium/issues/3037)). You can
still use them, but if you do then you will have to use `await`/Promises for
almost all your synchronization. See `spec/asyncAwaitSpec.ts` for details.

Sorry, the diff of this file is not supported yet

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