Firescript Syntax Test

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

A test suite for validating Firescript syntax parsing. Firescript is a compile-to-JavaScript language with a Pythonic indentation-based syntax. This package provides a framework to define and run syntax tests against Firescript code. Version 0.3.3 is the latest stable release, with limited cadence. It is primarily used internally for the Firescript compiler. Differentiators: purpose-built for Firescript syntax, not general-purpose testing. Limited community adoption.

error SyntaxError: Unexpected token 'let'
cause Using ES6 syntax in a file with .fs extension but Firescript parser expects Pythonic syntax.
fix
Write Firescript syntax: 'let x = 5' not 'let x = 5' (if that is the issue). Actually write Firescript: 'x = 5'.
error TypeError: SyntaxTest is not a constructor
cause Imported default incorrectly; may have used named import on default export.
fix
Use import { SyntaxTest } from 'firescript-syntax-test' or default import.
error Error: Module not found: Can't resolve 'firescript-syntax-test'
cause Package not installed or ESM resolution issue.
fix
Run npm install firescript-syntax-test and ensure project uses ESM (type: module in package.json).
breaking require() is not supported; ESM-only.
fix Use ESM imports (import) instead of require().
gotcha Package under development; API may change in minor versions.
fix Pin exact version in dependencies.
deprecated The old class `TestSyntax` renamed to `SyntaxTest`.
fix Use `SyntaxTest` instead.
gotcha Only accepts Firescript code; no JavaScript or other languages.
fix Ensure input is valid Firescript syntax.
gotcha Indentation-sensitive; mixing tabs and spaces may cause errors.
fix Use consistent indentation (spaces recommended).
npm install firescript-syntax-test
yarn add firescript-syntax-test
pnpm add firescript-syntax-test

Demonstrates loading a Firescript code string and running syntax tests.

import FirescriptSyntaxTest from 'firescript-syntax-test';
import { SyntaxTest } from 'firescript-syntax-test';

const test = new SyntaxTest();
test.load('example.fs', 'let x = 5\nif x > 0\n    print(x)');
const result = test.run();
console.log(result);