New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cucumber/electron

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/electron - npm Package Compare versions

Comparing version 3.0.0-rc.1 to 3.0.0

.prettierrc.js

31

.eslintrc.json

@@ -8,29 +8,8 @@ {

},
"extends": "eslint:recommended",
"extends": [
"plugin:prettier/recommended"
],
"plugins": ["prettier"],
"rules": {
"array-bracket-spacing": ["error", "never"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-dangle": ["off"],
"indent": ["error", 2],
"key-spacing": ["error"],
"linebreak-style": ["error", "unix"],
"no-multi-spaces": ["error"],
"no-trailing-spaces": ["error"],
"no-unused-vars": ["error"],
"object-curly-spacing": ["error", "always"],
"padded-blocks": ["error", "never"],
"quotes": ["error", "single"],
"semi": ["error", "never"],
"space-before-blocks": ["error"],
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"space-infix-ops": ["error", { "int32Hint": false }],
"space-in-parens": ["error", "never"]
"prettier/prettier": "error"
},

@@ -37,0 +16,0 @@ "parserOptions": {

@@ -9,5 +9,5 @@ #!/usr/bin/env node

const args = process.argv.slice(2)
if (args.length === 1 && args[0] === '--help' || args[0] === '-h') {
if ((args.length === 1 && args[0] === '--help') || args[0] === '-h') {
showHelp()
} else if (args.length === 1 && args[0] === '--version' || args[0] === '-V') {
} else if ((args.length === 1 && args[0] === '--version') || args[0] === '-V') {
showVersion()

@@ -33,3 +33,5 @@ } else {

const child = spawn(electron, args)
child.on('exit', function (code) { process.exit(code) })
child.on('exit', function (code) {
process.exit(code)
})

@@ -36,0 +38,0 @@ child.stdout.pipe(process.stdout)

@@ -12,6 +12,11 @@ # CHANGE LOG

<!-- Releases -->
### [Unreleased](https://github.com/cucumber/cucumber-electron/compare/v3.0.0-rc.1...master)
### [Unreleased](https://github.com/cucumber/cucumber-electron/compare/v3.0.0...master)
* N/A
### [v3.0.0-rc.1](https://github.com/cucumber/cucumber-electron/compare/v3.0.0-rc.0...v3.0.0)
* Depends on Cucumber.js 7.0.0 and above.
* The peer dependency on Electron has been relaxed: all versions below 12 are now allowed. This will allow you to use a recent version of Electron before we bump it in Cucumber-electron's dependencies :)
### [v3.0.0-rc.1](https://github.com/cucumber/cucumber-electron/compare/v3.0.0-rc.0...v3.0.0-rc.1)

@@ -18,0 +23,0 @@

@@ -39,3 +39,5 @@ const assert = require('assert')

Then('the list of active tasks contains:', function (table) {
const actualList = [...this.doc.querySelectorAll('.todo-list li')].map(node => [node.innerText.trim()])
const actualList = [...this.doc.querySelectorAll('.todo-list li')].map(node => [
node.innerText.trim(),
])
assert.deepEqual(table.raw(), actualList)

@@ -57,5 +59,3 @@ })

function angularAppMounted(win) {
return new Promise(resolve =>
win.angular.element(win.document).ready(() => resolve())
)
return new Promise(resolve => win.angular.element(win.document).ready(() => resolve()))
}

@@ -8,26 +8,22 @@ /*global angular */

*/
angular.module('todomvc', ['ngRoute', 'ngResource'])
.config(function ($routeProvider) {
'use strict'
angular.module('todomvc', ['ngRoute', 'ngResource']).config(function ($routeProvider) {
'use strict'
var routeConfig = {
controller: 'TodoCtrl',
templateUrl: 'todomvc-index.html',
resolve: {
store: function (todoStorage) {
// Get the correct module (API or localStorage).
return todoStorage.then(function (module) {
module.get() // Fetch the todo records in the background.
return module
})
}
}
}
var routeConfig = {
controller: 'TodoCtrl',
templateUrl: 'todomvc-index.html',
resolve: {
store: function (todoStorage) {
// Get the correct module (API or localStorage).
return todoStorage.then(function (module) {
module.get() // Fetch the todo records in the background.
return module
})
},
},
}
$routeProvider
.when('/', routeConfig)
.when('/:status', routeConfig)
.otherwise({
redirectTo: '/'
})
$routeProvider.when('/', routeConfig).when('/:status', routeConfig).otherwise({
redirectTo: '/',
})
})

@@ -8,7 +8,8 @@ /*global angular */

*/
angular.module('todomvc')
angular
.module('todomvc')
.controller('TodoCtrl', function TodoCtrl($scope, $routeParams, $filter, store) {
'use strict'
var todos = $scope.todos = store.todos
var todos = ($scope.todos = store.todos)

@@ -18,14 +19,21 @@ $scope.newTodo = ''

$scope.$watch('todos', function () {
$scope.remainingCount = $filter('filter')(todos, { completed: false }).length
$scope.completedCount = todos.length - $scope.remainingCount
$scope.allChecked = !$scope.remainingCount
}, true)
$scope.$watch(
'todos',
function () {
$scope.remainingCount = $filter('filter')(todos, { completed: false }).length
$scope.completedCount = todos.length - $scope.remainingCount
$scope.allChecked = !$scope.remainingCount
},
true,
)
// Monitor the current route for changes and adjust the filter accordingly.
$scope.$on('$routeChangeSuccess', function () {
var status = $scope.status = $routeParams.status || ''
$scope.statusFilter = (status === 'active') ?
{ completed: false } : (status === 'completed') ?
{ completed: true } : {}
var status = ($scope.status = $routeParams.status || '')
$scope.statusFilter =
status === 'active'
? { completed: false }
: status === 'completed'
? { completed: true }
: {}
})

@@ -36,3 +44,3 @@

title: $scope.newTodo.trim(),
completed: false
completed: false,
}

@@ -45,3 +53,4 @@

$scope.saving = true
store.insert(newTodo)
store
.insert(newTodo)
.then(function success() {

@@ -85,5 +94,8 @@ $scope.newTodo = ''

store[todo.title ? 'put' : 'delete'](todo)
.then(function success() {}, function error() {
todo.title = $scope.originalTodo.title
})
.then(
function success() {},
function error() {
todo.title = $scope.originalTodo.title
},
)
.finally(function () {

@@ -113,6 +125,8 @@ $scope.editedTodo = null

}
store.put(todo, todos.indexOf(todo))
.then(function success() {}, function error() {
store.put(todo, todos.indexOf(todo)).then(
function success() {},
function error() {
todo.completed = !todo.completed
})
},
)
}

@@ -119,0 +133,0 @@

@@ -7,19 +7,18 @@ /*global angular */

*/
angular.module('todomvc')
.directive('todoEscape', function () {
'use strict'
angular.module('todomvc').directive('todoEscape', function () {
'use strict'
var ESCAPE_KEY = 27
var ESCAPE_KEY = 27
return function (scope, elem, attrs) {
elem.bind('keydown', function (event) {
if (event.keyCode === ESCAPE_KEY) {
scope.$apply(attrs.todoEscape)
}
})
return function (scope, elem, attrs) {
elem.bind('keydown', function (event) {
if (event.keyCode === ESCAPE_KEY) {
scope.$apply(attrs.todoEscape)
}
})
scope.$on('$destroy', function () {
elem.unbind('keydown')
})
}
})
scope.$on('$destroy', function () {
elem.unbind('keydown')
})
}
})

@@ -7,15 +7,18 @@ /*global angular */

*/
angular.module('todomvc')
.directive('todoFocus', function todoFocus($timeout) {
'use strict'
angular.module('todomvc').directive('todoFocus', function todoFocus($timeout) {
'use strict'
return function (scope, elem, attrs) {
scope.$watch(attrs.todoFocus, function (newVal) {
if (newVal) {
$timeout(function () {
return function (scope, elem, attrs) {
scope.$watch(attrs.todoFocus, function (newVal) {
if (newVal) {
$timeout(
function () {
elem[0].focus()
}, 0, false)
}
})
}
})
},
0,
false,
)
}
})
}
})

@@ -10,3 +10,4 @@ /*global angular */

*/
angular.module('todomvc')
angular
.module('todomvc')
.factory('todoStorage', function ($http, $injector) {

@@ -17,8 +18,10 @@ 'use strict'

// hand off the localStorage adapter
return $http.get('/api')
.then(function () {
return $http.get('/api').then(
function () {
return $injector.get('api')
}, function () {
},
function () {
return $injector.get('localStorage')
})
},
)
})

@@ -32,7 +35,5 @@

api: $resource('/api/todos/:id', null,
{
update: { method: 'PUT' }
}
),
api: $resource('/api/todos/:id', null, {
update: { method: 'PUT' },
}),

@@ -48,6 +49,8 @@ clearCompleted: function () {

return store.api.delete(function () {
}, function error() {
angular.copy(originalTodos, store.todos)
})
return store.api.delete(
function () {},
function error() {
angular.copy(originalTodos, store.todos)
},
)
},

@@ -59,7 +62,9 @@

store.todos.splice(store.todos.indexOf(todo), 1)
return store.api.delete({ id: todo.id },
function () {
}, function error() {
return store.api.delete(
{ id: todo.id },
function () {},
function error() {
angular.copy(originalTodos, store.todos)
})
},
)
},

@@ -76,16 +81,17 @@

return store.api.save(todo,
return store.api.save(
todo,
function success(resp) {
todo.id = resp.id
store.todos.push(todo)
}, function error() {
},
function error() {
angular.copy(originalTodos, store.todos)
})
.$promise
},
).$promise
},
put: function (todo) {
return store.api.update({ id: todo.id }, todo)
.$promise
}
return store.api.update({ id: todo.id }, todo).$promise
},
}

@@ -167,3 +173,3 @@

return deferred.promise
}
},
}

@@ -170,0 +176,0 @@

@@ -6,4 +6,4 @@ const { Given } = require('@cucumber/cucumber')

debug('a %s and a %o', 'string', {
object: { with: { x: 1, y: new Date() } }
object: { with: { x: 1, y: new Date() } },
})
})

