'How to automatic load .feature files
Here is an example of the (react) architecture.
src/
components/
Input/
Tests/
Input.feature
Input.test.js
We test with react testing library and cucumber for scenarios. But in each feature file we need to do
import { defineFeature, loadFeature } from 'jest-cucumber';
const feature = loadFeature('src/components/Input/Tests/Input.feature')
defineFeature(feature, test => {})
How to avoid systematically having to add the feature file in our tests. Is there a way to automate this?
Thank you in advance
Solution 1:[1]
Create a file saying cucumber.js in your project root directory and add this code into it
let common = [
'--require ./support/', // Load hooks
'./**/tests/features/', // Specify our feature files
'--require ./**/tests/steps/**/', // Load step definitions
].join(' ');
module.exports = {
default: common
};
This will load your feature , spec and any support files at the time of cucumber execution initialization
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sreenivasulu |