mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
doc: use cjs as block code's type in MockTimers
Use `cjs` instead of `js` to show toggle button between CJS and ESM because corresponding example using `mjs` exists. PR-URL: https://github.com/nodejs/node/pull/49309 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Raz Luvaton <rluvaton@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
9fac310b33
commit
935dfe2afd
1 file changed
+8
-8
+8
-8
@@ -1608,7 +1608,7 @@ import { mock } from 'node:test';
|
||||
mock.timers.enable(['setInterval']);
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const { mock } = require('node:test');
|
||||
mock.timers.enable(['setInterval']);
|
||||
```
|
||||
@@ -1645,7 +1645,7 @@ import { mock } from 'node:test';
|
||||
mock.timers.reset();
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const { mock } = require('node:test');
|
||||
mock.timers.reset();
|
||||
```
|
||||
@@ -1694,7 +1694,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
|
||||
@@ -1733,7 +1733,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
|
||||
@@ -1777,7 +1777,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
|
||||
@@ -1834,7 +1834,7 @@ test('mocks setTimeout to be executed synchronously without having to actually w
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
const nodeTimers = require('node:timers');
|
||||
@@ -1896,7 +1896,7 @@ test('should tick five times testing a real use case', async (context) => {
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
const nodeTimersPromises = require('node:timers/promises');
|
||||
@@ -1962,7 +1962,7 @@ test('runAll functions following the given order', (context) => {
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
```cjs
|
||||
const assert = require('node:assert');
|
||||
const { test } = require('node:test');
|
||||
|
||||
|
||||
Reference in new issue
Block a user