Buckets:
ktongue/docker_container / .cache /opencode /node_modules /process-warning /test /emit-unlimited.test.js
| const { test } = require('node:test') | |
| const { createWarning } = require('..') | |
| const { withResolvers } = require('./promise') | |
| test('emit should emit a given code unlimited times', t => { | |
| t.plan(50) | |
| let runs = 0 | |
| const expectedRun = [] | |
| const times = 10 | |
| const { promise, resolve } = withResolvers() | |
| process.on('warning', onWarning) | |
| function onWarning (warning) { | |
| t.assert.deepStrictEqual(warning.name, 'TestDeprecation') | |
| t.assert.deepStrictEqual(warning.code, 'CODE') | |
| t.assert.deepStrictEqual(warning.message, 'Hello world') | |
| t.assert.ok(warn.emitted) | |
| t.assert.deepStrictEqual(runs++, expectedRun.shift()) | |
| } | |
| const warn = createWarning({ | |
| name: 'TestDeprecation', | |
| code: 'CODE', | |
| message: 'Hello world', | |
| unlimited: true | |
| }) | |
| for (let i = 0; i < times; i++) { | |
| expectedRun.push(i) | |
| warn() | |
| } | |
| setImmediate(() => { | |
| process.removeListener('warning', onWarning) | |
| resolve() | |
| }) | |
| return promise | |
| }) | |
Xet Storage Details
- Size:
- 977 Bytes
- Xet hash:
- 8fc939935cbd5e87be2e090fe2e261de7cbe5788bcc147ab0fc605f430eade6c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.