Vue-test-utils: Cannot reassign same class name to stub Component - circular reference

Created on 25 May 2018  路  2Comments  路  Source: vuejs/vue-test-utils

Version

1.0.0-beta.16

Reproduction link

http://google.com

Steps to reproduce

Error: [vue-test-utils]: options.stub cannot contain a circular reference

import { mount } from '@vue/test-utils'
import Component from './Component.vue'

describe('components | Component', () => {
  const stubs = {
    AppButton: '<div class="app-button"/>',
  }

  describe('template', () => {
    it('should mount', () => {
      mount(Component, { stubs })
    })
  })
})

<template>
    <app-button/>
</template>

<script>
  import AppButton from '../../../common/app-button/AppButton.vue'

  export default {
    name: 'Component',
    components: {
      AppButton,
    },
  }
</script>

<template>
  <div class="app-button"/>
</template>

<script>
  export default {
    name: 'AppButton',
  }
</script>

What is expected?

No error

What is actually happening?

Error: [vue-test-utils]: options.stub cannot contain a circular reference
at throwError (mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:11:9)
at createStubFromString (mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:3968:5)
at mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:4019:30
at Array.forEach (<anonymous>)
at createComponentStubs (mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:3999:24)
at createInstance (mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:4208:24)
at mount (mypath/node_modules/@vue/test-utils/dist/vue-test-utils.js:5376:12)
at Object.<anonymous> (mypath/src/components/pages/request-workers-edition/aside-manager/Component.spec.js:11:7)
at Object.asyncFn (mypath/node_modules/jest-jasmine2/build/jasmine_async.js:82:37)
at resolve (mypath/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
at new Promise (<anonymous>)
at mapper (mypath/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
at promise.then (mypath/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
bug

Most helpful comment

I'll make a release later this week

All 2 comments

@eddyerburgh : when will be the next release of vue-test-utils ?
I want to test this issue, and I have found maybe other issues that might be already solved...
Thanks

I'll make a release later this week

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kjugi picture kjugi  路  3Comments

chenxeed picture chenxeed  路  3Comments

vilarinholeo picture vilarinholeo  路  3Comments

vwxyutarooo picture vwxyutarooo  路  3Comments

matt-sanders picture matt-sanders  路  3Comments