@@ -11,9 +11,8 @@ const { Given, When, Then } = require('@cucumber/cucumber')

const contents = [
'const { When } = require(\'@cucumber/cucumber\')',
'When(\'I run that step\', function() {'
"const { When } = require('@cucumber/cucumber')",
"When('I run that step', function() {",
]
.concat(lines.split('\n').map(line => ' ' + line))
.concat([
'})'
]).join('\n')
.concat(['})'])
.join('\n')
await this.writeFile('features/step_definitions/steps.js', contents)

@@ -26,3 +25,3 @@ })

' Scenario: Running that step',
' When I run that step'
' When I run that step',
].join('\n')

@@ -37,6 +36,8 @@ await this.writeFile('features/with_that_step.feature', contents)

' Scenario: Running that step and DEBUG',
' When I run that step'
' When I run that step',
].join('\n')
await this.writeFile('features/with_that_step_and_debug.feature', contents)
await this.runCommand('cucumber-electron features/with_that_step_and_debug.feature', { env: { DEBUG: debugEnvironmentValue } })
await this.runCommand('cucumber-electron features/with_that_step_and_debug.feature', {
env: { DEBUG: debugEnvironmentValue },
})
})

@@ -43,0 +44,0 @@

@@ -10,7 +10,3 @@ const { spawn } = require('child_process')

