playwright-json-runner
Version:
Extends Playwright to run tests using JSON-based test definitions.
35 lines (33 loc) • 1.03 kB
JavaScript
import { testRunSchema } from '../chunk-KTR6D2I2.mjs';
import * as fs from 'fs';
import zodToJsonSchema from 'zod-to-json-schema';
function dumpSchema() {
return zodToJsonSchema(testRunSchema, {
name: "TestRun"
});
}
(async function main() {
const [, , command, outputFile] = process.argv;
if (command === "dump-json-schema") {
const fileName = outputFile || "playwright-json-runner-schema.json";
try {
const schemaJson = await dumpSchema();
fs.writeFileSync(fileName, typeof schemaJson === "string" ? schemaJson : JSON.stringify(schemaJson, null, 2));
console.log(`Schema dumped to ${fileName}`);
} catch (error) {
console.error("Error dumping JSON Schema:", error);
process.exit(1);
}
} else {
console.log(
`Usage:
playwright-json-runner dump-json-schema <outputFile>
Example:
playwright-json-runner dump-json-schema schema.json`
);
process.exit(0);
}
})();
//# sourceMappingURL=cli.mjs.map
//# sourceMappingURL=cli.mjs.map