I'm testing a component (Foo) that contains a globally registered component (MyTable) which extends Bootstrap-Vue's Table component (bTable).
bTable contains a dependency:
import startCase from 'lodash.startcase';
When I try to run my test, I receive an error that states "startCase" is an unexpected identifier. This is my test:
const localVue = createLocalVue('MyTable', MyTable);
localVue.use(BootstrapVue);
describe('my component', () => {
it('test test', () => {
const component = mount(MyComponent, {
localVue,
propsData: {
prop1,
prop2,
},
});
expect(1 + 1).toBe(2);
});
});
This is the jest setup in Package.json:
"jest": {
"testURL": "http://localhost/",
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "<rootDir>/node_modules/jest-vue-preprocessor",
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
},
"snapshotSerializers": [
"<rootDir>/node_modules/jest-serializer-vue"
]
}
Having googled around, I've tried adding this in to no avail:
// "transformIgnorePatterns": [
// "<rootDir>/node_modules/(?!lodash/)"
// ],
What do I need to do to get the test to register or ignore the dependency?
Aucun commentaire:
Enregistrer un commentaire