cucumber-json-formatter for macOS is not working (cucumber-json-formatter ENOENT)
After run the tests an error is displayed:
An error was thrown in your plugins file while executing the handler for the after:run event.
The error we received was:
Error: spawn cucumber-json-formatter ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21)
I downloaded the file cucumber-json-formatter-darwin-amd64 and followed the steps as described in the readme, but this error is displayed.
Obs: I using macOS with apple silicon chip (M1)
My .cypress-cucumber-preprocessorrc.json file:
{ "json": { "enabled": true, "output": "jsonlogs/log.json", "formater": "cucumber-json-formatter" }, "messages": { "enabled": true, "output": "jsonlogs/messages.ndjson" }, "stepDefinitions": [ "[filepath]/**/.{js,ts}", "[filepath].{js,ts}", "cypress/support/step_definitions/.{js,ts}" ] }
I have same issue on Mac Error: spawn cucumber-json-formatter ENOENT
I am trying to migrate cypress to 10+, but I am getting an error while creating the cucumber report as below on M1 mac, could anyone please help me with it.
An error was thrown in your plugins file while executing the handler for the after:run event.
The error we received was:
Error: spawn cucumber-json-formatter ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21)
Have the same issue like above
Thank you!
FYI, this project and its authors have no relationship with Cypress nor the cypress-cucumber-preprocessor.
The errors mentioned here indicated that you have not successfully made the executable available in your PATH. The PATH variable has to include a directory containing cucumber-json-formatter (or whichever name you've configured) and it has to have execute permissions. Any failure in this results in ENOENT.
@badeball Thanks for the update,
cucumber-json-formatter is in path of cypress project and have the below config
{
"json": {
"enabled": true,
"output": "jsonlogs/log.json",
"formater": "cucumber-json-formatter"
},
"messages": {
"enabled": true,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": true
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}"
]
}
I did the samething on windows, its working fine, but facing this issue on mac Could you please provide little insight of it
Thank you!
Hi.
I have been trying to get the cucumber-json-formatter working on my MacBook. I have been using the instructions on their GitHub page - https://github.com/cucumber/json-formatter
I followed these steps (as suggested on the GitHub page):-
MacOS
-
- Download cucumber-json-formatter-darwin-amd64 and rename it to cucumber-json-formatter
-
- Move it to a directory that's on your PATH
-
- Make it executable with chmod +x cucumber-json-formatter
-
- Verify that you can run it: cucumber-json-formatter --help At the last step, you may get a security warning from MacOS. If you do, open System Preferences. Go to Security Settings. You should see a question asking if you want to open it anyway. Say yes.
When I run the command in step 4. I get the following error:- cucumber-json-formatter: command not found
Further information - I am doing this on a M1 MacBook.
@ashort-zaizi I have an M1 Mac and what I needed to do for step 4 to work was manually opening the cucumber-json-formatter file, only then my Mac allowed me to use it.
Besides that, make sure to open a new terminal session to read your updated PATH , run echo $PATH just for the sake of it and if you can see your folder containing the cucumber-json-formatter, then cucumber-json-formatter --help should work
Hi a8rejo. When you say manually open the cucumber-json-formatter, what do you mean? Double click on the file?
Hi @a8trejo I double clicked on the cucumber-json-formatter file, and allowed the permission, but the error is the same.
@ashort-zaizi yes, as @adinizs did
@adinizs when you run echo $PATH do you see the folder where your cucumber-json-formatter file is?
If it helps for reference, this is what I do on a Github Actions workflow to get it working too,
- name: Set Up Environment
run: |
mkdir cypress/config/cucumber_json
echo "${{ github.workspace }}/cypress/config/cucumber_json" >> $GITHUB_PATH
cd cypress/config/cucumber_json
curl https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-amd64 -o cucumber-json-formatter
chmod +x cucumber-json-formatter
Note: the curl is using the ubuntu file as the Github workflow uses an ubuntu image
as for how to set the folder where cucumber-json-formatter is located, into your PATH, if I have it in /Users/myUserName/Workspace/tools/path/cucumber-json-formatter I do it with:
vi ~/.zprofile
and I add:
# Cucumber Standalone JSON Formatter
CUSTOM_FOLDER=/Users/myUserName/Workspace/tools/path
export PATH=$CUSTOM_FOLDER:$PATH
I set this information in my .zprofile, but the error is the same. @a8trejo
# Cucumber Standalone JSON Formatter
CUSTOM_FOLDER=/Users/diniz/Projects/qa
export PATH=$CUSTOM_FOLDER:$PATH
@adinizs also close and reopen Visual Studio or the terminal so it reads the system variable again, if that still doesn't work, I'm out of ideas ^^
@adinizs what is the output of your echo $PATH ?
I got it!!
Steps for success:
MacOS
- Download cucumber-json-formatter-darwin-amd64 and rename it to cucumber-json-formatter
- Move it to a directory that's on your PATH
- Set in your ~/.zprofile the follow information:
# Cucumber Standalone JSON Formatter
CUSTOM_FOLDER=/Users/YourUser/Workspace/path
export PATH=$CUSTOM_FOLDER:$PATH
- Restart your terminal and VS Code (or your code editor)
- Make it executable with chmod +x cucumber-json-formatter
- Verify that you can run it: cucumber-json-formatter --help
Thank you @a8trejo !!
happy to help! :D
@badeball Thanks for the update,
cucumber-json-formatteris in path of cypress project and have the below config{ "json": { "enabled": true, "output": "jsonlogs/log.json", "formater": "cucumber-json-formatter" }, "messages": { "enabled": true, "output": "jsonlogs/messages.ndjson" }, "html": { "enabled": true }, "stepDefinitions": [ "[filepath]/**/*.{js,ts}", "[filepath].{js,ts}", "cypress/e2e/step_definitions/*.{js,ts}" ] }I did the samething on windows, its working fine, but facing this issue on mac Could you please provide little insight of it
Thank you!
I am able to solve it after following adinizs steps.
adinizs thanks!
I have added cucumber-json-formatter to my PATH . I have updated my system preferences to allow my MacBook to open the cucumber-json-formatter executable.
When I open a terminal window and run the following command :-- cucumber-json-formatter --help
I can see that I have configured my PATH variable correctly as I see this response in the terminal window:- Usage of cucumber-json-formatter:
When I open VSCode and open a terminal window within VSCode and run the following command:- cucumber-json-formatter --help
I get this response:- bash: cucumber-json-formatter: command not found
I have tried closing and re-opening VSCode, but I see the same error. Im very confused in what to do now. Any help would be much appreciated. Thanks!
I found the problem!!
in macOS we need to create a .bash_profile file, in this file we need to add environmental variables and add macOS path.
Maybe I don't describe very well the solution but I gonna attach a imag
Steps:
- macOS *Download cucumber-json-formatter-darwin-amd64 and rename it to cucumber-json-formatter *Move it to a directory that's on your PATH *Make it executable with chmod +x cucumber-json-formatter
2.Create file .bash_profile (/Users/your user)
- Add into .bash_prifile the next: export CUSTOM_FOLDER="directory that's on your PATH. the same in the step 1 " export PATH=$CUSTOM_FOLDER:$PATH
-
Open terminal an run an type source ~/.bash_profile (activate environment variables)
-
Verify that you can run it: cucumber-json-formatter --help
whit this step I can make a report

