1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

refactor(tests): move worker_threads itests to spec tests (#23648)

This commit is contained in:
Satya Rohith 2024-05-03 11:22:47 +05:30 committed by GitHub
parent 3e98ea4e69
commit 02d0ff58d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 41 additions and 42 deletions

View file

@ -117,36 +117,3 @@ itest!(worker_ids_are_sequential {
output: "workers/worker_ids_are_sequential.ts.out",
exit_code: 0,
});
// Test for https://github.com/denoland/deno/issues/22629
// Test for https://github.com/denoland/deno/issues/22934
itest!(node_worker_auto_exits {
args: "run --quiet --allow-read workers/node_worker_auto_exits.mjs",
output: "workers/node_worker_auto_exits.mjs.out",
exit_code: 0,
});
itest!(node_worker_message_port {
args: "run --quiet --allow-read workers/node_worker_message_port.mjs",
output: "workers/node_worker_message_port.mjs.out",
exit_code: 0,
});
itest!(node_worker_transfer_port {
args: "run --quiet --allow-read workers/node_worker_transfer_port.mjs",
output: "workers/node_worker_transfer_port.mjs.out",
exit_code: 0,
});
itest!(node_worker_message_port_unref {
args: "run --quiet --allow-env --allow-read workers/node_worker_message_port_unref.mjs",
output: "workers/node_worker_message_port_unref.mjs.out",
exit_code: 0,
});
itest!(node_worker_parent_port_unref {
envs: vec![("PARENT_PORT".into(), "1".into())],
args: "run --quiet --allow-env --allow-read workers/node_worker_message_port_unref.mjs",
output: "workers/node_worker_message_port_unref.mjs.out",
exit_code: 0,
});

View file

@ -1,8 +1,40 @@
{
"steps": [{
"args": "run message_port_removelistener.mjs",
"output": "message_port_removelistener.mjs.out",
// Note: successful exit asserts that the test passed
"exitCode": 0
}]
"tests": {
"auto_exits": {
// Test for https://github.com/denoland/deno/issues/22629
// Test for https://github.com/denoland/deno/issues/22934
"args": "run --quiet --allow-read auto_exits.mjs",
"output": "auto_exits.out",
"exitCode": 0
},
"message_port": {
"args": "run --allow-env --allow-read message_port.mjs",
"output": "message_port.out",
"exitCode": 0
},
"message_port_transfer": {
"args": "run --quiet --allow-read message_port_transfer.mjs",
"output": "message_port_transfer.out",
"exitCode": 0
},
"message_port_removelistener": {
"args": "run message_port_removelistener.mjs",
"output": "message_port_removelistener.out",
// Note: successful exit asserts that the test passed
"exitCode": 0
},
"message_port_unref": {
"args": "run --allow-env --allow-read message_port_unref.mjs",
"output": "message_port_unref.out",
"exitCode": 0
},
"parent_port_unref": {
"args": "run --allow-env --allow-read message_port_unref.mjs",
"envs": {
"PARENT_PORT": "1"
},
"output": "message_port_unref.out",
"exitCode": 0
}
}
}

View file

@ -7,7 +7,7 @@ const { port1: mainPort, port2: workerPort } = new workerThreads
const deferred = createDeferred();
const worker = new workerThreads.Worker(
import.meta.resolve("./node_worker_message_port_1.cjs"),
import.meta.resolve("./message_port_1.cjs"),
{
workerData: workerPort,
transferList: [workerPort],

View file

@ -2,7 +2,7 @@ import { MessageChannel, Worker } from "node:worker_threads";
const { port1, port2 } = new MessageChannel();
const worker = new Worker(
import.meta.resolve("./node_worker_transfer_port_1.mjs"),
import.meta.resolve("./message_port_transfer1.mjs"),
);
// Send the port directly after the worker is created
worker.postMessage(port2, [port2]);

View file

@ -221,7 +221,7 @@ async function ensureNoNewITests() {
"upgrade_tests.rs": 0,
"vendor_tests.rs": 1,
"watcher_tests.rs": 0,
"worker_tests.rs": 23,
"worker_tests.rs": 18,
};
const integrationDir = join(ROOT_PATH, "tests", "integration");
for await (const entry of Deno.readDir(integrationDir)) {