-
Notifications
You must be signed in to change notification settings - Fork 158
Closed
Description
I have a Vue file which imports a Vue file from node_modules. This file seems to not be recognize as a vue file when imported and doesn't use vue-jest.
I tried to use an htmlLoader, but doesn't work either.
Here is the error I get :
path/node_modules/vue-loading-spinner/src/components/Jumper.vue:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){<template>
SyntaxError: Unexpected token <
Here is my jest.conf.js :
const path = require('path')
module.exports = {
rootDir: path.resolve(__dirname, '../../'),
moduleFileExtensions: [
'js',
'vue',
'html'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.vue$': '<rootDir>/node_modules/vue-jest',
"^.+\\.html$": "<rootDir>/test/utils/htmlLoader.js"
},
testPathIgnorePatterns: [
"<rootDir>/node_modules/"
],
modulePaths: [
"<rootDir>"
],
setupFiles: ['<rootDir>/test/unit/setup'],
testMatch: [
'<rootDir>/(test/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))'
]
}
And here is my test file ( I know there is no test in this file, but not necessary at the moment if I can mount my component ) :
import { shallowMount } from "@vue/test-utils"
import Card from '@/components/Card'
import { propsSet } from '../../datas/components/Card'
import Brace from 'vue-bulma-brace'
describe('FreeSql Unit Tests', () => {
test('FreeSql : Display correct', () => {
const wrapper = shallowMount(FreeSql, {
propsData:{
...propsSet
},
stubs:{
Brace
}
})
})
})
Thanks for your help.
cezar77, TauilDiego, GabrielNunes12, YWoooo, manuel-84 and 1 more
Metadata
Metadata
Assignees
Labels
No labels