Skip to content

Commit 726998a

Browse files
authored
Merge pull request #50 from mizdra/add-reset
Add `iff.writeFixtures()` and `iff.reset()`
2 parents b53b9b4 + ee4b46e commit 726998a

15 files changed

+1224
-572
lines changed

.vscode/settings.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"editor.defaultFormatter": "esbenp.prettier-vscode",
44
"editor.formatOnSave": true,
55
"editor.codeActionsOnSave": {
6-
"source.fixAll.eslint": true
6+
"source.fixAll.eslint": "always"
77
},
88
"typescript.preferences.importModuleSpecifier": "relative",
99
"javascript.preferences.importModuleSpecifier": "relative",
1010
"typescript.preferences.importModuleSpecifierEnding": "js",
1111
"javascript.preferences.importModuleSpecifierEnding": "js",
12-
"vitest.commandLine": "npm run test --"
12+
"vitest.commandLine": "npm run test --",
13+
"typescript.preferences.preferTypeOnlyAutoImports": true
1314
}

docs/api/inline-fixture-files.createiff.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Create fixtures in the specified directory.
99
**Signature:**
1010

1111
```typescript
12-
export type CreateIFF = <const T extends Directory, const U extends {}>(directory: T, options?: CreateIFFOptions | undefined, __INTERNAL__prevPaths?: U) => Promise<CreateIFFResult<U & FlattenDirectory<T>>>;
12+
export type CreateIFF = <const T extends Directory, U extends Directory = {}>(directory: T, options?: CreateIFFOptions | undefined, __INTERNAL__prevIFF?: CreateIFFResult<U>) => Promise<CreateIFFResult<MergeDirectory<U, T>>>;
1313
```
1414
**References:** [Directory](./inline-fixture-files.directory.md)<!-- -->, [CreateIFFOptions](./inline-fixture-files.createiffoptions.md)<!-- -->, [CreateIFFResult](./inline-fixture-files.createiffresult.md)
1515

docs/api/inline-fixture-files.createiffresult.addfixtures.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Add fixtures to the fixture root directory.
99
**Signature:**
1010

1111
```typescript
12-
addFixtures<const U extends Directory>(additionalDirectory: U): Promise<CreateIFFResult<Paths & FlattenDirectory<U>>>;
12+
addFixtures<const U extends Directory>(additionalDirectory: U): Promise<CreateIFFResult<MergeDirectory<T, U>>>;
1313
```
1414
1515
## Parameters
@@ -20,7 +20,7 @@ addFixtures<const U extends Directory>(additionalDirectory: U): Promise<CreateIF
2020
2121
**Returns:**
2222
23-
Promise&lt;[CreateIFFResult](./inline-fixture-files.createiffresult.md)<!-- -->&lt;Paths &amp; FlattenDirectory&lt;U&gt;&gt;&gt;
23+
Promise&lt;[CreateIFFResult](./inline-fixture-files.createiffresult.md)<!-- -->&lt;MergeDirectory&lt;T, U&gt;&gt;&gt;
2424
2525
The [CreateIFFResult](./inline-fixture-files.createiffresult.md) with the paths of the added fixtures to [CreateIFFResult.paths](./inline-fixture-files.createiffresult.paths.md)<!-- -->.
2626

docs/api/inline-fixture-files.createiffresult.fork.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Change the root directory and take over the fixture you created.
99
**Signature:**
1010

1111
```typescript
12-
fork<const U extends Directory>(additionalDirectory: U, forkOptions?: ForkOptions | undefined): Promise<CreateIFFResult<Paths & FlattenDirectory<U>>>;
12+
fork<const U extends Directory>(additionalDirectory: U, forkOptions?: ForkOptions | undefined): Promise<CreateIFFResult<MergeDirectory<T, U>>>;
1313
```
1414
1515
## Parameters
@@ -21,7 +21,7 @@ fork<const U extends Directory>(additionalDirectory: U, forkOptions?: ForkOption
2121
2222
**Returns:**
2323
24-
Promise&lt;[CreateIFFResult](./inline-fixture-files.createiffresult.md)<!-- -->&lt;Paths &amp; FlattenDirectory&lt;U&gt;&gt;&gt;
24+
Promise&lt;[CreateIFFResult](./inline-fixture-files.createiffresult.md)<!-- -->&lt;MergeDirectory&lt;T, U&gt;&gt;&gt;
2525
2626
## Remarks
2727

docs/api/inline-fixture-files.createiffresult.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ The return of [CreateIFF](./inline-fixture-files.createiff.md)<!-- -->.
99
**Signature:**
1010

1111
```typescript
12-
export interface CreateIFFResult<Paths extends {}>
12+
export interface CreateIFFResult<T extends Directory>
1313
```
1414

1515
## Properties
1616

1717
| Property | Modifiers | Type | Description |
1818
| --- | --- | --- | --- |
19-
| [paths](./inline-fixture-files.createiffresult.paths.md) | | Paths | The paths of the fixtures. It is useful to get the path of fixtures in type safety. |
19+
| [paths](./inline-fixture-files.createiffresult.paths.md) | | FlattenDirectory&lt;T&gt; | The paths of the fixtures. It is useful to get the path of fixtures in type safety. |
2020
| [rootDir](./inline-fixture-files.createiffresult.rootdir.md) | | string | The path of the fixture root directory. |
2121

2222
## Methods
@@ -26,6 +26,8 @@ export interface CreateIFFResult<Paths extends {}>
2626
| [addFixtures(additionalDirectory)](./inline-fixture-files.createiffresult.addfixtures.md) | Add fixtures to the fixture root directory. |
2727
| [fork(additionalDirectory, forkOptions)](./inline-fixture-files.createiffresult.fork.md) | Change the root directory and take over the fixture you created. |
2828
| [join(paths)](./inline-fixture-files.createiffresult.join.md) | Join <code>rootDir</code> and <code>paths</code>. It is equivalent to <code>require('path').join(rootDir, ...paths)</code>. |
29+
| [reset()](./inline-fixture-files.createiffresult.reset.md) | Delete the fixture root directory and write the fixtures specified in <code>directory</code> argument again. |
2930
| [rmFixtures()](./inline-fixture-files.createiffresult.rmfixtures.md) | Delete files under the fixture root directory. |
3031
| [rmRootDir()](./inline-fixture-files.createiffresult.rmrootdir.md) | Delete the fixture root directory. |
32+
| [writeFixtures(\_\_INTERNAL\_\_overrideRootDir)](./inline-fixture-files.createiffresult.writefixtures.md) | Write the fixtures specified in <code>directory</code> argument to the fixture root directory. |
3133

docs/api/inline-fixture-files.createiffresult.paths.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The paths of the fixtures. It is useful to get the path of fixtures in type safe
99
**Signature:**
1010

1111
```typescript
12-
paths: Paths;
12+
paths: FlattenDirectory<T>;
1313
```
1414

1515
## Example
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@mizdra/inline-fixture-files](./inline-fixture-files.md) &gt; [CreateIFFResult](./inline-fixture-files.createiffresult.md) &gt; [reset](./inline-fixture-files.createiffresult.reset.md)
4+
5+
## CreateIFFResult.reset() method
6+
7+
Delete the fixture root directory and write the fixtures specified in `directory` argument again.
8+
9+
**Signature:**
10+
11+
```typescript
12+
reset(): Promise<void>;
13+
```
14+
**Returns:**
15+
16+
Promise&lt;void&gt;
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@mizdra/inline-fixture-files](./inline-fixture-files.md) &gt; [CreateIFFResult](./inline-fixture-files.createiffresult.md) &gt; [writeFixtures](./inline-fixture-files.createiffresult.writefixtures.md)
4+
5+
## CreateIFFResult.writeFixtures() method
6+
7+
Write the fixtures specified in `directory` argument to the fixture root directory.
8+
9+
**Signature:**
10+
11+
```typescript
12+
writeFixtures(__INTERNAL__overrideRootDir?: string): Promise<void>;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| \_\_INTERNAL\_\_overrideRootDir | string | _(Optional)_ |
20+
21+
**Returns:**
22+
23+
Promise&lt;void&gt;
24+

0 commit comments

Comments
 (0)