Reputation: 3447
I am trying to run some tests with Jest, and the project is throwing these errors:-
FAIL src/imports/components/Forms/__tests__/FilterForm.test.jsx
● Test suite failed to run
Plugin/Preset files are not allowed to export objects, only functions. In \node_modules\babel-preset-react\lib\index.js
at createDescriptor (../../../AppData/Roaming/nvm/v10.18.1/node_modules/jest-cli/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
at Array.map (<anonymous>)
my package.json looks like this:-
"devDependencies": {
"autoprefixer": "6.5.4",
"babel-cli": "6.18.0",
"babel-core": "6.20.0",
"babel-eslint": "7.1.1",
"babel-jest": "18.0.0",
"babel-loader": "^7.1.5",
"babel-plugin-transform-react-constant-elements": "6.9.1",
"babel-plugin-transform-react-remove-prop-types": "0.2.11",
"babel-plugin-transform-runtime": "6.23.0",
"babel-polyfill": "6.20.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-latest": "6.16.0",
"babel-preset-react": "6.16.0",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-0": "6.24.1",
"babel-preset-stage-1": "6.16.0",
"browser-sync": "^2.26.12",
"chai": "4.1.2",
"chalk": "1.1.3",
"connect-history-api-fallback": "1.3.0",
"copy-webpack-plugin": "4.2.0",
"coveralls": "2.11.15",
"css-loader": "0.26.1",
"enzyme": "3.3.0",
"enzyme-adapter-react-15.4": "1.0.5",
"eslint": "3.12.2",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-react": "6.8.0",
"eslint-watch": "2.1.14",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "0.9.0",
"html-webpack-plugin": "2.24.1",
"identity-obj-proxy": "3.0.0",
"jest": "23.4.2",
"json-loader": "0.5.4",
"mockdate": "2.0.1",
"node-sass": "^4.14.1",
"npm-run-all": "4.1.2",
"open": "0.0.5",
"postcss-loader": "1.2.1",
"prompt": "1.0.0",
"react-addons-test-utils": "15.4.1",
"redux-immutable-state-invariant": "1.2.4",
"replace": "0.3.0",
"rimraf": "2.5.4",
"sass-loader": "7.1.0",
"sinon": "4.1.2",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
"webpack": "2.2.1",
"webpack-bundle-analyzer": "2.1.1",
"webpack-dev-middleware": "1.9.0",
"webpack-hot-middleware": "2.13.2",
"webpack-md5-hash": "0.0.5"
},
and the babel config file looks like this:-
{
"presets": [
"react",
"es2015",
"stage-0",
"stage-1"
],
"env": {
"development": {
"presets": [
"latest",
"react-hmre"
],
"plugins": ["transform-runtime"]
},
"production": {
"presets": [
["latest", {
"es2015": {
"modules": false
}
}]
],
"plugins": [
"transform-react-constant-elements",
"transform-react-remove-prop-types"
]
},
"test": {
"presets": [
"latest"
]
}
}
}
This is the FilterForm.test.jsx imports:-
import React from 'react';
import moment from 'moment';
import sinon from 'sinon';
import { expect } from 'chai';
import { shallow, mount, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15.4';
import { Form } from 'react-bootstrap';
import FilterForm from '../FilterForm';
import TextField from '../../Fields/Text';
From what I was researching, it seems that I have an old babel iteration? If it is, how can I upgrade to the newest? I tried removing babel and re-installing it but did not work.
Any help would be very much appreciated!
Thanks
Upvotes: 0
Views: 1250
Reputation: 7439
Jest 24 dropped support for Babel 6. You can either upgrade to Babel 7 or stay on the the Jest 23.x series
Upvotes: 1