Problem
#33 / #35 made a failed validate on a loaded file throw the validation error, in the form Failed to load JSON file at <url>: @cldmv/wisp: <message>, instead of falling through to the fallback. For a non-JSON module (loaded through import() with a non-json type), a validate rejection still ends in wisp's generic "Unsupported type" error, so the caller can't tell their own validation rejected the data.
Found while porting the suite to vitest-runner (#37). The new tests pin the current behaviour.
Fix
Run validate outside the import-strategy error handling for every loader path, not only the JSON/fs path, so a validation rejection always surfaces as the validation error in the same format. Update the pinned test to expect the validation error.
Problem
#33 / #35 made a failed
validateon a loaded file throw the validation error, in the formFailed to load JSON file at <url>: @cldmv/wisp: <message>, instead of falling through to the fallback. For a non-JSON module (loaded throughimport()with a non-jsontype), avalidaterejection still ends in wisp's generic "Unsupported type" error, so the caller can't tell their own validation rejected the data.Found while porting the suite to vitest-runner (#37). The new tests pin the current behaviour.
Fix
Run
validateoutside the import-strategy error handling for every loader path, not only the JSON/fs path, so a validation rejection always surfaces as the validation error in the same format. Update the pinned test to expect the validation error.