Hi,
I'm on page 49 and can't get a SFC to load correctly. I get this without an import statement:
> jest --config test/unit/jest.conf.js --coverage
PASS test/unit/specs/sanity_check.spec.js
FAIL test/unit/specs/Dashboard.spec.js
? Console
console.error node_modules/vue/dist/vue.runtime.common.js:1739
TypeError: this.$intro is not a function
so I add this to my test from main.js:
import VueIntro from 'vue-introjs'
Test is now:
import { shallow } from 'vue-test-utils'
import Dashboard from '@/components/Dashboard.vue'
import VueIntro from 'vue-introjs'
describe('Dashboard.vue', () => {
it('should show the word Overview', () => {
const wrapper = shallow(Dashboard)
expect(wrapper.text()).toContain('Overview')
})
})
and I get:
> jest --config test/unit/jest.conf.js --coverage
FAIL test/unit/specs/Dashboard.spec.js
? Test suite failed to run
/home/ghenry/src/App/node_modules/vue-introjs/src/index.js:2
import { DIRECTIVES } from './directives';
^^^^^^
SyntaxError: Unexpected token import
1 | import { shallow } from 'vue-test-utils'
2 | import Dashboard from '@/components/Dashboard.vue'
> 3 | import VueIntro from 'vue-introjs'
4 |
5 | describe('Dashboard.vue', () => {
6 | it('should show the word Overview', () => {
at ScriptTransformer._transformAndBuildScript (node_modules/jest-cli/node_modules/jest-runtime/build/script_transformer.js:316:17)
at Object.<anonymous> (test/unit/specs/Dashboard.spec.js:3:19)
so I'm guessing the import is not transformed by Jest.
Any tips here? I'd like to just import my SFC and Jest figures the rest out.
|