Testing Vuex Prompt Module Integration in vue-cli
This test suite validates the Vuex prompt module functionality in Vue CLI, ensuring proper plugin configuration and user interaction flows. It verifies the correct implementation of Vuex feature selection and corresponding plugin setup.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
vuejs/vue-cli
packages/@vue/cli/lib/promptModules/__tests__/vuex.spec.js
jest.mock('fs')
jest.mock('inquirer')
const assertPromptModule = require('@vue/cli-test-utils/assertPromptModule')
const moduleToTest = require('../vuex')
test('vuex', async () => {
const expectedPrompts = [
{
message: 'features',
choices: ['Vuex'],
check: [0]
}
]
const expectedOptions = {
plugins: {
'@vue/cli-plugin-vuex': {}
}
}
await assertPromptModule(
moduleToTest,
expectedPrompts,
expectedOptions,
{ pluginsOnly: true }
)
})