@@ -3468,25 +3468,23 @@ function createInterceptPlugin (interceptedProperties) {
34683468}
34693469
34703470function addAttrs ( vm , attrs ) {
3471- var consoleWarnSave = console . error ;
3472- console . error = function ( ) { } ;
3471+ Vue . config . silent = true ;
34733472 if ( attrs ) {
34743473 vm . $attrs = attrs ;
34753474 } else {
34763475 vm . $attrs = { } ;
34773476 }
3478- console . error = consoleWarnSave ;
3477+ Vue . config . silent = false ;
34793478}
34803479
34813480function addListeners ( vm , listeners ) {
3482- var consoleWarnSave = console . error ;
3483- console . error = function ( ) { } ;
3481+ Vue . config . silent = true ;
34843482 if ( listeners ) {
34853483 vm . $listeners = listeners ;
34863484 } else {
34873485 vm . $listeners = { } ;
34883486 }
3489- console . error = consoleWarnSave ;
3487+ Vue . config . silent = false ;
34903488}
34913489
34923490function addProvide ( component , options ) {
@@ -3505,6 +3503,12 @@ function addProvide (component, options) {
35053503
35063504//
35073505
3506+ function compileTemplate ( component ) {
3507+ Object . assign ( component , vueTemplateCompiler . compileToFunctions ( component . template ) ) ;
3508+ }
3509+
3510+ //
3511+
35083512function createConstructor ( component , options ) {
35093513 var vue = options . localVue || Vue ;
35103514
@@ -3532,6 +3536,10 @@ function createConstructor (component, options) {
35323536 stubComponents ( component , options . stubs ) ;
35333537 }
35343538
3539+ if ( ! component . render && component . template && ! component . functional ) {
3540+ compileTemplate ( component ) ;
3541+ }
3542+
35353543 var Constructor = vue . extend ( component ) ;
35363544
35373545 if ( options . intercept ) {
@@ -3589,7 +3597,11 @@ function mount (component, options) {
35893597 if ( options === void 0 ) options = { } ;
35903598
35913599 if ( ! window ) {
3592- throwError ( 'window is undefined, vue-test-utils needs to be run in a browser environment.\n You can run the tests in node using JSDOM' ) ;
3600+ throwError (
3601+ 'window is undefined, vue-test-utils needs to be run in a browser environment.\n' +
3602+ 'You can run the tests in node using jsdom + jsdom-global.\n' +
3603+ 'See https://vue-test-utils.vuejs.org/en/guides/general-tips.html for more details.'
3604+ ) ;
35933605 }
35943606
35953607 var componentToMount = options . clone === false ? component : cloneDeep_1 ( component ) ;
@@ -3646,6 +3658,11 @@ function createLocalVue () {
36463658 // so that merge strats registered by plguins can work properly
36473659 instance . config . optionMergeStrategies = Vue . config . optionMergeStrategies ;
36483660
3661+ // make sure all extends are based on this instance.
3662+ // this is important so that global components registered by plugins,
3663+ // e.g. router-link are created using the correct base constructor
3664+ instance . options . _base = instance ;
3665+
36493666 // compat for vue-router < 2.7.1 where it does not allow multiple installs
36503667 var use = instance . use ;
36513668 instance . use = function ( plugin ) {
0 commit comments