File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change
1
+ import { throwError } from './util'
2
+
3
+ if ( typeof window === 'undefined' ) {
4
+ throwError (
5
+ 'window is undefined, vue-test-utils needs to be run in a browser environment.\n' +
6
+ 'You can run the tests in node using jsdom + jsdom-global.\n' +
7
+ 'See https://vue-test-utils.vuejs.org/en/guides/common-tips.html for more details.'
8
+ )
9
+ }
Original file line number Diff line number Diff line change 1
1
// @flow
2
2
3
+ import './lib/warn-if-no-window'
3
4
import Vue from 'vue'
4
5
import VueWrapper from './wrappers/vue-wrapper'
5
6
import createInstance from './lib/create-instance'
6
- import { throwError } from './lib/util'
7
7
import cloneDeep from 'lodash/cloneDeep'
8
8
import createElement from './lib/create-element'
9
9
import './lib/matches-polyfill'
10
10
11
11
Vue . config . productionTip = false
12
12
13
13
export default function mount ( component : Component , options : Options = { } ) : VueWrapper {
14
- if ( ! window ) {
15
- throwError (
16
- 'window is undefined, vue-test-utils needs to be run in a browser environment.\n' +
17
- 'You can run the tests in node using jsdom + jsdom-global.\n' +
18
- 'See https://vue-test-utils.vuejs.org/en/guides/common-tips.html for more details.'
19
- )
20
- }
21
-
22
14
const componentToMount = options . clone === false ? component : cloneDeep ( component )
23
15
// Remove cached constructor
24
16
delete componentToMount . _Ctor
Original file line number Diff line number Diff line change 1
1
// @flow
2
2
3
+ import './lib/warn-if-no-window'
3
4
import Vue from 'vue'
4
5
import cloneDeep from 'lodash/cloneDeep'
5
6
import {
You can’t perform that action at this time.
0 commit comments