TestML Compiler CLI

raw JSON →
0.1.8 verified Fri May 01 auth: no javascript

TestML Compiler converts TestML (.tml) files to JSON for use with TestML runtime libraries. At version 0.1.8, this is an early-stage compiler for the TestML testing language, with no stable release cadence. It differs from alternative testing frameworks by focusing on the Acmeism-inspired TestML language, prioritizing declarative test specifications. Currently supports basic compilation to JSON output. Not suitable for production use.

error Cannot find module 'testml-compiler'
cause Missing local install
fix
Run npm install testml-compiler --save-dev (or npm install -g testml-compiler for CLI).
error TypeError: compile is not a function
cause Incorrect import (e.g., named import on default export)
fix
Use const compile = require('testml-compiler') (default) or const { compile } = require('testml-compiler') (named).
gotcha No error handling; compile throws on invalid input
fix Wrap compile call in try-catch block.
gotcha Output is not validated; may produce malformed JSON for edge cases
fix Validate the resulting JSON before writing to file.
npm install testml-compiler
yarn add testml-compiler
pnpm add testml-compiler

Compiles a TestML file to JSON using the default export.

const compile = require('testml-compiler');
const fs = require('fs');
const tml = fs.readFileSync('test.tml', 'utf8');
const result = compile(tml);
fs.writeFileSync('test.tml.json', JSON.stringify(result, null, 2));