KyleJune
KyleJune
DDeno
Created by KyleJune on 5/1/2024 in #help
react-helmet-async missing HelmetProvider export
No description
15 replies
DDeno
Created by KyleJune on 1/11/2024 in #help
Using Deno.Command to run tailwindcss with watch flag not working
If I do new Deno.Command(Deno.execPath(), {args:["run", "-A", "npm:tailwindcss", "-i", "./styles.css", "-o", "./public/styles.css", "--watch"]}), no watching happens and the output file doesn't get updated. The npm package running doesn't seem to get the watch argument or the output anymore. But if I run npx tailwindcss -i ./styles.css -o ./public/styles.css --watch, It updates the file and watches for changes based on the tailwind.config.js. Is this expected or am I doing something wrong? I'm just trying to spawn a process to do the same as npx. Should I just use "npx" instead of Deno.execPath()?
4 replies
DDeno
Created by KyleJune on 11/18/2023 in #help
Leaking resources from inbound HTTP connections in tests
Anyone have any ideas why I would be getting the following error. I'm using an oak server that is started before all the tests and closed after they all finish.
error: Leaking resources:
- An inbound HTTP connection (rid 7) was accepted before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
- An inbound HTTP connection (rid 21) was accepted during the test, but not closed during the test. Close the inbound HTTP connection by calling `httpConn.close()`.
error: Leaking resources:
- An inbound HTTP connection (rid 7) was accepted before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
- An inbound HTTP connection (rid 21) was accepted during the test, but not closed during the test. Close the inbound HTTP connection by calling `httpConn.close()`.
It happens in all test cases after the first. I await the response, so I'm not sure why the connection is still considered open when the test ends. All the assertions pass, the only thing that causes failure is the leaking resource. In oak I don't see an option to close the response.
it(notFoundTests, "without extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid");
const body = await response.json();
assertEquals(response.status, 404);
assertEquals(
response.headers.get("Content-Type"),
"application/json; charset=UTF-8",
);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, {
error: { name: "NotFoundError", message: "Not found", status: 404 },
});
});

it(notFoundTests, "with json extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid.json");
const body = await response.text();
assertEquals(response.status, 404);
assertEquals(response.headers.get("Content-Type"), null);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, "");
});
it(notFoundTests, "without extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid");
const body = await response.json();
assertEquals(response.status, 404);
assertEquals(
response.headers.get("Content-Type"),
"application/json; charset=UTF-8",
);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, {
error: { name: "NotFoundError", message: "Not found", status: 404 },
});
});

it(notFoundTests, "with json extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid.json");
const body = await response.text();
assertEquals(response.status, 404);
assertEquals(response.headers.get("Content-Type"), null);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, "");
});
10 replies
DDeno
Created by KyleJune on 1/12/2023 in #help
Killing subprocess not working
Anyone know what I'm doing wrong when trying to kill a process? I have a process start another process like this:
runProcess = Deno.run({
cmd: ["deno", "task", "run-dev"],
});
runProcess = Deno.run({
cmd: ["deno", "task", "run-dev"],
});
My child process uses deno task and the run-dev task starts an oak server. Then if a file changes, I kill it with this.
runProcess.kill();
runProcess.close();
runProcess.kill();
runProcess.close();
But I found that the server oak server keeps listening after I sent those. I tried awaiting runProcess.status() afterwards and it does resolve to { success: false, code: 143, signal: 15 } indicating it was killed, but the server is able to keep handling requests and if I try starting a new run-dev task, it will fail with an error saying the address is already in use. So it would appear the oak server isn't getting killed correctly. I even tried adding a 30 second delay between killing and restarting but it still fails to kill it. The following output shows that I killed the process, but the oak server still was able to handle requests afterwards.
Restarting app
killing process
{ status: { success: false, code: 143, signal: 15 } }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 4 }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 2 }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 3 }
Task run-dev export APP_ENV=development && deno run -A ./main.ts
error: Uncaught AddrInUse: Address already in use (os error 98)
: Deno.listen(this.#options)) as Listener;
Restarting app
killing process
{ status: { success: false, code: 143, signal: 15 } }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 4 }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 2 }
{ status: 200, method: "GET", href: "http://localhost:9000/", responseTime: 3 }
Task run-dev export APP_ENV=development && deno run -A ./main.ts
error: Uncaught AddrInUse: Address already in use (os error 98)
: Deno.listen(this.#options)) as Listener;
9 replies
DDeno
Created by KyleJune on 9/25/2022 in #help
How to exclude vendor directory from test coverage?
14 replies