-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
I'm almost certain it's something to do with the way babel is set up but can't seem to put my finger on it. The component is being pulled into the test but it's not actually running vue-jest on it, or so it seems.
This is the error
Test suite failed to run
C:/Users/craig.harley/Code/myComponent.vue: Unexpected token (1:0)
> 1 | <template>
.babelrc
{
"presets": ["env"],
"plugins": ["transform-vue-jsx"]
}
relevant package.json:
"devDependencies": {
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.5.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"gulp": "^3.9.1",
"jest": "^22.4.2",
"laravel-elixir": "^6.0.0-17",
"laravel-elixir-vue-2": "^0.3.0",
"laravel-elixir-webpack-official": "^1.0.10",
"node-sass": "^4.5.3",
"vue-jest": "^2.1.0",
"vue-template-compiler": "^2.5.13",
"vue-template-es2015-compiler": "^1.6.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"vue"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
}
}
test looks like this:
import Vue from 'vue';
import Component from './component.vue';
describe('app/components/component', () =>
it('should match the snapshot', () => {
const vm = new Vue({
el: document.createElement('div'),
render: function () {
return (
<Component
name="name"
product="product"
type="type"
/>
)
}
});
return expect(vm.$el).toMatchSnapshot();
}
)
);
Not sure what I'm missing here or if it's a bug with using laraval mix.
rcarmich and nolanpro
Metadata
Metadata
Assignees
Labels
No labels