const {
setWorldConstructor,
setDefaultTimeout,
Before,
} = require('@cucumber/cucumber')
const { setWorldConstructor, setDefaultTimeout, Before } = require('@cucumber/cucumber')

@@ -25,6 +21,3 @@ class CucumberElectronWorld {

mkdirp.sync(dir)
fs.writeFileSync(
path.join(this.tempDir, filePath),
contents
)
fs.writeFileSync(path.join(this.tempDir, filePath), contents)
}

@@ -54,3 +47,3 @@

env: childEnv,
detached: true
detached: true,
})

@@ -107,7 +100,3 @@

await this.ensureProcessHasExited()
assert.equal(
this.spawnedProcess.exitCode,
expectedExitCode,
this.printExecResult()
)
assert.equal(this.spawnedProcess.exitCode, expectedExitCode, this.printExecResult())
}

@@ -118,9 +107,6 @@

const normalisedExpectedOutput = expectedOutput.replace('\r\n', '\n')
const normalisedActualOutput = colors
.strip(this.execResult[stream])
.replace('\r\n', '\n')
const normalisedActualOutput = colors.strip(this.execResult[stream]).replace('\r\n', '\n')
if (normalisedActualOutput.indexOf(normalisedExpectedOutput) === -1) {
throw new Error(
`Expected ${stream} to include:\n${normalisedExpectedOutput}\n` +
this.printExecResult()
`Expected ${stream} to include:\n${normalisedExpectedOutput}\n` + this.printExecResult(),
)

@@ -127,0 +113,0 @@ }

