Skip to content

[Bug Report] ReferenceError: IntersectionObserver is not defined in tests with vuetify 2.5.0 #13644

@josephlbarnett

Description

@josephlbarnett

Environment

Vuetify Version: 2.5.0
Last working version: 2.4.11
Vue Version: 2.6.12
Browsers: Firefox 88.0
OS: Linux

Steps to reproduce

With vuetify 2.5.0, jest tests have started failing with ReferenceError: IntersectionObserver is not defined when mounting components.

An example stacktrace:

    ReferenceError: IntersectionObserver is not defined

      29 |   mockRouter = { push: jest.fn() }
      30 | ) {
    > 31 |   return mount(Login, {
         |          ^
      32 |     stubs: ["router-view", "v-snackbar", "router-link"],
      33 |     apolloProvider: new VueApollo({
      34 |       defaultClient: mockClient,

      at fn (node_modules/vuetify/dist/vuetify.js:33341:18)
      at callHook$1 (node_modules/vue/dist/vue.runtime.common.dev.js:6658:7)
      at apply (node_modules/vue/dist/vue.runtime.common.dev.js:6597:9)
      at apply (node_modules/vue/dist/vue.runtime.common.dev.js:2231:10)
      at invokeWithErrorHandling (node_modules/vue/dist/vue.runtime.common.dev.js:1850:26)
      at Object.insert (node_modules/vue/dist/vue.runtime.common.dev.js:2171:9)
      at invokeInsertHook (node_modules/vue/dist/vue.runtime.common.dev.js:6326:28)
      at VueComponent.__patch__ (node_modules/vue/dist/vue.runtime.common.dev.js:6543:5)
      at VueComponent._update (node_modules/vue/dist/vue.runtime.common.dev.js:3933:19)
      at VueComponent.call (node_modules/vue/dist/vue.runtime.common.dev.js:4054:10)
      at Watcher.get (node_modules/vue/dist/vue.runtime.common.dev.js:4465:25)
      at new Watcher (node_modules/vue/dist/vue.runtime.common.dev.js:4454:12)
      at mountComponent (node_modules/vue/dist/vue.runtime.common.dev.js:4061:3)
      at VueComponent.$mount (node_modules/vue/dist/vue.runtime.common.dev.js:8392:10)
      at mount (node_modules/@vue/test-utils/dist/vue-test-utils.js:14062:21)
      at mountLogin (tests/unit/components/Login.spec.ts:31:10)
      at Object.<anonymous> (tests/unit/components/Login.spec.ts:49:19)

Installing intersection-observer does not appear to fix.

Was also getting ReferenceError: ShadowRoot is not defined, but installing jest >= 26 (24 was getting installed with previous package.json) appears to have fixed that per comments in vuejs/core#2943

Expected Behavior

tests pass

Actual Behavior

tests fail

Reproduction Link

https://github.com/josephlbarnett/quizzy/tree/dependabot-npm_and_yarn-client-vuetify-2.5.0/client
build log

Metadata

Metadata

Assignees

Labels

T: bugFunctionality that does not work as intended/expectedtesting

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions