Skip to content

A failed validate on a non-JSON module reports "Unsupported type" instead of the validation error #39

Description

@Shinrai

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreTouches core library / runtime source codepriority: mediumShould be addressed in the normal course of developmentstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions