Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[vue-jest] Error: Vue template compilation failed #563

Copy link
Copy link
@498755303

Description

@498755303
Issue body actions

When executing the test, an error occurred [vue-jest] Error: Vue template compilation failed

package.json
"vue": "^2.7.0",
"vue-template-compiler": "^2.7.0",
"@babel/core": "^7.21.0",
"@babel/eslint-parser": "^7.12.16",
"@babel/preset-env": "7.18.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
"@vue/test-utils": "^1.1.3",
"@vue/vue2-jest": "^27.0.0-alpha.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^27.0.6",
"jest": "^27.0.5",
"jest-environment-jsdom": "^27.0.6"

jest.config.js

const path = require('path');

module.exports = {
preset: '@vue/cli-plugin-unit-jest',
rootDir: path.resolve(__dirname, '../'),
testEnvironment: 'jsdom',
testMatch: [
'/src/views/other/unit-demo/**/.spec.js',
],
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
transform: {
'^.+\.vue$': '@vue/vue2-jest',
'.+\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\.[t|j]sx?$': 'babel-jest',
},
moduleNameMapper: {
'^@/(.
)$': '/src/$1'
},
collectCoverage: true,
coveragePathIgnorePatterns: ['/node_modules'],
coverageDirectory: '/tests/coverage',
reporters: [
'default',
['./node_modules/jest-html-reporter', {
pageTitle: 'report',
outputPath: './tests/report/test-report.html',
}],
]
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.