I have already installed all the latest LTS versions of Babel but everytime I try Mocha this error is throwed. I suspect there is some dependency that is calling it, but if that's the case I have no idea what can be done.
I'm using Mocha and Chai to (try to) test my units. Thing is, everytime I run test
the Requires Babel "^7.0.0-0", but was loaded with "6.26.3".
error is throwed. I already updated babel-core
and babel-register
to their @
versions and even uninstalled the old ones but nothing changes.
I have also tried to change my test
script from:
"test": "nyc ./node_modules/.bin/mocha tests/**/*.spec.js --require
babel-register"
To:
"test": "nyc ./node_modules/.bin/mocha tests/**/*.spec.js --require @babel-register"
But it misses the module.
In my research I have only seen fixes for Jest - not for Mocha. In case the error persists I think I'll be going to change testing frameworks.
I have also found a similar question here in Stack Overflow but no answer was given.
Here is my devDependecies
:
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-transform-destructuring": "^7.4.3",
"@babel/register": "^7.4.0",
"babel-loader": "^8.0.5",
"babel-preset-env": "^1.7.0",
"chai": "^4.2.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"husky": "^1.3.1",
"mocha": "^6.1.3",
"nyc": "^13.3.0",
"prettier": "^1.17.0",
"prettier-eslint": "^8.8.2",
"prettier-eslint-cli": "^4.7.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.3.1"
}
If possible, I would like to keep using Mocha, so if anyone could help me out of this I would very much appreciate.
EDIT:
Here is my .babelrc
file:
{
"plugins": ["@babel/plugin-transform-destructuring"],
"presets": ["@babel/preset-env"]
}