We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"vue": "^3.2.0", "jest": "^26.6.3", "vue-jest": "^5.0.0-alpha.10" "@vue/test-utils": "^2.0.0-beta.14",
When I set the testEnvironment: 'node' of jest, the mount function will report ReferenceError: document is not defined. How should I configure ssr?
testEnvironment: 'node'
mount
ReferenceError: document is not defined
{ transform: { '^.+\\.[jt]sx?$': require.resolve('babel-jest'), '^.+\\.vue$': require.resolve('vue-jest'), }, testEnvironment: 'node', }
import { mount } from '@vue/test-utils'; import Button from '../index'; describe('Button', () => { test('should emit click event', () => { const wrapper = mount(Button); wrapper.find('button').trigger('click'); expect(wrapper.emitted('click')).toHaveLength(1); }); test('should not emit click event when disabled', () => { const wrapper = mount(Button, { props: { disabled: true, }, }); wrapper.find('button').trigger('click'); expect(wrapper.emitted('click')).toBeUndefined(); }); });
The text was updated successfully, but these errors were encountered:
We will need to implement something like https://vue-test-utils.vuejs.org/api/#rendertostring from VTU v1, I think. We don't have any test coverage or examples around SSR at all yet.
Is this something you'd like to explore? The implementation in VTU v1 is pretty simple.
Sorry, something went wrong.
Duplicates of #507
No branches or pull requests
Basic Info
"vue": "^3.2.0",
"jest": "^26.6.3",
"vue-jest": "^5.0.0-alpha.10"
"@vue/test-utils": "^2.0.0-beta.14",
Problem
When I set the
testEnvironment: 'node'
of jest, themount
function will reportReferenceError: document is not defined
. How should I configure ssr?Config
Test
The text was updated successfully, but these errors were encountered: