deno/tests/node_compat/common.ts
Daniel Osvaldo Rahmanto a9fd667cf6
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
chore(test): add reason field to node compat test config (#30469)
This was done so we can show it later on `node-test-viewer`.

Other notable changes:
- Move ignored test list from `run_all_test_unmodified.ts` to
`config.toml`
- Add `parallel/test-os-checked-function.js` to the ignore list
- Adjust the `README.md`
2025-09-01 23:44:11 +02:00

46 lines
1.1 KiB
TypeScript

// Copyright 2018-2025 the Deno authors. MIT license.
import { parse } from "@std/toml";
export interface SingleFileConfig {
flaky?: boolean;
windows?: boolean;
darwin?: boolean;
linux?: boolean;
/** Optional reason for ignoring the test */
reason?: string;
}
type Config = {
tests: Record<string, SingleFileConfig>;
};
export const configFile = await Deno.readTextFile(
new URL("./config.toml", import.meta.url),
).then(parse) as Config;
/** Checks if the test file uses `node:test` module */
export function usesNodeTestModule(testSource: string): boolean {
return testSource.includes("'node:test'");
}
export const RUN_ARGS = [
"-A",
"--quiet",
"--unstable-unsafe-proto",
"--unstable-bare-node-builtins",
];
export const TEST_ARGS = [
"test",
...RUN_ARGS,
"--no-check",
"--unstable-detect-cjs",
];
/** Parses the special "Flags:"" syntax in Node.js test files */
export function parseFlags(source: string): string[] {
const line = /^\/\/ Flags: (.+)$/um.exec(source);
if (line == null) return [];
return line[1].split(" ");
}