Repository navigation
Conversation
The JS tests for the Aliki highlighters, the Aliki search ranker and controller, and the json_index searcher now run with Node's built-in test runner. They load the template scripts into a vm context, the same way a page loads them as classic scripts. The highlighter tests drive the real DOMContentLoaded path through a small fake document, so they no longer rewrite the script source before they run it. mini_racer is no longer a development dependency. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G1CzhozGTbKZGZrsPu3LBa
Documentation previewCommit: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test command relies on shell wildcard expansion and fails on Windows with the documented Node 20 minimum.
1 open issue
What changed in this PR
Moves RDoc’s template JavaScript tests from mini_racer to Node’s built-in test runner without changing shipped JavaScript.
Changes:
- Ports 88 tests for highlighting and search to JavaScript, with shared script-loading and DOM helpers.
- Adds
npm run test:jsto the Lint workflow and documents the Node requirement. - Removes the Ruby test wrappers and mini_racer dependency.
| File | Description |
|---|---|
test/rdoc/generator/json_index/searcher_test.rb |
Removes the Ruby searcher tests. |
test/rdoc/generator/aliki/search_test.rb |
Removes the Ruby ranker and controller tests. |
test/rdoc/generator/aliki/highlight_c_test.rb |
Removes the Ruby C highlighter tests. |
test/rdoc/generator/aliki/highlight_bash_test.rb |
Removes the Ruby Bash highlighter tests. |
test/js/json_index/searcher.test.js |
Ports searcher tests to Node. |
test/js/helper.js |
Adds shared VM-loading, DOM, and assertion helpers. |
test/js/aliki/search.test.js |
Ports ranker and controller tests to Node. |
test/js/aliki/c_highlighter.test.js |
Ports C highlighting tests through DOM initialization. |
test/js/aliki/bash_highlighter.test.js |
Ports Bash highlighting tests through DOM initialization. |
package.json |
Adds the JavaScript test command. |
Gemfile |
Removes mini_racer. |
CONTRIBUTING.md |
Documents JavaScript test requirements and usage. |
.github/workflows/lint.yml |
Runs JavaScript tests in CI. |
Review effort: Balanced
| "scripts": { | ||
| "lint:css": "stylelint 'lib/rdoc/generator/template/**/*.css'" | ||
| "lint:css": "stylelint 'lib/rdoc/generator/template/**/*.css'", | ||
| "test:js": "node --test test/js/*/*.test.js" |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Requested by Stan · project thread
The JS tests for the Aliki highlighters, the Aliki search ranker and controller, and the json_index searcher now run with Node's built-in test runner (
npm run test:js). The Lint workflow runs them. mini_racer is no longer a development dependency.Before this change, these tests were Ruby files that evaluated the JS through mini_racer. They were skipped on Windows, JRuby and TruffleRuby, and anywhere mini_racer did not install. The highlighter tests also rewrote the script source with regexes to remove the IIFE wrapper.
Now a small helper loads the template scripts into a
vmcontext, the same way a page loads them as classic scripts with shared globals. The highlighter tests use a small fakedocumentand go through the realDOMContentLoadedpath. The tests need Node 20 or later and no npm packages. The shipped JS does not change.The 88 test cases are a direct port of the four Ruby files.
aliki.jsstays untested for now, because its TOC and sidebar code depends on real layout.Generated by Claude Code