Conversation
| "url": {"type": "node", "id": "api/module.html#modulebuiltinmodules"} | ||
| }, | ||
| "bun:test": { | ||
| "id": "bun:test", |
There was a problem hiding this comment.
@43081j we don't have any example like this as far as I know, do you know how should we put this one into place has its part of native and same for node:test
There was a problem hiding this comment.
@joaopedrodcf I think this should be "type": "native" similar to what we have for node:* and Bun.* apis
There was a problem hiding this comment.
bun doesn't really have any version data anywhere. so we can't define which version introduced it.
for now this is fine but you need to put bun:test as the last replacement in the replacements array. otherwise it will be shown to non-bun users.
Roman is also right, it should be type: "native"
|
@joaopedrodcf could you also update the description to have |
|
|
||
| # Replacements for `mockdate` | ||
|
|
||
| `mockdate` is mainly used in tests, and modern test runners already include built-in APIs for freezing time without pulling in an extra dependency. |
There was a problem hiding this comment.
| `mockdate` is mainly used in tests, and modern test runners already include built-in APIs for freezing time without pulling in an extra dependency. | |
| `mockdate` is mainly used in tests, and modern test runners already include built-in APIs for mocking time without pulling in an extra dependency. |
|
|
||
| ## `vitest` | ||
|
|
||
| [`vitest`](https://vitest.dev/guide/mocking.html#mock-the-current-date) provides `vi.useFakeTimers()` and `vi.setSystemTime()` for freezing the current date during tests. |
There was a problem hiding this comment.
| [`vitest`](https://vitest.dev/guide/mocking.html#mock-the-current-date) provides `vi.useFakeTimers()` and `vi.setSystemTime()` for freezing the current date during tests. | |
| [`vitest`](https://vitest.dev/guide/mocking.html#mock-the-current-date) provides `vi.useFakeTimers()` and `vi.setSystemTime()` for mocking the current date during tests. |
|
|
||
| ## `node:test` | ||
|
|
||
| [`node:test`](https://nodejs.org/en/learn/test-runner/mocking#time) supports freezing time via `mock.timers` since node 20.4.0 and later. |
There was a problem hiding this comment.
| [`node:test`](https://nodejs.org/en/learn/test-runner/mocking#time) supports freezing time via `mock.timers` since node 20.4.0 and later. | |
| [`node:test`](https://nodejs.org/en/learn/test-runner/mocking#time) supports mocking time via `mock.timers` since node 20.4.0 and later. |
|
|
||
| ## `bun:test` | ||
|
|
||
| [`bun:test`](https://bun.com/docs/guides/test/mock-clock) provides `mock.timers.enable()` for freezing the clock in tests. |
There was a problem hiding this comment.
| [`bun:test`](https://bun.com/docs/guides/test/mock-clock) provides `mock.timers.enable()` for freezing the clock in tests. | |
| [`bun:test`](https://bun.com/docs/guides/test/mock-clock) provides `mock.timers.enable()` for mocking time in tests. |
| "url": {"type": "node", "id": "api/module.html#modulebuiltinmodules"} | ||
| }, | ||
| "bun:test": { | ||
| "id": "bun:test", |
There was a problem hiding this comment.
bun doesn't really have any version data anywhere. so we can't define which version introduced it.
for now this is fine but you need to put bun:test as the last replacement in the replacements array. otherwise it will be shown to non-bun users.
Roman is also right, it should be type: "native"
| "mockdate": { | ||
| "type": "module", | ||
| "moduleName": "mockdate", | ||
| "replacements": ["bun:test", "node:test", "vitest"], |
There was a problem hiding this comment.
| "replacements": ["bun:test", "node:test", "vitest"], | |
| "replacements": ["node:test", "vitest", "bun:test"], |
| }, | ||
| "node:test": { | ||
| "id": "node:test", | ||
| "type": "documented", |
There was a problem hiding this comment.
this should be a native type
There was a problem hiding this comment.
and url should point to nodejs docs
🔗 Linked issue
#487
📚 Description
AI was used an code was reviewed