summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2023-04-20 01:47:31 -0700
committerGitHub <noreply@github.com>2023-04-20 10:47:31 +0200
commitc505a0f5dccd120d97926f6ff5bbe0becf783aeb (patch)
treec9b57b5e6e7989bf37c13d9c35cd882da3f4e8b3 /tools
parentf16ac4d258bd0981506d01456bd5f43079e00fa5 (diff)
Add UPDATE_EXPECT envvar to update tests (#748)
Diffstat (limited to 'tools')
-rw-r--r--tools/test-helper/README.md5
-rw-r--r--tools/test-helper/extension.js4
-rw-r--r--tools/test-helper/images/update-dark.svg (renamed from tools/test-helper/images/approve-dark.svg)0
-rw-r--r--tools/test-helper/images/update-light.svg (renamed from tools/test-helper/images/approve-light.svg)0
-rw-r--r--tools/test-helper/package.json14
5 files changed, 13 insertions, 10 deletions
diff --git a/tools/test-helper/README.md b/tools/test-helper/README.md
index d3092d0d..45e0f6e2 100644
--- a/tools/test-helper/README.md
+++ b/tools/test-helper/README.md
@@ -7,5 +7,8 @@ the `tests` folder.
- Open: Opens the output and reference images of a test to the side.
- Refresh: Refreshes the preview.
- Rerun: Re-runs the test.
-- Approve: Copies the output into the reference folder and optimizes
+- Update: Copies the output into the reference folder and optimizes
it with `oxipng`.
+
+For the test helper to work correctly, you also need to install `oxipng`, for
+example with `cargo install oxipng`.
diff --git a/tools/test-helper/extension.js b/tools/test-helper/extension.js
index a745916a..4682505c 100644
--- a/tools/test-helper/extension.js
+++ b/tools/test-helper/extension.js
@@ -51,7 +51,7 @@ function activate(context) {
)
})
- const approveCmd = vscode.commands.registerCommand("ShortcutMenuBar.testApprove", () => {
+ const updateCmd = vscode.commands.registerCommand("ShortcutMenuBar.testUpdate", () => {
const uri = vscode.window.activeTextEditor.document.uri
const { pngPath, refPath } = getPaths(uri)
@@ -66,7 +66,7 @@ function activate(context) {
context.subscriptions.push(openCmd)
context.subscriptions.push(refreshCmd)
context.subscriptions.push(rerunCmd)
- context.subscriptions.push(approveCmd)
+ context.subscriptions.push(updateCmd)
}
function getPaths(uri) {
diff --git a/tools/test-helper/images/approve-dark.svg b/tools/test-helper/images/update-dark.svg
index 61701503..61701503 100644
--- a/tools/test-helper/images/approve-dark.svg
+++ b/tools/test-helper/images/update-dark.svg
diff --git a/tools/test-helper/images/approve-light.svg b/tools/test-helper/images/update-light.svg
index 4e015d0a..4e015d0a 100644
--- a/tools/test-helper/images/approve-light.svg
+++ b/tools/test-helper/images/update-light.svg
diff --git a/tools/test-helper/package.json b/tools/test-helper/package.json
index 157df0cb..d2578ab9 100644
--- a/tools/test-helper/package.json
+++ b/tools/test-helper/package.json
@@ -1,7 +1,7 @@
{
"name": "typst-test-helper",
"displayName": "Typst Test Helper",
- "description": "Helps to run, compare and approve Typst tests.",
+ "description": "Helps to run, compare and update Typst tests.",
"version": "0.0.1",
"engines": {
"vscode": "^1.53.0"
@@ -13,7 +13,7 @@
"onCommand:ShortcutMenuBar.testOpen",
"onCommand:ShortcutMenuBar.testRefresh",
"onCommand:ShortcutMenuBar.testRerun",
- "onCommand:ShortcutMenuBar.testApprove"
+ "onCommand:ShortcutMenuBar.testUpdate"
],
"main": "./extension.js",
"contributes": {
@@ -46,12 +46,12 @@
}
},
{
- "command": "ShortcutMenuBar.testApprove",
- "title": "Approve output",
+ "command": "ShortcutMenuBar.testUpdate",
+ "title": "Update reference image",
"category": "ShortcutMenuBar",
"icon": {
- "light": "images/approve-light.svg",
- "dark": "images/approve-dark.svg"
+ "light": "images/update-light.svg",
+ "dark": "images/update-dark.svg"
}
}
],
@@ -74,7 +74,7 @@
},
{
"when": "resourceExtname == .typ && resourcePath =~ /.*tests.*/",
- "command": "ShortcutMenuBar.testApprove",
+ "command": "ShortcutMenuBar.testUpdate",
"group": "navigation@3"
}
]