{
"name": "@cucumber/electron",
"version": "3.0.0-rc.1",
"version": "3.0.0",
"description": "Runs cucumber.js in electron",

@@ -14,2 +14,3 @@ "main": "index.js",

"eslint": "eslint \"**/*.js\"",
"eslint:fix": "eslint \"**/*.js\" --fix",
"update-dependencies": "npx npm-check-updates --upgrade --dep prod,dev,optional,bundle"

@@ -19,4 +20,5 @@ },

"contributors": [
"Aslak Hellesøy <aslak.hellesoy@gmail.com>",
"Josh Chisholm <joshuachisholm@gmail.com>",
"Aslak Hellesøy <aslak.hellesoy@gmail.com>"
"Julien Biezemans <jb@jbpros.com>"
],

@@ -32,14 +34,17 @@ "repository": {

"peerDependencies": {
"@cucumber/cucumber": "^7.0.0-rc.0",
"electron": ">=8.2.0 <=11.0.3"
"@cucumber/cucumber": "^7.0.0",
"electron": ">=8.2.0 <12"
},
"devDependencies": {
"@cucumber/cucumber": "^7.0.0-rc.0",
"@cucumber/cucumber": "^7.0.0",
"colors": "^1.4.0",
"debug": "^4.3.1",
"del": "^6.0.0",
"electron": "^11.0.3",
"eslint": "^7.14.0",
"mkdirp": "^1.0.4"
"electron": "^11.1.1",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.0",
"mkdirp": "^1.0.4",
"prettier": "^2.2.1"
}
}
const runCli = require('./run')
const rewriteExitLine = (line) => (line.match(/\s+--exit/) === null) ? line : [
' --exit UNSUPPORTED in cucumber-electron: force shutdown of the event loop when the test run has finished',
' -i, --interactive open an interactive debugger (chromium dev tools)'
].join('\n')
const rewriteExitLine = line =>
line.match(/\s+--exit/) === null
? line
: [
' --exit UNSUPPORTED in cucumber-electron: force shutdown of the event loop when the test run has finished',
' -i, --interactive open an interactive debugger (chromium dev tools)',
].join('\n')
runCli(rewriteExitLine)
runCli(rewriteExitLine)
const Cucumber = require('@cucumber/cucumber')
module.exports = (stdoutRewrite) => {
module.exports = stdoutRewrite => {
const write = process.stdout.write

@@ -14,4 +14,4 @@

cwd: process.cwd(),
stdout: process.stdout
stdout: process.stdout,
}).run()
}
const runCli = require('./run')
const VERSION = require('../../package.json').version
const rewriteVersion = (originalVersion) =>
originalVersion.trim().length > 0 ?
`Cucumber.js: ${originalVersion}\nCucumber-electron: ${VERSION}` : ''
const rewriteVersion = originalVersion =>
originalVersion.trim().length > 0
? `Cucumber.js: ${originalVersion}\nCucumber-electron: ${VERSION}`
: ''
runCli(rewriteVersion)
runCli(rewriteVersion)

@@ -28,4 +28,4 @@ const { join, resolve } = require('path')

nodeIntegration: true,
enableRemoteModule: true
}
enableRemoteModule: true,
},
})

