Repository navigation
fix: correct the fetch and translate types, await static's writes, and keep tests offline - #148
Merged
Merged
Conversation
bnb
approved these changes
Nov 11, 2026
bnb
approved these changes
Nov 11, 2026
Draft
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.
Six small fixes the CI work turned up, one commit each.
translate's return type
translate()returns a fresh copy of its alias list, so callers can change it, but its JSDoc declared a readonly tuple. It now declares a mutable array of the same aliases, and the regeneratedtranslate/types/index.d.tsfollows. A type test intest/types.mtsassigns the result toAlias[]and pushes to it. The@ts-expect-errorin translate's own test now says why it's still needed:'eol'isn't one of'lts''s aliases.The
fetchoption typecore, opt and fetchindex typed their
fetchoption astypeof fetch. undici'sfetchdoesn't match that type, since itsRequesthas fields the global one lacks, so passing it (as the tests do, and users may) was a type error.Fetchtype that describes what the modules use: a function taking a URL string and resolving to something withok,status,statusTextandjson(). Both fetches fit it.Fetchisimport('@nodevu/fetchindex').Fetch, since core already depends on fetchindex. opt keeps a copy, because it depends on neither.json()resolves tounknown, as undici declares it, so fetchindex and core's schedule fetcher now say what shape they expect.fetchandurls.schedule) instead of all ofParsedOptions, so its tests pass partial options without a cast.unknownthey needed to pass undici'sfetch.test/types.mtspasses both fetches to each module.undiciis now a root dev dependency for that test.static's build scripts
static/build/*.jscalled the asyncwrite()without awaiting it. They await it now, and their loops overObject.keys()drop afor awaitthat a plain array doesn't need. A new test runs each build script with nowhere to write its output and expects it to exit with code 1. The top-level calls stay as they are: since Node 15 an unhandled rejection exits the process with code 1 anyway.ranges' tests
unknownFilter.test.jshad two identical tests. One is gone. Another test said "the first entry" where its unknown alias is the last entry, and it's renamed to match. All of them usedtry/catchwith anif (data) throwguard that let the test pass ifranges()ever resolved to something falsy. They now useassert.rejectswith the same messages.matrixAlias.test.jshad comments naming the wrong alias above three checks, and a duplicated "supported" test. The comments now say what each check checks, and the duplicate is gone.Tests that fetched nodejs.org
The "should work with..." tests in
core/test/schedule.jsandfetchindex/test/test.jsfetched the live schedule.json and index.json. They now serve the@nodevu/fixturessnapshots and assert that the default URL was requested. fetchindex gets@nodevu/fixturesas a dev dependency, and its CI path filter now includesfixtures/**. Where a test uses the globalfetch, it gets mocked witht.mock.method. Where a test uses undici'sfetch, an undiciMockAgentwith network connections disabled stands in. With network connections blocked, every module's tests pass. Two describe titles also lose a typo ("condiditons").The snapshot refresh
fixtures/util/updateStaticData.jssaved whatever JSON came back, so an error response with a JSON body would have replaced the test snapshot. It now rejects on a response that isn't ok, with the same message core's own fetch uses, and writes nothing. A test serves a 503 and checks that the script exits 1 and leaves the snapshot folder empty.