Skip to content

Commit c7f3462

Browse files
cjihrigaduh95
authored andcommitted
test_runner: finish marking snapshot testing as stable
Snapshot testing was marked stable in #55897. These were overlooked at the time. Refs: #55897 PR-URL: #56425 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent bd00418 commit c7f3462

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

Diff for: doc/api/test.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,13 @@ test('runs timers as setTime passes ticks', (context) => {
930930

931931
## Snapshot testing
932932

933-
> Stability: 1.0 - Early development
933+
<!-- YAML
934+
added: v22.3.0
935+
changes:
936+
- version: v23.4.0
937+
pr-url: https://github.com/nodejs/node/pull/55897
938+
description: Snapsnot testing is no longer experimental.
939+
-->
934940

935941
Snapshot tests allow arbitrary values to be serialized into string values and
936942
compared against a set of known good values. The known good values are known as
@@ -1732,8 +1738,6 @@ describe('tests', async () => {
17321738
added: v22.3.0
17331739
-->
17341740

1735-
> Stability: 1.0 - Early development
1736-
17371741
An object whose methods are used to configure default snapshot settings in the
17381742
current process. It is possible to apply the same configuration to all files by
17391743
placing common configuration code in a module preloaded with `--require` or
@@ -1745,8 +1749,6 @@ placing common configuration code in a module preloaded with `--require` or
17451749
added: v22.3.0
17461750
-->
17471751

1748-
> Stability: 1.0 - Early development
1749-
17501752
* `serializers` {Array} An array of synchronous functions used as the default
17511753
serializers for snapshot tests.
17521754

@@ -1762,8 +1764,6 @@ more robust serialization mechanism is required, this function should be used.
17621764
added: v22.3.0
17631765
-->
17641766

1765-
> Stability: 1.0 - Early development
1766-
17671767
* `fn` {Function} A function used to compute the location of the snapshot file.
17681768
The function receives the path of the test file as its only argument. If the
17691769
test is not associated with a file (for example in the REPL), the input is
@@ -3232,8 +3232,6 @@ test('test', (t) => {
32323232
added: v22.3.0
32333233
-->
32343234

3235-
> Stability: 1.0 - Early development
3236-
32373235
* `value` {any} A value to serialize to a string. If Node.js was started with
32383236
the [`--test-update-snapshots`][] flag, the serialized value is written to
32393237
the snapshot file. Otherwise, the serialized value is compared to the

Diff for: lib/internal/test_runner/snapshot.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
ERR_INVALID_STATE,
1616
},
1717
} = require('internal/errors');
18-
const { emitExperimentalWarning, kEmptyObject } = require('internal/util');
18+
const { kEmptyObject } = require('internal/util');
1919
let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => {
2020
debug = fn;
2121
});
@@ -28,7 +28,6 @@ const { strictEqual } = require('assert');
2828
const { mkdirSync, readFileSync, writeFileSync } = require('fs');
2929
const { dirname } = require('path');
3030
const { createContext, runInContext } = require('vm');
31-
const kExperimentalWarning = 'Snapshot testing';
3231
const kMissingSnapshotTip = 'Missing snapshots can be generated by rerunning ' +
3332
'the command with the --test-update-snapshots flag.';
3433
const defaultSerializers = [
@@ -47,13 +46,11 @@ let resolveSnapshotPathFn = defaultResolveSnapshotPath;
4746
let serializerFns = defaultSerializers;
4847

4948
function setResolveSnapshotPath(fn) {
50-
emitExperimentalWarning(kExperimentalWarning);
5149
validateFunction(fn, 'fn');
5250
resolveSnapshotPathFn = fn;
5351
}
5452

5553
function setDefaultSnapshotSerializers(serializers) {
56-
emitExperimentalWarning(kExperimentalWarning);
5754
validateFunctionArray(serializers, 'serializers');
5855
serializerFns = ArrayPrototypeSlice(serializers);
5956
}
@@ -207,7 +204,6 @@ class SnapshotManager {
207204
const manager = this;
208205

209206
return function snapshotAssertion(actual, options = kEmptyObject) {
210-
emitExperimentalWarning(kExperimentalWarning);
211207
validateObject(options, 'options');
212208
const {
213209
serializers = serializerFns,

0 commit comments

Comments
 (0)