You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.md
+34-12Lines changed: 34 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ default-flags=["report"]
7
7
default-flags-tui=["create", "review"]
8
8
format-command=""
9
9
show-updates=false
10
+
default-storage="uuid"
10
11
11
12
[tool.inline-snapshot.shortcuts]
12
13
review=["review"]
@@ -36,24 +37,45 @@ fix=["create","fix"]
36
37
***shortcuts:** allows you to define custom commands to simplify your workflows.
37
38
`--fix` and `--review` are defined by default, but this configuration can be changed to fit your needs.
38
39
39
-
***storage-dir:** allows you to define the directory where inline-snapshot stores data files such as external snapshots.
40
+
***storage-dir:** allows you to define the directory where inline-snapshot stores data files such as external snapshots stored with the `hash:` protocol.
40
41
By default, it will be `<pytest_config_dir>/.inline-snapshot`,
41
42
where `<pytest_config_dir>` is replaced by the directory containing the Pytest configuration file, if any.
42
43
External snapshots will be stored in the `external` subfolder of the storage directory.
43
44
***format-command:[](){#format-command}** allows you to specify a custom command which is used to format the python code after code is changed.
44
-
```toml
45
-
[tool.inline-snapshot]
46
-
format-command="ruff format --stdin-filename {filename}"
47
-
```
48
-
The placeholder `{filename}` can be used to specify the filename if it is needed to find the correct formatting options for this file.
45
+
46
+
=== "ruff format"
47
+
``` toml
48
+
[tool.inline-snapshot]
49
+
format-command="ruff format --stdin-filename {filename}"
50
+
```
51
+
52
+
=== "ruff format & lint"
53
+
``` toml
54
+
[tool.inline-snapshot]
55
+
format-command="ruff check --fix-only --stdin-filename {filename} | ruff format --stdin-filename {filename}"
inline-snapshot will format only the snapshot values with black when you specified no format command but needs black installed with `inline-snapshot[black]`.
66
+
67
+
The placeholder `{filename}` can be used to specify the filename if it is needed to find the correct formatting options for this file.
49
68
50
69
!!! important
51
70
The command should **not** format the file on disk. The current file content (with the new code changes) is passed to *stdin* and the formatted content should be written to *stdout*.
52
71
53
-
You can also use a `|` if you want to use multiple commands.
54
-
```toml
55
-
[tool.inline-snapshot]
56
-
format-command="ruff check --fix-only --stdin-filename {filename} | ruff format --stdin-filename {filename}"
57
-
```
58
-
59
72
***show-updates:**[](){#show-updates} shows updates in reviews and reports.
73
+
74
+
75
+
***default-storage:**[](){#default-storage} defines the default storage protocol to be used when creating snapshots without an explicit storage protocol (e.g. like `external()`).
76
+
Possible values are `hash` and `uuid`.
77
+
external snapshots created by `outsource()` do not currently support this setting due to some internal limitations and will always use the old `hash` protocol.
78
+
79
+
***tests-dir:** can be used to define where your tests are located.
80
+
The default is `<pytest_config_dir>/tests` if it exists or `<pytest_config_dir>` if you have no tests directory,
81
+
where `<pytest_config_dir>` is replaced by the directory containing the Pytest configuration file, if any.
0 commit comments