@@ -32,0 +32,0 @@

@@ -20,3 +20,3 @@ const Options = require('../cli/options')

const exitWithUncaughtError = (reason) => {
const exitWithUncaughtError = reason => {
output.write(reason.stack)

@@ -26,7 +26,4 @@ exitWithCode(STATUS_UNCAUGHT_ERROR)

const exitWithCucumberResult = (result) =>
exitWithCode(result.success ?
STATUS_SUCCESS :
STATUS_ERROR_DURING_CUCUMBER_RUN
)
const exitWithCucumberResult = result =>
exitWithCode(result.success ? STATUS_SUCCESS : STATUS_ERROR_DURING_CUCUMBER_RUN)

@@ -47,13 +44,12 @@ const exitWithCode = (code = STATUS_SUCCESS) =>

cwd: process.cwd(),
stdout: output
stdout: output,
})
// sadly, we have to exit immediately, we can't wait for the event loop
// to drain https://github.com/electron/electron/issues/2358
cli.run().then(
exitWithCucumberResult,
exitWithUncaughtError
)
} catch (err) { exitWithUncaughtError(err) }
cli.run().then(exitWithCucumberResult, exitWithUncaughtError)
} catch (err) {
exitWithUncaughtError(err)
}
})
ipc.send('ready-to-run-cucumber')
const electron = require('electron')
document.body.addEventListener('keydown', e => {
e = e || window.event
const key = e.which || e.keyCode
const ctrl = e.ctrlKey ? e.ctrlKey : key === 17
if (key === 67 && ctrl) electron.remote.process.exit(0)
}, false)
document.body.addEventListener(
'keydown',
e => {
e = e || window.event
const key = e.which || e.keyCode
const ctrl = e.ctrlKey ? e.ctrlKey : key === 17
if (key === 67 && ctrl) electron.remote.process.exit(0)
},
false,
)

@@ -10,3 +10,4 @@ const AnsiToHtml = require('ansi-to-html')

write() {
Array.prototype.slice.apply(arguments)
Array.prototype.slice
.apply(arguments)
.map(argument => this.escapeTags(argument))

@@ -13,0 +14,0 @@ .forEach(escapedArgument => this.appendTag(escapedArgument))

@@ -9,3 +9,4 @@ const electron = require('electron')

write() {
Array.prototype.slice.apply(arguments)
Array.prototype.slice
.apply(arguments)
.forEach(argument => this.stdout.write(argument.toString()))

@@ -12,0 +13,0 @@ }

@@ -5,16 +5,19 @@ const ipcSafe = require('./ipcSafe')

const localConsole = console
global.console = {};
['error', 'warn', 'info', 'log'].forEach(method => {
global.console = {}
;['error', 'warn', 'info', 'log'].forEach(method => {
global.console[method] = function () {
const args = Array.prototype.slice.apply(arguments)
localConsole[method].apply(localConsole, args)
mainProcessConsole[method].apply(mainProcessConsole, args.map(arg => ipcSafe(arg, true)))
mainProcessConsole[method].apply(
mainProcessConsole,
args.map(arg => ipcSafe(arg, true)),
)
}
})
Object.keys(localConsole).filter(m => typeof localConsole[m] == 'function')
Object.keys(localConsole)
.filter(m => typeof localConsole[m] == 'function')
.forEach(nativeMethod => {
global.console[nativeMethod] = global.console[nativeMethod] ||
localConsole[nativeMethod].bind(localConsole)
global.console[nativeMethod] =
global.console[nativeMethod] || localConsole[nativeMethod].bind(localConsole)
})

@@ -21,5 +21,9 @@ const util = require('util')

if (inspectObjects) {
return '{ ' +
Object.keys(arg).map(key => `${key}: ${ipcSafe(arg[key], inspectObjects)}`).join(', ') +
' }'
return (
'{ ' +
Object.keys(arg)
.map(key => `${key}: ${ipcSafe(arg[key], inspectObjects)}`)
.join(', ') +
' }'
)
} else {

@@ -26,0 +30,0 @@ const obj = {}

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