Closed
Description
Env:
$ node -v
v20.8.0
$ ack postgres package.json
"postgres": "3.4.0",
Given repo.js
import { test } from "node:test";
import postgres from "postgres";
test("should print PostgresError", async () => {
const sql = postgres(`postgres://${process.env.USER}@localhost`);
try {
await sql`
invalid query
`;
} catch (error) {
// console.log("error does print correctly", error);
throw error;
} finally {
await sql.end();
}
});
Run node --test repo.js
Expected
$ node --test repo.js
✖ should print PostgresError (...ms)
PostgresError: syntax error at or near "invalid"
at TestContext.<anonymous> (.../repo.js:12:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:632:9)
at async startSubtest (node:internal/test_runner/harness:208:3)
Actual
$ node --test repo.js
✖ should print PostgresError (...ms)
{}
Metadata
Metadata
Assignees
Labels
No labels