Skip to content

Commit

Permalink
docs: add instructions for 'out-of-the-box' TypeScript support
Browse files Browse the repository at this point in the history
Cypress v4.4.0 supports TypeScript without additional preprocessors
(cypress-io/cypress#1859). These are the
instructions for setting that up with the Cucumber preprocessor.
  • Loading branch information
bauglir authored and lgandecki committed Aug 4, 2020
1 parent bc6dfb3 commit 349c189
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,27 @@ Install the plug-in type definitions:
npm install --save-dev @types/cypress-cucumber-preprocessor
```
### With out-of-the-box support
As of [Cypress
v4.4.0](https://github.com/cypress-io/cypress/releases/tag/v4.4.0), TypeScript
is supported out-of-the-box. To use it, add this to your `plugins/index.js`:
```javascript
const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const resolve = require('resolve');

module.exports = (on, config) => {
const options = {
...browserify.defaultOptions,
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
};

on('file:preprocessor', cucumber(options));
};
```
### With Webpack
You can also use a Webpack loader to process feature files (TypeScript supported). To see how it is done please take
a look here: [cypress-cucumber-webpack-typescript-example](https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example)
Expand Down

0 comments on commit 349c189

Please sign in to comment.