MyGit

v23.4.0

nodejs/node

版本发布时间: 2024-12-11 00:00:03

nodejs/node最新发布版本:v23.5.0(2024-12-20 02:57:09)

Notable Changes

Introducing experimental assert.partialDeepStrictEqual

Sometimes, when writing test, we want to validate that some specific properties are present, and the mere presence of additional keys are not exactly relevant for that specific test. For this use case, we can now use assert.partialDeepStrictEqual, which should be familiar to those already using assert.deepStrictEqual, with the main difference that it does not require all properties in the actual parameter to be present in the expected parameter.

Here are a few examples of usage:

assert.partialDeepStrictEqual(
  { a: 1, b: 2, c: 3 },
  { a: 1, b: 2 },
);

assert.partialDeepStrictEqual(
  [1, 2, 3, 4],
  [2, 3],
);

assert.partialDeepStrictEqual(
  { a: { b: { c: 1, d: 2 } }, e: 3 },
  { a: { b: { c: 1 } } },
);

assert.partialDeepStrictEqual(
  { a: { b: { c: 1, d: 2 } }, e: 3 },
  { a: { b: { c: 1 } } },
);

assert.partialDeepStrictEqual(
  new Set([{ a: 1 }, { b: 1 }]),
  new Set([{ a: 1 }]),
);

assert.partialDeepStrictEqual(
  { a: new Set([{ a: 1 }, { b: 1 }]), b: new Map(), c: [1, 2, 3] },
  { a: new Set([{ a: 1 }]), c: [2] },
);

Contributed by Giovanni Bucci in #54630.

Implement --trace-env and --trace-env-[js|native]-stack

This release introduces --trace-env, --trace-env-js-stack and --trace-env-native-stack CLI options that print information about any access to environment variables done in the current Node.js instance to stderr. Currently in the logs, only the names of the environment variables being accessed are printed, while the values are not printed to avoid leaking sensitive information. To print the stack trace of the access, use --trace-env-js-stack and/or --trace-env-native-stack.

Contributed by Joyee Cheung in #55604.

Other notable changes

Commits

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

查看:2024-12-11发行的版本