Skip to content
New issue

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

fix(create-local-vue): fix max range stack size (fix #1768) #1786

Merged
merged 2 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/shared/create-local-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function _createLocalVue(
instance.config = cloneDeep(Vue.config)

// if a user defined errorHandler is defined by a localVue instance via createLocalVue, register it
instance.config.errorHandler = config.errorHandler || Vue.config.errorHandler
instance.config.errorHandler = config.errorHandler

// option merge strategies need to be exposed by reference
// so that merge strats registered by plugins can work properly
Expand Down
23 changes: 23 additions & 0 deletions test/specs/create-local-vue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,27 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
}
}
)

// This test is related to the issue 1768.
// See: https://github.com/vuejs/vue-test-utils/issues/1768
itSkipIf(
process.env.TEST_ENV === 'browser' || vueVersion < 2.6,
'Does not exceed maximum call stack size when no custom error handler is defined',
async () => {
const { error } = global.console
const spy = jest.spyOn(global.console, 'error')
const localVue = createLocalVue()

try {
mountingMethod(ComponentWithSyncError, { localVue })
} catch {
const expected = expect.stringMatching(
/Maximum call stack size exceeded/
)

global.console.error = error
expect(spy).not.toHaveBeenCalledWith(expected)
}
}
)
})