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

testable-utils

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testable-utils - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

16

lib/main.js

@@ -100,7 +100,13 @@

if (registerCommands) {
wdio.registerLogCommands(log);
wdio.registerCsvCommands(csv);
wdio.registerResultsCommands(results);
wdio.registerInfoCommands(info);
wdio.registerStopwatchCommands(stopwatch);
const browsers = [ browser ];
if (process.env.TESTABLE_BROWSERS) {
browsers.push.apply(browsers, process.env.TESTABLE_BROWSERS.split(","));
}
_.forEach(browsers, function(brwsr) {
wdio.registerLogCommands(brwsr, log);
wdio.registerCsvCommands(brwsr, csv);
wdio.registerResultsCommands(brwsr, results);
wdio.registerInfoCommands(brwsr, info);
wdio.registerStopwatchCommands(brwsr, stopwatch);
});
}

@@ -107,0 +113,0 @@

var _ = require('lodash');
function isWdioContext() {
function isWdioContext(browser) {
return _.isObject(browser) && _.isFunction(browser.addCommand);
}
function registerLogCommands(log) {
if (isWdioContext()) {
function registerLogCommands(browser, log) {
if (isWdioContext(browser)) {
browser.addCommand('testableLogTrace', function async() {

@@ -27,4 +27,4 @@ return log.trace.apply(log, arguments);

function registerCsvCommands(csv) {
if (isWdioContext()) {
function registerCsvCommands(browser, csv) {
if (isWdioContext(browser)) {
browser.addCommand('testableCsvGet', function async(name, index) {

@@ -42,4 +42,4 @@ return csv.open(name).get(index);

function registerResultsCommands(results) {
if (isWdioContext()) {
function registerResultsCommands(browser, results) {
if (isWdioContext(browser)) {
browser.addCommand('testableResult', function(resource, url) {

@@ -63,4 +63,4 @@ return results(resource, url);

function registerInfoCommands(info) {
if (isWdioContext()) {
function registerInfoCommands(browser, info) {
if (isWdioContext(browser)) {
browser.addCommand('testableInfo', function () {

@@ -77,4 +77,4 @@ return info;

function registerStopwatchCommands(stopwatch) {
if (isWdioContext()) {
function registerStopwatchCommands(browser, stopwatch) {
if (isWdioContext(browser)) {
browser.addCommand('testableStopwatch', function async(code, metricName, resource) {

@@ -81,0 +81,0 @@ return stopwatch(code, metricName, resource);

{
"name": "testable-utils",
"version": "0.2.0",
"version": "0.2.1",
"description": "Utilities for Testable scripts",

@@ -5,0 +5,0 @@ "author": "Avi Stramer",

@@ -230,3 +230,3 @@ # Testable Script Utilities

For local testing, you can also trigger the event in your script by checking the `isLocal` boolean variable.
For local testing and smoke testing on Testable, you can also trigger the event in your script by checking the `isLocal` and `isSmokeTest` boolean variables.

@@ -236,6 +236,7 @@ Example:

```javascript
const isLocal = require('testable-utils').isLocal;
const request = require('request');
const events = require('testable-utils').events;
const execute = require('testable-utils').execute;
const testableUtils = require('testable-utils');
const fireNow = testableUtils.isLocal || testableUtils.isSmokeTest;
const events = testableUtils.events;
const execute = testableUtils.execute;

@@ -249,4 +250,4 @@ execute(function(finished) {

if (isLocal) {
// trigger the event when run locally for testing
if (fireNow) {
// trigger the event when smoke testing or run locally for testing
events.emit('my-event', 'MSFT');

@@ -253,0 +254,0 @@ }

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