Fix the process is not defined when using cypress commands as a library project and importing that in another folder. #28920
Replies: 4 comments
-
We are also facing the same issue. Although our structures may differ, we've encountered the same error: Process is not defined. |
Beta Was this translation helpful? Give feedback.
-
Facing Same Issues |
Beta Was this translation helpful? Give feedback.
-
@jennifer-shehane - Can we have any update on this ? |
Beta Was this translation helpful? Give feedback.
-
We are facing a similar issue when trying to import shared configuration in a monorepo, e.g import "shared/cypress/support/e2e"; Our tests become flakey with a |
Beta Was this translation helpful? Give feedback.
-
Hello
@jennifer-shehane Can you look into this if you know the solution i would help us to fix it
Kindly find the attached zip file to reproduce the error.
LibProj.zip
We are trying to configure cypress with node and converting cypress command project as a library project but somehow it throws process is not defined error.
Error comes in bundling (We have tried setting platform as node) for both bundling in package.json (under cyp folder) as well as index.ts (under cyp folder)
Steps to reproduce
Unzip the attached zip file
open in command prompt
Execute npm install
Go to the cyp folder (i.e cd cyp) and execute npm run build
Come back to the root folder (i.e cd..) and execute npx tsc
Execute node_modules\.bin\cypress open --e2e
Select on spectest.js file
You will get the error as process is not defined error. Below is the file name and line of the error.
'
var require_main = __commonJS2({
"../node_modules/esbuild/lib/main.js"(exports2, module2) {
var fs = require_fs();
var os = require_os();
var path = require_path();
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
});
'
We have been trying changing the target and module value in the tsconfig.json file but not going further.
If we remove tsconfig from cyp and oq folder and do the relevant changes by importing the cyp folder files directly then it works but if we convert it to require library project it fails.
Let us know if anyone has the solution to fix this.
Regards
Prashant Kankhara
Beta Was this translation helpful? Give feedback.
All reactions