It depends on your MAC Operating system, ~/.bash_profile won't work for all MACs, ~/.zprofile works in mine, but the root cause/solution is the same
Make sure the system variable $PATH (nothing related to any cypress config file or path at all), includes the path where cucumber-json-formatter is
How to update the system variable $PATH , changes depending on the operating system
FIX:
Have stumbled a similar problem when I was following a certain course.
If ever your cucumber-json-formatter is moved inside your project, you only need to add "./" in your formatter path in order to run that executable file
and the ENOENT error will not persist anymore inside the terminal after running $cypress run and will generate the /jsonlogs folder based on your configuration
@KShewengger thank you, thank you!! "formatter": "./cucumber-json-formatter" fixed my issue.
Hello @badeball,
Firstly, many thanks for your helping library which is very useful.
I have followed exact steps but couldn't generate json file on my mac and also on linux. I have also followed all above suggestions but no luck, please can you help as I'm currently blocked :(? Below are details from my mac and our project is mono repo project.
@adinizs @KShewengger I have followed your steps too but no luck. Please help if you can.
Package.json
Formatter is present at root folder
PATH Variable
Added in .bash_profile
Result from command
Debug log
DevTools listening on ws://127.0.0.1:52532/devtools/browser/6d6f2fb9-1346-48bb-8097-555a1c01e87f cypress-cucumber-preprocessor resolved environment overrides {} +0ms cypress-cucumber-preprocessor resolved explicit user configuration { cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ] cypress-cucumber-preprocessor } +1ms cypress-cucumber-preprocessor resolved configuration { cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ], cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor html: { enabled: false, output: 'cucumber-report.html' }, cypress-cucumber-preprocessor pretty: { enabled: false }, cypress-cucumber-preprocessor filterSpecsMixedMode: 'hide', cypress-cucumber-preprocessor filterSpecs: false, cypress-cucumber-preprocessor omitFiltered: false, cypress-cucumber-preprocessor implicitIntegrationFolder: '/', cypress-cucumber-preprocessor isTrackingState: true cypress-cucumber-preprocessor } +1ms
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 13.13.0 │ │ Browser: Electron 118 (headless) │ │ Node Version: v20.12.2 (/Users/pavgurra/.nvm/versions/node/v20.12.2/bin/node) │ │ Specs: 1 found (upl-e2e-journeys.feature) │ │ Searched: apps/host-e2e/src/integration/e2e/upl/upl-e2e-journeys.feature │ │ Experiments: experimentalMemoryManagement=true │ └────────────────────────────────────────────────────────────────────────────────────────────────┘
cypress-cucumber-preprocessor beforeRunHandler() +2s cypress-cucumber-preprocessor resolved environment overrides {} +2ms cypress-cucumber-preprocessor resolved explicit user configuration { cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ] cypress-cucumber-preprocessor } +0ms cypress-cucumber-preprocessor resolved configuration { cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ], cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor html: { enabled: false, output: 'cucumber-report.html' }, cypress-cucumber-preprocessor pretty: { enabled: false }, cypress-cucumber-preprocessor filterSpecsMixedMode: 'hide', cypress-cucumber-preprocessor filterSpecs: false, cypress-cucumber-preprocessor omitFiltered: false, cypress-cucumber-preprocessor implicitIntegrationFolder: '/', cypress-cucumber-preprocessor isTrackingState: true cypress-cucumber-preprocessor } +0ms
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: upl-e2e-journeys.feature (1 of 1) cypress-cucumber-preprocessor beforeSpecHandler() +2s cypress-cucumber-preprocessor resolved environment overrides {} +66ms cypress-cucumber-preprocessor resolved explicit user configuration { cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ] cypress-cucumber-preprocessor } +0ms cypress-cucumber-preprocessor resolved configuration { cypress-cucumber-preprocessor stepDefinitions: [ './apps/host-e2e/src/support/step_definitions/.js' ], cypress-cucumber-preprocessor messages: { enabled: true, output: 'messages.ndjson' }, cypress-cucumber-preprocessor json: { enabled: true, output: 'jsonlogs' }, cypress-cucumber-preprocessor html: { enabled: false, output: 'cucumber-report.html' }, cypress-cucumber-preprocessor pretty: { enabled: false }, cypress-cucumber-preprocessor filterSpecsMixedMode: 'hide', cypress-cucumber-preprocessor filterSpecs: false, cypress-cucumber-preprocessor omitFiltered: false, cypress-cucumber-preprocessor implicitIntegrationFolder: '/Users/pavgurra/Desktop/Apps/Admiral/repo/ui-admiralmoney-public/apps/host-e2e/src/integration/e2e/upl', cypress-cucumber-preprocessor isTrackingState: true cypress-cucumber-preprocessor } +0ms cypress-cucumber-preprocessor resolving step definitions using template(s) [ './apps/host-e2e/src/support/step_definitions/.js' ] +0ms cypress-cucumber-preprocessor replacing [filepath] with 'upl-e2e-journeys' +0ms cypress-cucumber-preprocessor replacing [filepart] with [ 'upl-e2e-journeys' ] +0ms cypress-cucumber-preprocessor for 'apps/host-e2e/src/integration/e2e/upl/upl-e2e-journeys.feature' yielded patterns [ 'apps/host-e2e/src/support/step_definitions/.js' ] +1ms cypress-cucumber-preprocessor found step definitions [ cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_partner.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_motor_pos.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_motor.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_quote.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_motor.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_hub.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_help.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_auth.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock_app.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_mock.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_manual.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_independent.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_halo.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_common.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_accessibility.js', cypress-cucumber-preprocessor 'apps/host-e2e/src/support/step_definitions/steps_UPL.js' cypress-cucumber-preprocessor ] +4ms
End to End Regression Test Scenarios cypress-cucumber-preprocessor specEnvelopesHandler() +4s cypress-cucumber-preprocessor testCaseStartedHandler() +9ms cypress-cucumber-preprocessor testStepStartedHandler() +6ms cypress-cucumber-preprocessor testStepFinishedHandler() +70ms cypress-cucumber-preprocessor testCaseFinishedHandler() +6ms ✓ Test - UPL Journey (154ms)
1 passing (215ms)
cypress-cucumber-preprocessor afterSpecHandler() +17ms
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Tests: 1 │ │ Passing: 1 │ │ Failing: 0 │ │ Pending: 0 │ │ Skipped: 0 │ │ Screenshots: 0 │ │ Video: false │ │ Duration: 0 seconds │ │ Spec Ran: upl-e2e-journeys.feature │ └────────────────────────────────────────────────────────────────────────────────────────────────┘
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ✔ upl-e2e-journeys.feature 217ms 1 1 - - - │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ ✔ All specs passed! 217ms 1 1 - - -
Hi @PavanGurram-DevOps, I recommend that you use the latest version of @badeball/cypress-cucumber-preprocessor, for which the external cucumber-json-formatter is no longer necessary.
Thanks @badeball for the response.
I have resolved it just now. The issue is not with the version, it is with multiple plugins in cypress.config.js file and I ahve seen one more closed ticket which mentions to use cypress-on-fix library.
It would have been easier and time saving if this is mentioned in the documentation itslef so that it would have saved many hours of mine :)
But thats fine, the solution worked which is what needed.
Thanks again for your nice work :)
It would have been easier and time saving if this is mentioned in the documentation itslef so that it would have saved many hours of mine :)
This is mentioned in the FAQ and there's a whole page dedicated to this very problem.
Many thanks @badeball . You are awesome :)