Skip to content

Commit

Permalink
test: fix jest
Browse files Browse the repository at this point in the history
  • Loading branch information
climba03003 committed Jul 16, 2024
1 parent 7935561 commit 2a5ccb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions test/typescript-jest/integration/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import basicApp from "../../typescript/basic/app";
const app = fastify();
app.register(basicApp);

app.listen(Math.floor(Math.random() * 3000 + 3000), function (err) {
if (err) console.error("failed");
console.log("success");
app.listen({
port: Math.floor(Math.random() * 3000 + 3000)
}, function (err) {
if (err) process.stderr.write("failed");
process.stdout.write("success");
app.close();
});
8 changes: 4 additions & 4 deletions test/typescript-jest/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ describe("integration test", function () {
test.concurrent.each(["ts-node", "ts-node-dev"])(
"integration with %s",
async function (instance) {
await new Promise(function (resolve) {
const child = exec(`${instance} ${process.cwd()}/test/typescript-jest/integration/instance.ts`);
await new Promise(function (resolve, reject) {
const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`);
let stderr = "";
child.stderr.on("data", function (b) {
child.stderr?.on("data", function (b) {
stderr = stderr + b.toString();
});
let stdout = "";
child.stdout.on("data", function (b) {
child.stdout?.on("data", function (b) {
stdout = stdout + b.toString();
});
child.once("close", function () {
Expand Down

0 comments on commit 2a5ccb9

Please sign in to comment.