File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,12 @@ exports[`#dump() > with a glob pattern > should return files that matches the pa
43
43
},
44
44
}
45
45
` ;
46
+
47
+ exports [` #dump() > with custom filter > should match snapshot 1` ] = `
48
+ {
49
+ " foo/not-committed" : {
50
+ " contents" : " not-committed" ,
51
+ " state" : " modified" ,
52
+ },
53
+ }
54
+ ` ;
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ describe('#dump()', () => {
42
42
expect ( fs . dump ( output ) ) . toMatchSnapshot ( ) ;
43
43
} ) ;
44
44
45
+ describe ( 'with custom filter' , ( ) => {
46
+ it ( 'should match snapshot' , ( ) => {
47
+ expect ( fs . dump ( output , file => file . path . endsWith ( 'not-committed' ) ) ) . toMatchSnapshot ( ) ;
48
+ } ) ;
49
+ } ) ;
50
+
45
51
describe ( 'with a glob pattern' , ( ) => {
46
52
it ( 'should return files that matches the pattern and have state or stateCleared' , ( ) => {
47
53
expect ( fs . dump ( output , '**/*committed' ) ) . toMatchSnapshot ( ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default function <EditorFile extends MemFsEditorFile>(
21
21
const filterFile : ( file : EditorFile , cwd : string ) => boolean =
22
22
typeof filter === 'string'
23
23
? ( file : MemFsEditorFile ) => defaultDumpFilter ( file ) && minimatch ( file . path , filter )
24
- : defaultDumpFilter ;
24
+ : filter ?? defaultDumpFilter ;
25
25
26
26
return Object . fromEntries (
27
27
this . store
You can’t perform that action at this time.
0 commit comments