-
Notifications
You must be signed in to change notification settings - Fork 112
render
requires projects to add vuex
as a dependency
#259
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
Comments
Hi! Just gave it a go locally, and Vuex isn't required (and thus nothing fails) unless a |
@afontcu I don't believe any of our tests are setting a store. For additional context, the test suites with which I'm working are for a component library. All our current tests are using The only suite that uses the testing library in our project is the following very simple one below. We're currently using Mocha, and plan to swap over to Jest soon. import { render } from '@testing-library/vue';
import { PCard } from '@/components/PCard';
describe('PCard', () => {
it('renders slotted-in content', () => {
render(PCard, { slots: { default: 'Hello world' } }).getByText('Hello world');
});
}); My error output when running that test is as follows: ERROR Failed to compile with 1 error
This dependency was not found:
* vuex in ./node_modules/@testing-library/vue/dist/render.js
To install it, you can run: npm install --save vuex
[=========================] 100% (completed)
WEBPACK Failed to compile with 1 error(s)
Error in ./node_modules/@testing-library/vue/dist/render.js
Module not found: 'vuex' in '/<my-project-directory>/node_modules/@testing-library/vue/dist'
ERROR mochapack exited with code 1.
npm ERR! Test failed. See above for more details. |
Hi @adam-gipril! Thanks for the update. I'll take a look soon and ping you back |
@adam-gipril could you provide a small reproduction link – with your mocha setup? I can't find a way to reproduce it in several codebases, and now I'm starting to think it has to do with the test runner somehow |
@afontcu I'll get you something and ping again. Might not be today — the repo in question is private, and I'll see if I can create a similar testing setup in a small public repo. |
Hi @adam-gipril – and happy new year! Could you check if this had something to do with the test runner? |
Description
This project lists
vuex
as a dev dependency, but then the implementation ofrender
requiresvuex
. As a result, consuming projects that may not usevuex
in their project code need to add it as a dev dependency to userender
in the test environment.Steps to reproduce
@testing-library/vue
, or add@testing-library/vue
to an existing project.vuex
is not a dependency in the project.render
.vuex
.Expected behavior
I'd expect
vuex
to be a dependency and not a dev dependency of this project as one of its key exports requiresvuex
.Related information
@testing-library/vue
version:5.8.2
Vue
version:>= 2.6.11 < 3
node
version:12.22.7
npm
(oryarn
) version:npm 6.14.15
The text was updated successfully, but these errors were encountered: