Open alastrat opened 8 months ago
@alastrat
Duplicate of https://github.com/cypress-io/cypress/issues/28722
The Bun compatibility issue https://github.com/oven-sh/bun/issues/8658 is not the only error condition.
If the Cypress cache (for instance on Ubuntu so ~/.cache/Cypress/13.6.6/Cypress
) is already populated with the Cypress binary then cypress verify
still fails if there is no Node.js installed. This could be the same or a different root cause as the issue https://github.com/oven-sh/bun/issues/8658,possibly this issue is not a duplicate of https://github.com/cypress-io/cypress/issues/28722.
Edit:
bun cypress verify
works in Bun v1.0.31 and later if the Cypress cache has already been populated. See below for further test results.
Testing Bun v1.0.35 against Cypress 13.7.1
, without Node.js installed, shows the following results:
Action | Result | Workaround |
---|---|---|
bun add cypress |
"The Cypress App could not be downloaded" | manually install Cypress binary |
bun cypress verify |
succeeds if Cypress binary manually downloaded | - |
bun cypress open |
Cypress Launchpad opens with animated cy icon. No testing type option displayed. | unknown |
bun cypress run |
No output. Process hangs. | unknown |
Bun > Node.js compatibility lists implemented and missing Node.js functionality in Bun and states "Bun aims for complete Node.js API compatibility.". The missing functionality in Bun prevents Cypress from running without Node.js.
Although there is a workaround for the download issue (see also https://github.com/cypress-io/cypress/issues/28722) this does not allow Cypress to run without Node.js.
Installing Node.js in addition to Bun allows each of the above tested commands to work. (Note: this is not a statement of support. It is just a comment about observed test results.)
You may be able to use the package manager function of Bun instead of one of the other package managers (npm, pnpm and Yarn), however Bun does not (yet) provide a full substitute for the Node.js API. Node.js is required to run Cypress through Bun.
Works significantly better with bun 1.1:
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
$ bun add cypress
bun add v1.1.0 (5903a614)
+ @types/bun@1.0.12
installed cypress@13.7.2 with binaries:
- cypress
179 packages installed [102.30s]
$ bun cypress verify
✔ Verified Cypress! /home/jdanek/.cache/Cypress/13.7.2/Cypress
$ bun cypress open
DevTools listening on ws://127.0.0.1:41159/devtools/browser/c4f512de-b0e8-47ee-850f-8ebcc670fc35
(node:101572) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/jdanek/.cache/Cypress/13.7.2/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node-20 --trace-warnings ...` to show where the warning was created)
(node:101666) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/jdanek/.cache/Cypress/13.7.2/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node-20 --trace-warnings ...` to show where the warning was created)
GET /__/ 200 4.177 ms - -
GET /__/assets/index-bda26968.css 200 1.673 ms - -
... clicked around, found the e2e test samples, ran todo app tests ..., seems to work
$ bun cypress run
... started well, but got stuck at ` Running: 2-advanced-examples/actions.cy.js (2 of 20)`
Running: 1-getting-started/todo.cy.js (1 of 20)
example to-do app
✓ displays two todo items by default (689ms)
✓ can add new todo items (431ms)
✓ can check off an item as completed (214ms)
with a checked task
✓ can filter for uncompleted tasks (304ms)
✓ can filter for completed tasks (309ms)
✓ can delete all completed tasks (302ms)
6 passing (4s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 6 │
│ Passing: 6 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 4 seconds │
│ Spec Ran: 1-getting-started/todo.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: 2-advanced-examples/actions.cy.js (2 of 20)
Actions
Installing Node.js in addition to Bun allows each of the above tested commands to work. (Note: this is not a statement of support. It is just a comment about observed test results.)
I have
$ node --version
v20.12.0
installed, so I guess disregard my previous comment, please
Can someone from the Cypress team comment on whether this will be added soon or not?
@nijikon
Can someone from the Cypress team comment on whether this will be added soon or not?
I don't want to give the impression that there is anything planned on the Cypress development side at the moment. If there were, then I would expect it to be listed in the Cypress roadmap and in any case I can't speak for the Cypress.io development team.
I'd just like to point out that as far as Bun replacing Node.js is concerned, Bun has gaps in their implementation, as mentioned also in https://github.com/cypress-io/cypress/issues/28722#issuecomment-2176419895. You can check the state of the API compatibility on Bun's documentation site. The last time I tried Cypress with Bun I got the error message:
219 | child.stdout.pipe(process.stdout);
^
error: Cannot pipe, not readable
code: "ERR_STREAM_CANNOT_PIPE"
That would be something for Bun to implement / fix. It's difficult to know how many other issues like that may be hidden.
What would you like?
Implement Cypress over Bun runtime.
Why is this needed?
As Bun adoption is rapidly increasing, compatibility with tools and frameworks like Cypress is a must.
Other
No response