Skip to content

Window is undefined, vue-test-utils needs to be run in a browser environment. #999

@DylanC

Description

@DylanC

Version

1.0.0-beta.24

Steps to reproduce

Packages:

  • "@vue/test-utils": "^1.0.0-beta.24"
  • "jest-serializer-vue": "^2.0.2"
  • "jest": "^23.6.0"
  • "babel-jest": "^21.2.0"

Run jest --config test/unit/jest.conf.js

My config file:
`const path = require('path')

module.exports = {
rootDir: path.resolve(__dirname, '../../'),
testEnvironment: 'node',
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.)$': '/src/$1'
},
transform: {
'^. \.js$': '/node_modules/babel-jest',
'.
\.(vue)$': '/node_modules/vue-jest'
},
snapshotSerializers: ['/node_modules/jest-serializer-vue'],
setupFiles: ['/test/unit/setup'],
collectCoverage:false,
coverageThreshold: {
"global": {
"branches": 0,
"functions": 0,
"lines": 0
}
}
}`

What is expected?

Tests should have a status of PASS.

What is actually happening?

All tests have a status of FAIL for the reason above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions