@@ -15,6 +15,9 @@ function isUpdateSnapshot(): boolean {
15
15
return process . argv . includes ( '--update-snapshots' )
16
16
}
17
17
18
+ const onlyFile = process . env [ 'ONLY' ]
19
+ const onlyAbsoluteFilename = onlyFile ? join ( process . cwd ( ) , onlyFile ) : ''
20
+
18
21
const snapshotNodeModules = join ( process . cwd ( ) , 'snapshots' , 'node_modules' )
19
22
if ( ! fs . existsSync ( snapshotNodeModules ) ) {
20
23
throw new Error (
@@ -34,16 +37,14 @@ interface PackageJson {
34
37
packageManager ?: string
35
38
}
36
39
for ( const snapshotDirectory of snapshotDirectories ) {
37
- // Uncomment below if you want to skip certain tests for local development.
38
- // if (!snapshotDirectory.includes('syntax')) {
39
- // continue
40
- // }
41
40
const inputRoot = join ( inputDirectory , snapshotDirectory )
42
41
const outputRoot = join ( outputDirectory , snapshotDirectory )
43
42
if ( ! fs . statSync ( inputRoot ) . isDirectory ( ) ) {
44
43
continue
45
44
}
46
- test ( snapshotDirectory , ( ) => {
45
+ const testFunction =
46
+ onlyFile && ! onlyAbsoluteFilename . startsWith ( inputRoot ) ? test . skip : test
47
+ testFunction ( snapshotDirectory , ( ) => {
47
48
const packageJsonPath = path . join ( inputRoot , 'package.json' )
48
49
const packageJson = JSON . parse (
49
50
fs . readFileSync ( packageJsonPath ) . toString ( )
@@ -61,6 +62,12 @@ for (const snapshotDirectory of snapshotDirectories) {
61
62
progressBar : false ,
62
63
indexedProjects : new Set ( ) ,
63
64
globalCaches : true ,
65
+ shouldIndexFile : filename => {
66
+ if ( onlyFile ) {
67
+ return filename === onlyAbsoluteFilename
68
+ }
69
+ return true
70
+ } ,
64
71
} )
65
72
if ( inferTsconfig ) {
66
73
fs . rmSync ( tsconfigJsonPath )
0 commit comments