MyGit

v19.1.0

nodejs/node

版本发布时间: 2022-11-14 22:41:44

nodejs/node最新发布版本:v23.3.0(2024-11-21 07:00:59)

Notable changes

Support function mocking on Node.js test runner

The node:test module supports mocking during testing via a top-level mock object.

test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});

Contributed by Colin Ihrig in #45326

fs.watch recursive support on Linux

fs.watch supports recursive watch using the recursive: true option.

const watcher = fs.watch(testDirectory, { recursive: true });
watcher.on('change', function(event, filename) {
});

Contributed by Yagiz Nizipli in #45098

Other notable changes

Commits

相关地址:原始地址 下载(tar) 下载(zip)

查看:2022-11-14发行的版本