Skip to content

Testing and tooling

Adam Kubiś edited this page Oct 30, 2026 · 2 revisions

Testing and tooling

Catalog

Runtime and dependencies

The package declares ^20.19.0 || ^22.13.0 || >=24 for Node.js, matching the installed ESLint package. The committed lockfile is the dependency reference. Install it with npm ci; do not replace that command with an unreviewed dependency upgrade.

ESLint 10.9.1 uses the flat ESM configuration in eslint.config.js. Its configured rules check undefined names, unused variables, var and opportunities to use const. Build output and dependency directories are ignored. This is a lint check, not proof of all possible functional behavior.

Before publication

npm ci
npm run check
npm audit --audit-level=low

The full check runs lint first, the eight worker-pool regression tests next, and then all 307 exercise files. Every exercise executes in its own process with a five-second timeout. At most four challenge processes run at once; results are reported in filename order. testHelper.js uses strict Node.js assertions and throws on failures. Any timeout, non-zero exit or process error causes the runner to fail.

The worker-pool tests cover the concurrency limit, stable result ordering, sequential mode, empty input, avoiding duplicated work, retaining failed-process results, unexpected worker failures and invalid concurrency settings. Run them separately with node --test.

Individual solutions

Every exercise page includes a command using its exact filename. Filenames are retained, including the invisible left-to-right marks in entries 001 and 003. Copy the command from the page or select the file in your terminal instead of renaming it.

node "Edabit/132 Minimal4.js"
node "Edabit/169 Multiply Every Array Item by Two.js"

Assertions and expectations are inline in each source file. The runner reports passed files, not a fabricated total number of assertions. Passing this collection establishes the behavior covered by its tests; it does not prove behavior for every possible input.

Shared code

Test helper, test runner, bounded worker pool and arithmetic-expression helper support the exercise files; they are not additional numbered solutions. The worker-pool tests are part of npm test.

The wiki is documentation and is not executed by the test runner. Its code excerpts must be refreshed when solutions change. Historical study diagrams and cross-language timings are not evidence of current JavaScript behavior.

SonarQube Cloud runs after a push to the main branch. Its actual result for the pushed revision is a separate check from local tests. Exercises that require mixed return types declare their unions in JSDoc; those outputs remain unchanged. No analysis rules are disabled for these fixes. Exercise 304 explicitly modernizes its original string-rejection detail to an Error with the same message and a stack trace, as documented on its page.

Clone this wiki locally