Open slaweet opened 3 years ago
I ended up resolving the above error by modifying my jest.config.js file to include the following so I don't have to mock out vue-json-compare in each test file:
module.exports = { preset: '@vue/cli-plugin-unit-jest', moduleNameMapper: { '\\.(css|less|gql|sass|scss)$': 'jest-transform-stub', }, transformIgnorePatterns: [ 'node_modules/(?!vue-json-compare)', ], };
However, you are correct in that with other 3rd party modules I did not have to do this.
When I'm testing my component with https://cli.vuejs.org/core-plugins/unit-jest.html and my component contains
import vueJsonCompare from 'vue-json-compare'
, then the Jest test runner fails with:I can resolve the error by mocking
vue-json-compare
withBut with all other 3-rd party modules, I don't have to do this.