I'm trying to write some tests with JEST and graphql but am getting the following error no matter what I have in my .test.js files (even when having no code at all in it).
Plugin/Preset files are not allowed to export objects, only functions. In /Users/oscarstein/Documents/Projekt/Biljettsystem/ticketgo/system/node_modules/babel-preset-stage-2/lib/index.js
My .babelrc file looks as follows:
{
"presets": ["env", "stage-2"]
}
So the error comes from me using the preset "stage-2" and when i remove it everything works fine with the tests. But since my application is built with stage-2 I was wondering if there is any workaround using both "stage-2" and getting the JEST tests to work?
package.json file
{
"name": "system",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon --exec babel-node index.js",
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"apollo-server": "^2.1.0",
"apollo-server-express": "^2.1.0",
"bcrypt": "^3.0.2",
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"graphql": "^14.0.2",
"jest": "^24.0.0",
"jsonwebtoken": "^8.3.0",
"mysql2": "^1.6.4",
"nodemailer": "^4.6.8",
"nodemon": "^1.18.6",
"pg": "^7.6.0",
"sequelize": "^4.41.1",
"stripe": "^6.22.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1"
}
}