Running JavaScript in Zerethon IDE

What Run does with your project, the time limit, input, tests, and what a run cannot do.

Runs in Zerethon IDE · Node.js 22 Official JavaScript documentation ↗
  • Run (Ctrl/⌘+Enter) runs the entry file — main.js by default — with Node.js 22. Make another .js / .mjs file the entry with the ▶ button next to it in the explorer.
  • Output and errors appear in the Output tab; the Input tab is the program's standard input.
  • A run is stopped after 10 seconds. Memory is limited (a runaway program gets heap out of memory), there is no network, and project files are read-only (write to /tmp).
  • Run tests (Ctrl/⌘+Shift+Enter) runs every test_*.js / test_*.mjs file in its own Node process. A file passes when it exits with code 0 — a thrown error or failed assert fails it.
test_geometry.js
const assert = require('assert');
const { area } = require('./geometry');

assert.strictEqual(area(2, 3), 6);
assert.strictEqual(area(0, 5), 0);
console.log('geometry ok');
A test file for geometry.js from “Modules and several files”, with Node's built-in assert.

Tip: Format uses Prettier on the selection or the whole file.