タグ

2023年7月12日のブックマーク (1件)

  • Node.js — Node v20.4.0 (Current)

    Notable Changes Mock Timers The new feature allows developers to write more reliable and predictable tests for time-dependent functionality. It includes MockTimers with the ability to mock setTimeout, setInterval from globals, node:timers, and node:timers/promises. The feature provides a simple API to advance time, enable specific timers, and release all timers. import assert from 'node:assert'; i

    Node.js — Node v20.4.0 (Current)
    Shisama
    Shisama 2023/07/12
    Node.jsにsetTimeoutなどタイマー関数をモックする機能の追加。 タイマーのモックを有効にする関数、時間を進める関数、モックを解放する関数などが追加されている。リソース解放漏れを防ぐStage 3のusing構文もサポートされた