Skip to content

Commit 6371b8f

Browse files
committed
feat(file): withFiles
1 parent 484612f commit 6371b8f

12 files changed

Lines changed: 769 additions & 63 deletions

File tree

.eslintrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ extends:
66
- '@comicrelief/eslint-config/mixins/jsdoc'
77

88
rules:
9+
no-continue: off
910
'@typescript-eslint/no-non-null-assertion': off
1011
'@typescript-eslint/no-explicit-any': off

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ await withYamlFile('example.yaml', (f) => {
103103
});
104104
```
105105

106+
### `withFiles(search: WithFilesOptions, callback: (f: Text) => void | Promise<void>): Promise<void>`
107+
108+
Work on text files that match the given search criteria.
109+
110+
```ts
111+
// replace every occurrance of 'foo' with 'bar' in every JS file
112+
await withFiles({
113+
include: '**.js',
114+
containing: 'foo',
115+
}, (f) => {
116+
f.replaceAll('foo', 'bar');
117+
});
118+
```
119+
106120
## Test helpers
107121

108122
### `sh.mock()`

0 commit comments

Comments
 (0)