Cypress - Debugging after:run error thrown in plugin files wile executing - cypress

I have a cypress with cucumber preprocessor use. Works fine in "open" (Manually close the session) but when running execution I get:
An error was thrown in your plugins file while executing the handler for the after:run event.
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.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Any simple fixes suggested or how should I start with debugging this?
The thrown error prevents the --reporter from running
Many Thanks

What does your cypress.config look like? I had this same error and it went away when I added:
on('before:run', async (details) => {
console.log('override before:run');
await beforeRunHook(details);
}),
on('after:run', async () => {
console.log('override after:run');
await afterRunHook();
})
to setupNodeEvents

Related

Getting this error after running in the cypress dashboard

I am getting this are after running all of my test cases in the cypress dashboard. Can anyone help me to solve this issue? Test cases are running no issues in there.
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.exe 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)

Angular 12: ng serve --open takes too long and have a lot of message

So I have a previous problem with my angular 12 you can click here for reference
So I kinda fix it now and I can do ng serve --open, but I got this message, maybe an error and it never serve or show the output its just it takes a lot of time.
ERROR:
D:\3rdYR\AppDev\bigProject\public>ng serve public
⠙ Generating browser application bundles (phase: setup)...(node:12832) UnhandledPromiseRejectionWarning: Error: The Angular Compiler requires TypeScript >=4.4.2 and <4.5.0 but 4.3.5 was found instead.
at checkVersion (file:///D:/3rdYR/AppDev/bigProject/public/node_modules/#angular/compiler-cli/bundles/index.js:17440:11)
at verifySupportedTypeScriptVersion (file:///D:/3rdYR/AppDev/bigProject/public/node_modules/#angular/compiler-cli/bundles/index.js:17444:3)
at new NgtscProgram (file:///D:/3rdYR/AppDev/bigProject/public/node_modules/#angular/compiler-cli/bundles/index.js:17594:7)
at AngularWebpackPlugin.updateAotProgram (D:\3rdYR\AppDev\bigProject\public\node_modules\#angular-devkit\build-angular\node_modules\#ngtools\webpack\src\ivy\plugin.js:321:32)
at D:\3rdYR\AppDev\bigProject\public\node_modules\#angular-devkit\build-angular\node_modules\#ngtools\webpack\src\ivy\plugin.js:198:24
at Hook.eval [as call] (eval at create (D:\3rdYR\AppDev\bigProject\public\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:24:1)
at Hook.CALL_DELEGATE [as _call] (D:\3rdYR\AppDev\bigProject\public\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (D:\3rdYR\AppDev\bigProject\public\node_modules\webpack\lib\Compiler.js:1054:30)
at D:\3rdYR\AppDev\bigProject\public\node_modules\webpack\lib\Compiler.js:1099:29
at eval (eval at create (D:\3rdYR\AppDev\bigProject\public\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12832) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12832) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠼ Generating browser application bundles (phase: setup)...
Right now it is still generating but it is like going on like that for 10 minutes at least.
You have a wrong typescript version installed in your Project.
UnhandledPromiseRejectionWarning: Error: The Angular Compiler requires TypeScript >=4.4.2 and <4.5.0 but 4.3.5 was found instead.
Change in your Package Json your Typescript version to 4.4.2 and npm install than try ng serve again :)

Uncaught AssertionError: Env not set, aborting run cypress issue

Everytime i try to run my cypress test i am getting this error:
Uncaught AssertionError: Env not set, aborting run
This error originated from your test code, not from Cypress.
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
Check your console for the stack trace or click this message to see where it originated from.
Maybe it is happening because when i run cypress open or run inside the folder, it opens like this and i have to manually select the test folder?
And when i do npm install, i get this error:
Required: {"node":">=8.9.4","npm":"~5.6.0"}
Actual: {"npm":"6.4.1","node":"11.11.0"}

forever cannot find .js files on windows 2008 x64

var forever = require('forever-monitor');
var panel = new (forever.Monitor)('p.js');
panel.start();
this code outputs :
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
at first i thought my code has a problem so i installed forever globally and tried
forever p.js
and it says
C:\w>forever p.js
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
while node p.js in the same directory works just fine , the file is there
when trying to run a non-existent file forever gives a different error message
any clues on where to look is appreciated .
try with C:\w>forever -c node p.js
was the fix to my problem...

Saving an image file with Node.js request library causes exception

This is from the request's Github repo - https://github.com/mikeal/request
You can stream any response to a file stream.
request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
I have modified it like so, where largeImage is a absolute url path from 3rd-party website.
request(largeImage).pipe(fs.createWriteStream('./img/large/demo.jpg'));
But I get the following error (not sure why?). I have looked at the createWriteStream API and it seems to be correct. If I only include "demo.jpg" it works fine. But if I include path next to "demo.jpg" it throws an exception.
stream.js:81
throw er; // Unhandled stream error in pipe.
^
Error: ENOENT, open './img/large/demo.jpg'
10 Oct 16:51:02 - [nodemon] app crashed - waiting for file changes before starting...
UPDATE: The problem was I didn't include ./public/ folder before the /img/.
This updated code works correctly:
request(largeImage).pipe(fs.createWriteStream('./public/img/large/demo.jpg'));
It all looks OK. My guess is that the issue is related to permissions or maybe needing to create the ./img/large directory first.
Do something like this to get more info:
var ws = fs.createWriteStream('./img/large/demo.jpg');
ws.on('error', function(err) { console.log(err); });
request(largeImage).pipe(ws);

Resources