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

cucumber-fp

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cucumber-fp - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

25

package.json
{
"name": "cucumber-fp",
"version": "0.0.4",
"version": "0.0.5",
"description": "Cucumber.js with functional programming-style step definitions",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"author": "Julien Biezemans <jb@jbpros.com>",
"homepage": "https://github.com/jbpros/cucumber-fp",
"repository": {
"type": "git",
"url": "git://github.com/jbpros/cucumber-fp.git"
},
"bugs": {
"url": "https://github.com/jbpros/cucumber-fp/issues"
},
"directories": {
"lib": "lib"
},
"files": [
"lib/"
],
"engines": {
"node": ">=8"
},
"license": "MIT",

@@ -38,6 +56,3 @@ "devDependencies": {

"test": "cucumber-js"
},
"files": [
"lib/"
]
}
}

25

README.md

@@ -5,3 +5,3 @@ # Cucumber.js FP step definitions

This little library brings functional programming style step definitions to Cucumber.js.
This little library brings functional programming style step definitions to Cucumber.js. We highly recommend using it with TypeScript as it enforces read-only constraints on the context and all its nested members in your functional step definitions.

@@ -49,2 +49,25 @@ ## Install

### Mutations of context are forbidden
```typescript
import { withContext } from 'cucumber-fp'
interface MyContext { a: string[] }
const initialContext: MyContext = { a: ['a', 'b'] }
const { When } = withContext(initialContext)
When('a step', (ctx) => {
ctx.a.push('c')
// ^--- TypeScript compiler will fail here,
// `ctx` is deeply read-only. The following
// would work instead:
ctx = { ...ctx, a: [...ctx.a, 'c']}
return ctx
})
```
The type of `ctx` passed to your step definitions is always [`DeepReadonly<C>`](https://github.com/krzkaczor/ts-essentials#Deep-wrapper-types) (where `C` is the type of your context, in the example above, `MyContext`). That means all mutation operations are forbidden.
Theses constraints have no effects if you're not writing your step definitions in TypeScript, which we highly recommend.
### Steps that don't change context

@@ -51,0 +74,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