Skip to content

Commit d6a4fc6

Browse files
committed
fix(bb-ts): clean_shutdown test resolves harness off cwd, not import.meta.url
`run_test.sh` runs jest with `--rootDir ./dest/node` from `barretenberg/ts/`, so the test file at runtime lives at `dest/node/barretenberg/clean_shutdown.test.js` and `path.resolve(import.meta.url, '..', '..')` lands in `dest/`, where the harness source does not exist (it stays in `src/`). The test would silently time out at 30s. Use `process.cwd()` (set by run_test.sh to the package root) and join from there.
1 parent 80e1fa6 commit d6a4fc6

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

barretenberg/ts/src/barretenberg/clean_shutdown.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515

1616
import { spawn } from 'child_process';
1717
import path from 'path';
18-
import { fileURLToPath } from 'url';
1918

20-
const HERE = path.dirname(fileURLToPath(import.meta.url));
21-
const PROJECT_ROOT = path.resolve(HERE, '..', '..');
19+
// `barretenberg/ts/scripts/run_test.sh` cd's into `barretenberg/ts/` before
20+
// invoking jest, so cwd is the package root regardless of where the compiled
21+
// test file lives (`dest/node/...`). Resolving the harness off cwd keeps the
22+
// path stable as we don't ship the harness source into `dest/`.
23+
const PROJECT_ROOT = process.cwd();
2224
const ENTRYPOINT = path.join(PROJECT_ROOT, 'src', 'barretenberg', 'clean_shutdown.harness.ts');
2325

2426
describe('Barretenberg clean shutdown', () => {

0 commit comments

Comments
 (0)