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

feat: Adds provide to the global config. #555

Merged
merged 1 commit into from Apr 25, 2018

Conversation

jeremyzahner
Copy link
Contributor

While working on our current project, we noticed that mocking global provides (usually provided by the root Vue instance) is quite painful because it needs to be added to every single mount()/shallow() in the tests.

This implements the config abilities that the mocks, stubs and methods also have.

The only feature that we can not easily support is the merging of functions (obviously). We did implement an error to signal this very clearly.

@@ -44,4 +56,38 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {

expect(wrapper.vm.setInBeforeCreate).to.equal('created')
})

it('injects the provide from the config', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the itDoNotRunIf and injectSupported functions to only run for Vue versions which support inject/provide. Example—https://github.com/vuejs/vue-test-utils/blob/dev/test/specs/mounting-options/provide.spec.js#L9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyerburgh Done in 0ee6ce8. Did amend the existing commit.

Copy link
Member

@eddyerburgh eddyerburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, all we need is to skip the tests in Vue < 2.2 and I'm happy to merge

@jeremyzahner
Copy link
Contributor Author

@eddyerburgh Ready to merge.

Copy link
Member

@eddyerburgh eddyerburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job :)

@eddyerburgh eddyerburgh merged commit 807d3c8 into vuejs:dev Apr 25, 2018
@maennchen maennchen deleted the feature/feat-provide-inject branch June 15, 2018 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants