Socket
Socket
Sign inDemoInstall

protractor-cucumber-framework

Package Overview
Dependencies
209
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

.eslintignore

66

index.js

@@ -1,8 +0,7 @@

var q = require('q'),
path = require('path'),
glob = require('glob'),
assign = require('object-assign'),
debug = require('debug')('protractor-cucumber-framework'),
Cucumber = require('./lib/cucumberLoader').load(),
state = require('./lib/runState');
let q = require('q');
let path = require('path');
let glob = require('glob');
let debug = require('debug')('protractor-cucumber-framework');
let Cucumber = require('./lib/cucumberLoader').load();
let state = require('./lib/runState');

@@ -17,11 +16,11 @@ /**

exports.run = function(runner, specs) {
var results = {};
let results = {};
return runner.runTestPreparer().then(function() {
var config = runner.getConfig();
var opts = assign({}, config.cucumberOpts, config.capabilities.cucumberOpts);
let config = runner.getConfig();
let opts = Object.assign({}, config.cucumberOpts, config.capabilities.cucumberOpts);
state.initialize(runner, results, opts.strict);
return q.promise(function(resolve, reject) {
var cliArguments = convertOptionsToCliArguments(opts);
let cliArguments = convertOptionsToCliArguments(opts);
cliArguments.push('--require', path.resolve(__dirname, 'lib', 'resultsCapturer.js'));

@@ -38,5 +37,5 @@ cliArguments = cliArguments.concat(specs);

function runDone(isSuccessful) {
function runDone() {
try {
var complete = q();
let complete = q();
if (runner.getConfig().onComplete) {

@@ -60,11 +59,9 @@ complete = q(runner.getConfig().onComplete());

function convertOptionsToCliArguments(options) {
var cliArguments = ['node', 'cucumberjs'];
let cliArguments = ['node', 'cucumberjs'];
for (var option in options) {
var cliArgumentValues = convertOptionValueToCliValues(option, options[option]);
for (let option in options) {
let cliArgumentValues = convertOptionValueToCliValues(option, options[option]);
if (Array.isArray(cliArgumentValues)) {
cliArgumentValues.forEach(function (value) {
cliArguments.push('--' + option, value);
});
cliArgumentValues.forEach((value) => cliArguments.push('--' + option, value));
} else if (cliArgumentValues) {

@@ -79,23 +76,16 @@ cliArguments.push('--' + option);

function convertRequireOptionValuesToCliValues(values) {
var configDir = runner.getConfig().configDir;
let configDir = runner.getConfig().configDir;
return toArray(values).map(function(path) {
// Handle glob matching
return glob.sync(path, {cwd: configDir});
}).reduce(function(opts, globPaths) {
// Combine paths into flattened array
return opts.concat(globPaths);
}, []).map(function(requirePath) {
// Resolve require absolute path
return path.resolve(configDir, requirePath);
}).filter(function(item, pos, orig) {
// Make sure requires are unique
return orig.indexOf(item) == pos;
});
return toArray(values)
.map((path) => glob.sync(path, {cwd: configDir})) // Handle glob matching
.reduce((opts, globPaths) => opts.concat(globPaths), []) // Combine paths into flattened array
.map((requirePath) => path.resolve(configDir, requirePath)) // Resolve require absolute path
.filter((item, pos, orig) => orig.indexOf(item) == pos); // Make sure requires are unique
}
function convertTagsToCliValues(values) {
var converted = toArray(values).map(function(tag) {
return tag.replace(/~/, 'not ');
}).join(' and ');
function convertTagsToV2CliValues(values) {
let converted = toArray(values)
.filter((tag) => !!tag.replace)
.map((tag) => tag.replace(/~/, 'not '))
.join(' and ');

@@ -117,3 +107,3 @@ return [converted];

} else if (option === 'tags' && isCucumber2()) {
return convertTagsToCliValues(values)
return convertTagsToV2CliValues(values);
} else {

@@ -120,0 +110,0 @@ return convertGenericOptionValuesToCliValues(values);

module.exports.load = function() {
if (process.env.MULTIDEP_CUCUMBER_VERSION) {
return require('multidep')('spec/multidep.js')('cucumber', process.env.MULTIDEP_CUCUMBER_VERSION);
return require('multidep')('test/multidep.js')('cucumber', process.env.MULTIDEP_CUCUMBER_VERSION);
} else {
return require('cucumber');
}
}
};

@@ -61,3 +61,3 @@ var state = require('./runState');

passed: false,
errorMsg: "Undefined steps are not allowed in strict mode"
errorMsg: 'Undefined steps are not allowed in strict mode'
});

@@ -78,3 +78,3 @@ }

duration: 0
}
};
}

@@ -91,2 +91,1 @@

}
{
"name": "protractor-cucumber-framework",
"version": "1.0.0",
"version": "1.0.1",
"description": "Protractor framework for Cucumber.js",

@@ -11,5 +11,6 @@ "main": "index.js",

"webdriver": "webdriver-manager update --standalone && webdriver-manager start",
"start": "httpster -d testapp/ -p `node -p 'process.env.HTTP_PORT || require(\"./spec/environment\").webServerDefaultPort'`",
"pretest": "multidep spec/multidep.js",
"test": "node scripts/test.js"
"start": "node test/testapp/server",
"lint": "eslint .",
"pretest": "npm run lint && multidep test/multidep.js",
"test": "node test/test.js"
},

@@ -57,2 +58,4 @@ "repository": {

"chai-as-promised": "6.0.0",
"eslint": "3.16.1",
"express": "4.14.1",
"httpster": "1.0.3",

@@ -59,0 +62,0 @@ "multidep": "2.0.2",

@@ -29,8 +29,9 @@ Protractor Cucumber Framework

specs: [
'path/to/feature/files/**/*.feature' // accepts a glob
],
'path/to/feature/files/**/*.feature' // accepts a glob
],
cucumberOpts: {
// require step definitions
// require step definitions
require: [
'path/to/step/definitions/**/*.steps.js' // accepts a glob
'path/to/step/definitions/**/*.steps.js' // accepts a glob
]

@@ -58,8 +59,8 @@ }

Start up the test app that tests will be run against:
Start up the test app that tests will be run against in a separate shell:
npm start
Run the tests:
Run the tests in a separate shell:
npm test
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc