Node.js v19.1.0 现已发布,此版本一些更新内容包括:
Notable changes
支持 Node.js 测试运行器上的 function mocking #45326
node:test 模块在测试过程中通过顶层的 mock object 支持 mocking。
 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); });   Linux 上的 fs.watch 递归支持 #45098
fs.watch使用recursive: true选项支持 recursive watch
 const watcher = fs.watch(testDirectory, { recursive: true }); watcher.on('change', function(event, filename) { });  Other notable changes
- deps    
- 将 ICU 更新到 72.1 #45068
 
 - doc    
- 将 lukekarrys 添加到 collaborators #45180
 - 将 anonrig 添加到 collaborators # 45002
 
 - lib    
- 删去 fetch 实验性警告 #45287
 
 - util
 
详情可查看更新说明:https://nodejs.org/en/blog/release/v19.1.0/


		
		
		

还没有评论,来说两句吧...