Composition testing #984
Unanswered
martijn788
asked this question in
Q&A
Replies: 1 comment
-
Right now you cannot test something using provide/inject outside of If you share your full code, I could make some suggestions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you want to test seperate composition-files, without a vue-context, you get warnings about using certain functions outside of the setup function.
Example:
export function doingMagic(input: string): string { // some magic code that uses provide or inject on the background. }
Example test:
it('does some real magic') { const data = doingMagic('magical input) expect(data).to.equal('output Magic') }
Example console:
[Vue warn]: provide() can only be used inside setup().
So the test passed, but I want to get rid of the error.
What is the best way to solve this problem?
Beta Was this translation helpful? Give feedback.
All reactions