edgedb-js
edgedb-js copied to clipboard
Not able to run tests locally
I'm trying to run edgedb-js tests, but I run into
❯ yarn test
Determining test suites to run...
Starting EdgeDB test cluster...
Node status file: /var/folders/nb/29vclp9d5494mj6lj4786m2w0000gn/T/edgedb-js-status-file-node-991107731
/bin/sh: edgedb-server: command not found
Error: Command failed: edgedb-server --help
I don't have edgedb-server in my path (installed using the official curl ... command)
I changed the server command in edgedb-js to edgedb server
But I get the following error
❯ yarn test
Determining test suites to run...
Starting EdgeDB test cluster...
Node status file: /var/folders/nb/29vclp9d5494mj6lj4786m2w0000gn/T/edgedb-js-status-file-node-118423014
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn edgedb server ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn edgedb server',
path: 'edgedb server',
spawnargs: [
'--auto-shutdown',
'--bind-address=127.0.0.1',
'--bind-address=::1',
'--temp-dir',
'--testmode',
'--port=auto',
'--emit-server-status=/var/folders/nb/29vclp9d5494mj6lj4786m2w0000gn/t/edgedb-js-status-file-node-118423014',
"--bootstrap-command=ALTER ROLE edgedb { SET password := 'edgedbtest' }"
]
}
It's failing because edgedb-server
is an actual edgedb server binary, while edgedb server
is a cli command to manage those binaries.
To run the tests without setting up an edgedb dev instance (https://www.edgedb.com/docs/reference/dev#building-locally), which would give you edgedb-server
in your PATH
, you can instead get the path to one of these installed binaries using the edgedb server info
command, then run the tests with the EDGEDB_SERVER_BIN
env var like this:
$ edgedb server info --latest
┌─────────────┬────────────────────────────────────────────────────────────────┐
│ Version │ 1.3+5d0197d │
│ Binary path │ /home/james/.local/share/edgedb/portable/1.3/bin/edgedb-server │
└─────────────┴────────────────────────────────────────────────────────────────┘
$ env EDGEDB_SERVER_BIN=/home/james/.local/share/edgedb/portable/1.3/bin/edgedb-server yarn test
I ran into this issue (on MacOS) even though I provided a path to edgedb-server
with EDGEDB_SERVER_BIN
.
On MacOS, it seems the default location is ~/Library/Application Support/edgedb/portable/2.0/bin/edgedb-server
, and the space in the name of the Application Support directory caused problems, even when escaped with a backslash.
I solved this by symlinking the 2.0
directory to ~/edgedb-2.0-portable
and then pointing the env var to the new location (symlink name is arbitrary, but should not contain spaces).
@samwinslow @haikyuu
Having whitespace in the path is fixed on master
as of #582