Translate a feature file to step.js files using the jest-cucumber package write your'e feature file update the feature_folder in translator.conf.js and then run
npm run translate
npm install jest-cucumber-translate-to-steps --save-dev
alter paths to match your file
module.exports = {
feature_folder: 'ADD_PATH_TO_FEATURE_FILE',
output_folder: 'test',
template_path: 'test/translator/template.js'
}
import { loadFeature } from 'jest-cucumber'
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import Vue from 'vue'
import merge from 'lodash.merge'
import Component from '../../src/components/ADD_PATH_TO_COMPONENT_HERE'
const feature = loadFeature('test/features/ADD_PATH_TO_FEATURE_FILE_HERE')
const localVue = createLocalVue()
localVue.use(Vuex)
Vue.filter('translate', () => {})
function createStore (overrides) {
const defaultStoreConfig = {
state: {
},
mutations: {
},
getters: {
},
actions: {
}
}
return new Vuex.Store(
merge(defaultStoreConfig, overrides)
)
}
function createWrapper (overrides) {
const defaultMountingOptions = {
mocks: {
$t: () => {},
},
localVue,
store: createStore()
}
return shallowMount(Component, merge(defaultMountingOptions, overrides))
}
"script": {
"translate": "node node_modules/jest-cucumber-translate-to-steps/src"
}