JSPM

@windyroad/cucumber-js-throwables

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q64232F
  • License Apache-2.0

Provides `Error` classes for cucumber-js that can be used to generate `pending` and `skipped` results

Package Exports

  • @windyroad/cucumber-js-throwables

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@windyroad/cucumber-js-throwables) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cucumber-js-throwables

Provides Error classes for cucumber-js that can be used to generate pending and skipped results

Why

I used to heavily use PendingException when writing Java code as it allowed me to focus on the task at hand. For everything else, (methods not implemented or branches not implemented) I'd just throw a PendingException.

This isn't as doable in cucumber-js, because in the step definition, you either need to return 'pending' (for no callback) or call ``

I really miss PendingException from cucumber-jvm

Usage

Add Wrapper

In your world.js (or similar) add

import { stepDefinitionWrapper } from '@windyroad/cucumber-js-throwables'
import { setDefinitionFunctionWrapper } from 'cucumber'

setDefinitionFunctionWrapper(stepDefinitionWrapper)

Use Errors

import { PendingError, SkippedError } from '@windyroad/cucumber-js-throwables'

You can now call

throw new PendingError();

and

throw new SkippedError();

in you code instead of having to return 'pending' or 'skipped', or call callback(null, 'pending') or callback(null, 'skipped')

Snippets

Add

--format-options '{\"snippetInterface\": \"async-await\", \"snippetSyntax\": \"./node_modules/@windyroad/cucumber-js-throwables/lib/custom-cucumber-syntax.js\"}'

in your cucumber-js command