envs icon indicating copy to clipboard operation
envs copied to clipboard

Jest tester fails to parse the config file

Open alvarezGarciaMarcos opened this issue 5 years ago • 4 comments

Description

Jest gives a syntax error on the jest.config.js without even touching the configuration file.

Specifications

  • Bit version: 14.7.4
  • Node version: 12.16.0
  • npm / yarn version: 6.13.4
  • Platform: Linux Mint
  • Compiler / Tester (include version):
    • React compiler: 1.0.14
    • Jest tester: 22.4.3

Context and additional information

I am trying to develop a React application, and trying to use Jest as my tester. I init bit in the repo, added the compiler, tester and tracking files, and, when trying to execute 'bit test component-name' the error is thrown.

alvarezGarciaMarcos avatar Feb 18 '20 10:02 alvarezGarciaMarcos

The error itself is this one Jest failure Command failed: "/usr/local/bin/node" /home/marcos/Documentos/Programming/react-components/.bit/components/testers/jest/bit.envs/22.4.3/node_modules/jest/bin/jest.js dist/src/tests/InputText.test.js --rootDir=dist/src/tests --config=/home/marcos/Documentos/Programming/react-components/.bit/components/testers/jest/bit.envs/22.4.3/dist/jest.config.js --json --outputFile="InputText-results.json" Unrecognized options: rootDir Error: Jest: Failed to parse config file /home/marcos/Documentos/Programming/react-components/.bit/components/testers/jest/bit.envs/22.4.3/dist/jest.config.js Error: Parse error on line 1: "use strict";module.exports = ------------^ Expecting 'EOF', '}', ':', ',', ']', got 'undefined' at Object.parseError (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/vendor/jsonlint.js:57:19) at Object.parse (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/vendor/jsonlint.js:134:30) at Object.exports.parse (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/vendor/jsonlint.js:420:56) at Object.exports.errors (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/vendor/jsonlint.js:419:50) at parse (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/loadFromFile.js:23:32) at /home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/loadFromFile.js:31:20 at parse (/home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/loadFromFile.js:24:15) at /home/marcos/Documentos/Programming/react-components/node_modules/jest-config/build/loadFromFile.js:31:20 "/usr/local/bin/node" /home/marcos/Documentos/Programming/react-components/.bit/components/testers/jest/bit.envs/22.4.3/node_modules/jest/bin/jest.js dist/src/tests/InputText.test.js --rootDir=dist/src/tests --config=/home/marcos/Documentos/Programming/react-components/.bit/components/testers/jest/bit.envs/22.4.3/dist/jest.config.js --json --outputFile="InputText-results.json" (exited with error code 1)

alvarezGarciaMarcos avatar Feb 18 '20 11:02 alvarezGarciaMarcos

We plan to re-write jest tester from scratch. it's not very stable and updated right now. It will probably take a few weeks, but it will be much better, performant and stable.

GiladShoham avatar Feb 20 '20 10:02 GiladShoham

@GiladShoham any news on the re-write? I'd need to use the Jest tester but I need to follow the vague instructions here https://discourse.bit.dev/t/can-i-modify-a-build-test-environments/28 and if there is a new version coming I'd rather wait for that first rather than modify something that is already out of date.

alextuppen avatar May 23 '20 14:05 alextuppen

@Exitialis1 We almost done with the re-write, but we re-write it based on a complete new extensions infrastructure that will be out in the next major version of bit. It's now much faster and better and much more stable. There is also another version with some minor changes I did for someone (which also support snapshots), but it's pretty new and not well tested / production ready yet. But you can play with it here - https://bit.dev/giladshoham/for-krazybee/testers/jest (It's not the same one we were re-write, just something quick to support screenshots) Also @JoshK2 was looking on the jest recently. maybe he has some inputs.

GiladShoham avatar Jun 02 '20 17:06 GiladShoham