Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 08e500f

Browse files
committedJan 2, 2025
test_runner: finish marking snapshot testing as stable
Snapshot testing was marked stable in nodejs#55897. These were overlooked at the time. Refs: nodejs#55897
1 parent 0dbbaba commit 08e500f

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed
 

‎doc/api/test.md

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

933933
## Snapshot testing
934934

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

937943
Snapshot tests allow arbitrary values to be serialized into string values and
938944
compared against a set of known good values. The known good values are known as
@@ -1750,8 +1756,6 @@ describe('tests', async () => {
17501756
added: v22.3.0
17511757
-->
17521758

1753-
> Stability: 1.0 - Early development
1754-
17551759
An object whose methods are used to configure default snapshot settings in the
17561760
current process. It is possible to apply the same configuration to all files by
17571761
placing common configuration code in a module preloaded with `--require` or
@@ -1763,8 +1767,6 @@ placing common configuration code in a module preloaded with `--require` or
17631767
added: v22.3.0
17641768
-->
17651769

1766-
> Stability: 1.0 - Early development
1767-
17681770
* `serializers` {Array} An array of synchronous functions used as the default
17691771
serializers for snapshot tests.
17701772

@@ -1780,8 +1782,6 @@ more robust serialization mechanism is required, this function should be used.
17801782
added: v22.3.0
17811783
-->
17821784

1783-
> Stability: 1.0 - Early development
1784-
17851785
* `fn` {Function} A function used to compute the location of the snapshot file.
17861786
The function receives the path of the test file as its only argument. If the
17871787
test is not associated with a file (for example in the REPL), the input is
@@ -3261,8 +3261,6 @@ test('test', (t) => {
32613261
added: v22.3.0
32623262
-->
32633263

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

‎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)
Please sign in to comment.