Skip to content

Cannot reassign same class name to stub Component - circular reference #659

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

Closed
trollepierre opened this issue May 25, 2018 · 2 comments
Closed
Labels

Comments

@trollepierre
Copy link
Contributor

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)
@trollepierre
Copy link
Contributor Author

@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

@eddyerburgh
Copy link
Member

I'll make a release later this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants