Node.js
The big question: “JS without the browser: the terminal, process & env, files, Node’s event loop — where Playwright lives”
Every Playwright test you will ever write runs as a Node.js program, not inside a browser tab — and so does its test runner, and the CI server that runs it at 3am. If you don’t know what changes when JavaScript leaves the browser (no DOM, no window — but new powers instead), the terminal output, the CI logs, and half of Playwright’s setup will feel like unexplained magic.
Every lesson so far ran JavaScript inside a browser tab. Node.js is the exact same language, the exact same V8 engine (0.2) — just with the browser walls removed. No DOM, no window, nothing to click. In exchange it gets powers a browser deliberately withholds: reading and writing real files, talking to the operating system, running as a server.
You’ll work in the terminal properly for the first time: typing commands, reading a script’s output and its stack trace when it crashes, and understanding exit codes — the single number a finished script hands back that tells a CI server “I passed” or “I failed.”
This phase also revisits Phase 6’s event loop from Node’s side — same one-thread, non-blocking model, different backstage crew (libuv instead of the browser’s Web APIs) — and gives you process.argv and process.env: exactly how a real Playwright suite reads a BASE_URL or a secret without hard-coding it.
A program that runs JavaScript outside the browser — no DOM, no window; new powers instead (files, servers, the OS).
The text window where you type commands and read a script’s output — how every real test suite actually gets run.
A live JavaScript prompt in the terminal — type an expression, see its value immediately.
The list of extra words typed after a command — how a script accepts input from whoever ran it.
A script’s environment variables — where secrets and settings like BASE_URL actually live in real test suites.
The single number a script hands back when it finishes: 0 means success, anything else means CI marks the run failed.
Continuous Integration — the robot server that re-runs your whole suite on every code change and reads exit codes to decide green or red.
Node’s toolbox for reading and writing real files — where test reports and screenshots actually go.
- ✓Explain what changes (and what doesn’t) when JS runs outside the browser
- ✓Run a script from the terminal and read its output and stack trace
- ✓Read command-line arguments and environment variables in a script
- ✓Read and write a real file with Node’s fs module
✏️ This phase’s interactive lab is still being drawn — it arrives together with the phase’s lessons.
- 9.1What is Node, really?
V8 unbolted from the browser: document vanishes, the computer’s powers arrive.
- 9.2The terminal, properly
pwd/cd/ls, stack traces read calmly — and exit codes, the number CI lives by.
- 9.3Modules in Node: CJS vs ESM
require vs import, and the "type": "module" switch — read any Node file cold.
- 9.4process: argv, env & exit
One suite, many targets: BASE_URL, secrets, and the startup guard pattern.
- 9.5The file system
Real files at last: fs read/write, path.join, cwd vs the file’s home — where reports land.
- 9.6Node’s event loop & non-blocking I/O
6.2 backstage: the libuv workshop — how one thread reads a hundred files.
- 9.7fetch without a browser
The envelope leaves a terminal: JSON in, JSON out — your first API check.
- 9.8Checkpoint: environment setup
Install Node for real, init a project, aim it with env, verify the exit code.