Unable to run tests due to an "Unexpected end of JSON input" error when using nodejs 18.16.0 with the latest TestCafe version (3.1.0) #7935
Description
What is your Scenario?
Run tests using the latest TestCafe version (3.1.0) using below "ci:automation:smoke" and "smoke" scripts from Package.json file in the attached project:
"smoke": "testcafe --test-meta smoke=true chrome automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
"ci:automation:smoke": "npx testcafe chrome --no-sandbox --disable-dev-shm-usage --test-meta smoke=true automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
What is the Current behavior?
There is a "SyntaxError: Unexpected end of JSON input" error that prevents us from running tests in Chrome browser using the latest TestCafe version (3.1.0) when we run below "ci:automation:smoke" and "smoke" scripts from Package.json file in the attached project.
"smoke": "testcafe --test-meta smoke=true chrome automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
"ci:automation:smoke": "npx testcafe chrome --no-sandbox --disable-dev-shm-usage --test-meta smoke=true automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
The complete error message is given below:
ERROR SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at DevToolsTestFileCompiler._preProcess (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\test-file\formats\dev-tools\compiler.ts:59:33)
at DevToolsTestFileCompiler.compile (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\test-file\formats\dev-tools\compiler.ts:50:39)
at Compiler._getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:93:31)
at Compiler._compileTestFiles (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:105:35)
at Compiler.getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:118:34)
at C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\runner\bootstrapper.ts:290:25
at guardTimeExecution (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\utils\guard-time-execution.ts:6:31)
at Bootstrapper._getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\runner\bootstrapper.ts:289:21)
at async Promise.all (index 1)
What is the Expected behavior?
We should not be prevented from running tests in Chrome browser using the latest TestCafe version (3.1.0) when we run below "ci:automation:smoke" and "smoke" scripts from Package.json file in the attached project.
"smoke": "testcafe --test-meta smoke=true chrome automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
"ci:automation:smoke": "npx testcafe chrome --no-sandbox --disable-dev-shm-usage --test-meta smoke=true automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
What is your public website URL? (or attach your complete example)
What is your TestCafe test code?
Your complete configuration file
{
"browsers": "chrome",
"selectorTimeout": 90000,
"assertionTimeout": 90000,
"concurrency": 2,
"speed": 1,
"debugOnFail": false,
"skipJsErrors": true,
"skipUncaughtErrors": true,
"takeScreenshotsOnFails": true,
"browserInitTimeout": 180000,
"quarantineMode": {
"attemptLimit": 2,
"successThreshold": 1
},
"disableMultipleWindows": true,
"reporter": [
{
"name": "slack",
"options": {
"webhookUrl": "",
"channel": "",
"username": "",
"_comment": "",
"loggingLevel": "",
"quietMode": true
}
}
]
}
Your complete test report
No response
Screenshots
Steps to Reproduce
-
Unzip the attached project.
-
To open the unzipped project in Visual Studio Code, select “Open Folder” from the “File” menu, navigate to the project folder, and click the “Select Folder” button.
-
Install the dependencies by running "npm install" command in the Terminal.
-
Run tests using the latest TestCafe version (3.1.0) in Chrome browser using below "ci:automation:smoke" and "smoke" scripts in the Package.json file:
"smoke": "testcafe --test-meta smoke=true chrome automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
"ci:automation:smoke": "npx testcafe chrome --no-sandbox --disable-dev-shm-usage --test-meta smoke=true automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
Expected Result:
Tests should be run successfully in Chrome browser using the latest TestCafe version (3.1.0) when we run "ci:automation:smoke" and "smoke" scripts from Package.json file in the attached project.
Actual Result:
Browser windows open and then immediately close and below error message is displayed in the terminal:
ERROR SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at DevToolsTestFileCompiler._preProcess (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\test-file\formats\dev-tools\compiler.ts:59:33)
at DevToolsTestFileCompiler.compile (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\test-file\formats\dev-tools\compiler.ts:50:39)
at Compiler._getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:93:31)
at Compiler._compileTestFiles (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:105:35)
at Compiler.getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\compiler\index.js:118:34)
at C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\runner\bootstrapper.ts:290:25
at guardTimeExecution (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\utils\guard-time-execution.ts:6:31)
at Bootstrapper._getTests (C:\Users\18568\OneDrive\Desktop\testcafe-automation\node_modules\testcafe\src\runner\bootstrapper.ts:289:21)
at async Promise.all (index 1)
TestCafe version
3.1.0
Node.js version
18.16.0
Command-line arguments
"ci:automation:smoke": "npx testcafe chrome --no-sandbox --disable-dev-shm-usage --test-meta smoke=true automation/ -S -s automation/reports/screenshots --reporter xoe-reporter:automation/reports/report_smoke.json,slack --reporter-app-name='E2E' --reporter-app-version='1.0.0'"
Browser name(s) and version(s)
Chrome Version 115.0.5790.171 (Official Build) (64-bit)
Platform(s) and version(s)
Microsoft Windows 10 Enterprise
Other
No response