Skip to content

Commit

Permalink
Try to fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timokoessler committed Feb 10, 2025
1 parent 9805a84 commit 4d3d39c
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions end2end/tests/hono-sqlite3-esm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,23 @@ t.test("it logs esm warnings", (t) => {
const server = spawn(`node`, [pathToApp, "4004"], {
env: { ...process.env, AIKIDO_DEBUG: "true", AIKIDO_BLOCKING: "true" },
cwd: appDir,
shell: true,
});

server.on("close", () => {
console.log("Server closed, t.end()");
t.end();
});

server.on("error", (err) => {
console.log("Server error", err);
t.fail(err.message);
});

let stdout = "";
server.stdout.on("data", (data) => {
console.log(data.toString());
stdout += data.toString();
});

let stderr = "";
server.stderr.on("data", (data) => {
console.log(data.toString());
stderr += data.toString();
});

Expand Down Expand Up @@ -60,22 +55,17 @@ t.test("it logs esm warnings", (t) => {
.then(([sqlInjection, normalAdd]) => {
t.equal(sqlInjection.status, 200); // Not blocked
t.equal(normalAdd.status, 200);
console.log("Matching stdout and stderr");
t.match(
stderr,
/Your application seems to be running in ESM mode\. Zen does not support ESM at runtime yet\./
);
console.log("Matching starting agent");
t.match(stdout, /Starting agent/);
console.log("Matching SQL injection");
t.notMatch(stderr, /Zen has blocked an SQL injection/); // Not supported
console.log("Finished matching");
})
.catch((error) => {
t.fail(error.message);
})
.finally(() => {
console.log("Killing server");
server.kill();
});
});

0 comments on commit 4d3d39c

Please sign in to comment.