@@ -17,6 +17,9 @@ import {
17
17
serialize ,
18
18
} from "./_snapshot_utils.ts" ;
19
19
20
+ // TODO (WWRS): Remove this when we drop support for Deno 1.x
21
+ export const LINT_SUPPORTED = ! Deno . version . deno . startsWith ( "1." ) ;
22
+
20
23
/** The options for {@linkcode assertInlineSnapshot}. */
21
24
22
25
export interface InlineSnapshotOptions < T = unknown >
@@ -136,6 +139,12 @@ class AssertInlineSnapshotContext {
136
139
const snapshotsUpdated = Object . keys ( this . #lineColumnToSnapshot) . length ;
137
140
if ( snapshotsUpdated === 0 ) return ;
138
141
142
+ if ( ! LINT_SUPPORTED ) {
143
+ throw new Error (
144
+ "Deno versions before 2.2.0 do not support Deno.lint, which is required to update inline snapshots" ,
145
+ ) ;
146
+ }
147
+
139
148
const testFilePath = fromFileUrl ( this . #testFileUrl) ;
140
149
ensureFileSync ( testFilePath ) ;
141
150
const file = Deno . readTextFileSync ( testFilePath ) ;
@@ -237,8 +246,8 @@ class AssertInlineSnapshotContext {
237
246
* ```ts
238
247
* import { assertInlineSnapshot } from "@std/testing/snapshot";
239
248
*
240
- * Deno.test("snapshot", async (t) => {
241
- * await assertInlineSnapshot<number>(t, 2, `2`);
249
+ * Deno.test("snapshot", (t) => {
250
+ * assertInlineSnapshot<number>(t, 2, `2`);
242
251
* });
243
252
* ```
244
253
* @typeParam T The type of the snapshot
@@ -263,8 +272,8 @@ export function assertInlineSnapshot<T>(
263
272
* ```ts
264
273
* import { assertInlineSnapshot } from "@std/testing/snapshot";
265
274
*
266
- * Deno.test("snapshot", async (t) => {
267
- * await assertInlineSnapshot<number>(t, 2, `2`);
275
+ * Deno.test("snapshot", (t) => {
276
+ * assertInlineSnapshot<number>(t, 2, `2`);
268
277
* });
269
278
* ```
270
279
* @typeParam T The type of the snapshot
@@ -354,8 +363,8 @@ export function assertInlineSnapshot(
354
363
* format: false
355
364
* });
356
365
*
357
- * Deno.test("a snapshot test case", async (t) => {
358
- * await assertInlineSnapshot(
366
+ * Deno.test("a snapshot test case", (t) => {
367
+ * assertInlineSnapshot(
359
368
* t,
360
369
* { foo: "Hello", bar: "World" },
361
370
* `CREATE`
0 commit comments