Open bissolli opened 5 years ago
Hey! Thank you for the issue. I'll try to fix it until the end of the week.
@bissolli I check this and it looks like a problem in your config. This issue looks very similar: https://github.com/facebook/react/issues/14399
@lukaszflorczak I've run into the same error as well. I am not sure how the fix above will fix it.
I'm also running into this issue. If anyone has Jest working for a component using Vue-agile please share your configuration.
Here is my jest.config.js
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue'
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest'
},
transformIgnorePatterns: [
'/node_modules/'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
snapshotSerializers: [
'jest-serializer-vue'
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
testURL: 'http://localhost/',
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
]
}
And my babel config:
module.exports = {
presets: ['@babel/env'],
overrides: [
{
test: './src',
presets: ['@vue/app']
},
{
test: './styleguide',
presets: ['@babel/react']
}
]
}
I'm using the in component approach, similar to bissolli and have tried the global approach where I had a similar issue.
I suspect some configuration change might be the solution here, but I'm not sure what exactly needs to be configured or why?
I have found a solution to this problem. In your jest configuration you need to exclude vue-agile from the transformIgnorePatterns
like this
transformIgnorePatterns: [ '/node_modules/(?!vue-agile)' ],
For anyone using nuxt, I had the same error. Adding vue-agile
to the transpile options in nuxt.config.js fixed it:
build: {
transpile: [
'vue-agile'
],
}
Thanks @JakeBeresford for clueing me in on the fix!
@amitkumar you lifesaver!
This was driving me nuts and I thought I was going to have to remove this really nice lib from the project.
@lukaszflorczak - any way you can solve this in core?
@davestewart I would like, but I'm not sure where the problem is.
I also had this issue while using vue-agile w/ Nuxt. However, adding to transpile as @amitkumar stated resolved the issue! Cheers!
Hi guys,
I am trying to test a component which uses VueAgile locally register and I am getting the following error:
This is my component:
Any idea on how to fix it?