GeezerVison is showing github.com — assert: remove `assert.snapshot` · nodejs/node@def3694
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/assert.md -44Lines changed: 0 additions & 44 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2093,48 +2093,6 @@ argument, then `error` is assumed to be omitted and the string will be used for | 2093 | 2093 | example in [`assert.throws()`][] carefully if using a string as the second | 2094 | 2094 | argument gets considered. | 2095 | 2095 |
| 2096 | | -## `assert.snapshot(value, name)` | 2097 | | - | 2098 | | -<!-- YAML | 2099 | | -added: v18.8.0 | 2100 | | ---> | 2101 | | - | 2102 | | -> Stability: 1 - Experimental | 2103 | | -
| 2104 | | -* `value` {any} the value to snapshot. | 2105 | | -* `name` {string} the name of the snapshot. | 2106 | | -* Returns: {Promise} | 2107 | | - | 2108 | | -Reads the `name` snapshot from a file and compares `value` to the snapshot. | 2109 | | -`value` is serialized with [`util.inspect()`][]. If the value is not strictly | 2110 | | -equal to the snapshot, `assert.snapshot()` returns a rejected `Promise` with an | 2111 | | -[`AssertionError`][]. | 2112 | | - | 2113 | | -The snapshot filename uses the same basename as the application's main | 2114 | | -entrypoint with a `.snapshot` extension. If the snapshot file does not exist, | 2115 | | -it is created. The [`--update-assert-snapshot`][] command line flag can be used | 2116 | | -to force the update of an existing snapshot. | 2117 | | - | 2118 | | -```mjs | 2119 | | -import assert from 'node:assert/strict'; | 2120 | | - | 2121 | | -// Assuming that the application's main entrypoint is app.mjs, this reads the | 2122 | | -// 'snapshotName' snapshot from app.snapshot and strictly compares its value | 2123 | | -// to `util.inspect('value')`. | 2124 | | -await assert.snapshot('value', 'snapshotName'); | 2125 | | -``` | 2126 | | - | 2127 | | -```cjs | 2128 | | -const assert = require('node:assert/strict'); | 2129 | | - | 2130 | | -(async () => { | 2131 | | - // Assuming that the application's main entrypoint is app.js, this reads the | 2132 | | - // 'snapshotName' snapshot from app.snapshot and strictly compares its value | 2133 | | - // to `util.inspect('value')`. | 2134 | | - await assert.snapshot('value', 'snapshotName'); | 2135 | | -})(); | 2136 | | -``` | 2137 | | - | 2138 | 2096 | ## `assert.strictEqual(actual, expected[, message])` | 2139 | 2097 |
| 2140 | 2098 | <!-- YAML | @@ -2571,7 +2529,6 @@ argument. | 2571 | 2529 | [Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript | 2572 | 2530 | [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring | 2573 | 2531 | [`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality | 2574 | | -[`--update-assert-snapshot`]: cli.md#--update-assert-snapshot | 2575 | 2532 | [`===` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality | 2576 | 2533 | [`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality | 2577 | 2534 | [`AssertionError`]: #class-assertassertionerror | @@ -2603,6 +2560,5 @@ argument. | 2603 | 2560 | [`process.on('exit')`]: process.md#event-exit | 2604 | 2561 | [`tracker.calls()`]: #trackercallsfn-exact | 2605 | 2562 | [`tracker.verify()`]: #trackerverify | 2606 | | -[`util.inspect()`]: util.md#utilinspectobject-options | 2607 | 2563 | [enumerable "own" properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties | 2608 | 2564 | [prototype-spec]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots |
Collapse file Copy file name to clipboardExpand all lines: doc/api/cli.md -10Lines changed: 0 additions & 10 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1513,14 +1513,6 @@ occurs. One of the following modes can be chosen: | 1513 | 1513 | If a rejection happens during the command line entry point's ES module static | 1514 | 1514 | loading phase, it will always raise it as an uncaught exception. | 1515 | 1515 |
| 1516 | | -### `--update-assert-snapshot` | 1517 | | - | 1518 | | -<!-- YAML | 1519 | | -added: v18.8.0 | 1520 | | ---> | 1521 | | - | 1522 | | -Updates snapshot files used by [`assert.snapshot()`][]. | 1523 | | - | 1524 | 1516 | ### `--use-bundled-ca`, `--use-openssl-ca` | 1525 | 1517 |
| 1526 | 1518 | <!-- YAML | @@ -1943,7 +1935,6 @@ Node.js options that are allowed are: | 1943 | 1935 | * `--trace-warnings` | 1944 | 1936 | * `--track-heap-objects` | 1945 | 1937 | * `--unhandled-rejections` | 1946 | | -* `--update-assert-snapshot` | 1947 | 1938 | * `--use-bundled-ca` | 1948 | 1939 | * `--use-largepages` | 1949 | 1940 | * `--use-openssl-ca` | @@ -2324,7 +2315,6 @@ done | 2324 | 2315 | [`NO_COLOR`]: https://no-color.org | 2325 | 2316 | [`SlowBuffer`]: buffer.md#class-slowbuffer | 2326 | 2317 | [`YoungGenerationSizeFromSemiSpaceSize`]: https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328 | 2327 | | -[`assert.snapshot()`]: assert.md#assertsnapshotvalue-name | 2328 | 2318 | [`dns.lookup()`]: dns.md#dnslookuphostname-options-callback | 2329 | 2319 | [`dns.setDefaultResultOrder()`]: dns.md#dnssetdefaultresultorderorder | 2330 | 2320 | [`dnsPromises.lookup()`]: dns.md#dnspromiseslookuphostname-options | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/errors.md -7Lines changed: 0 additions & 7 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -705,13 +705,6 @@ A special type of error that can be triggered whenever Node.js detects an | 705 | 705 | exceptional logic violation that should never occur. These are raised typically | 706 | 706 | by the `node:assert` module. | 707 | 707 |
| 708 | | -<a id="ERR_ASSERT_SNAPSHOT_NOT_SUPPORTED"></a> | 709 | | - | 710 | | -### `ERR_ASSERT_SNAPSHOT_NOT_SUPPORTED` | 711 | | - | 712 | | -An attempt was made to use `assert.snapshot()` in an environment that | 713 | | -does not support snapshots, such as the REPL, or when using `node --eval`. | 714 | | - | 715 | 708 | <a id="ERR_ASYNC_CALLBACK"></a> | 716 | 709 |
| 717 | 710 | ### `ERR_ASYNC_CALLBACK` | |
Collapse file Copy file name to clipboardExpand all lines: doc/node.1 -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -491,9 +491,6 @@ Track heap object allocations for heap snapshots. | 491 | 491 | .It Fl -unhandled-rejections=mode | 492 | 492 | Define the behavior for unhandled rejections. Can be one of `strict` (raise an error), `warn` (enforce warnings) or `none` (silence warnings). | 493 | 493 | . | 494 | | -.It Fl -update-assert-snapshot | 495 | | -Updates snapshot files used by `assert.snapshot()`. | 496 | | -. | 497 | 494 | .It Fl -use-bundled-ca , Fl -use-openssl-ca | 498 | 495 | Use bundled Mozilla CA store as supplied by current Node.js version or use OpenSSL's default CA store. | 499 | 496 | The default store is selectable at build-time. | |
Collapse file Copy file name to clipboardExpand all lines: lib/assert.js -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1052,9 +1052,6 @@ assert.doesNotMatch = function doesNotMatch(string, regexp, message) { | 1052 | 1052 |
| 1053 | 1053 | assert.CallTracker = CallTracker; | 1054 | 1054 |
| 1055 | | -const snapshot = require('internal/assert/snapshot'); | 1056 | | -assert.snapshot = snapshot; | 1057 | | - | 1058 | 1055 | /** | 1059 | 1056 | * Expose a strict only variant of assert. | 1060 | 1057 | * @param {...any} args | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/assert/snapshot.js -129Lines changed: 0 additions & 129 deletions Collapse file Copy file name to clipboardExpand all lines: lib/internal/errors.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -962,8 +962,6 @@ module.exports = { | 962 | 962 | E('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); | 963 | 963 | E('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError); | 964 | 964 | E('ERR_ASSERTION', '%s', Error); | 965 | | -E('ERR_ASSERT_SNAPSHOT_NOT_SUPPORTED', | 966 | | - 'Snapshot is not supported in this context ', TypeError); | 967 | 965 | E('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError); | 968 | 966 | E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s', TypeError); | 969 | 967 | E('ERR_BROTLI_INVALID_PARAM', '%s is not a valid Brotli parameter', RangeError); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.cc -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -657,11 +657,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | 657 | 657 | &EnvironmentOptions::force_repl); | 658 | 658 | AddAlias("-i", "--interactive"); | 659 | 659 |
| 660 | | - AddOption("--update-assert-snapshot", | 661 | | - "update assert snapshot files", | 662 | | - &EnvironmentOptions::update_assert_snapshot, | 663 | | - kAllowedInEnvvar); | 664 | | - | 665 | 660 | AddOption("--napi-modules", "", NoOp{}, kAllowedInEnvvar); | 666 | 661 |
| 667 | 662 | AddOption("--tls-keylog", | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.h -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -139,7 +139,6 @@ class EnvironmentOptions : public Options { | 139 | 139 | bool preserve_symlinks = false; | 140 | 140 | bool preserve_symlinks_main = false; | 141 | 141 | bool prof_process = false; | 142 | | - bool update_assert_snapshot = false; | 143 | 142 | #if HAVE_INSPECTOR | 144 | 143 | std::string cpu_prof_dir; | 145 | 144 | static const uint64_t kDefaultCpuProfInterval = 1000; | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/assert-snapshot/basic.mjs -3Lines changed: 0 additions & 3 deletions
|