unjs / unenv

๐Ÿ•Š๏ธ Convert javaScript code to be runtime agnostic
MIT License
342 stars 18 forks source link

feat(cloudflare): alias `node:assert/strict` to `node:assert` #191

Closed jculvey closed 1 month ago

jculvey commented 1 month ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

Since the workerd implementation of the node:assert module already has strict semantics, we simply need to alias node:assert/strict to node:assert to get coverage for the module.

๐Ÿ“ Checklist

jculvey commented 1 month ago

According to https://nodejs.org/api/assert.html#strict-assertion-mode

In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example, assert.deepEqual() will behave like assert.deepStrictEqual().

So implementing the real thing is actually less code than implementing the mocks. Could you please reexport the node:assert symbols here instead?

Yeah sure thing. Should I do that a Cloudflare specific polyfill (since nodeless doesn't have node:assert), or should we use the try/fallback approach and use these if we detect assert, otherwise fallback to notImplemented?