mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Better instruction in test READMEs (#3929)
This commit is contained in:
parent
1f8454fa54
commit
5415095ef3
@ -24,14 +24,17 @@ You may want to [make yourself an alias](#making-an-alias) like:
|
|||||||
testit
|
testit
|
||||||
```
|
```
|
||||||
|
|
||||||
Running all tests whose paths contain the string `page` or `stack`.
|
Running all tests whose names contain the string `page` or `stack`. Note each
|
||||||
|
`.typ` file in this directory can contain multiple tests, each of which is a
|
||||||
|
section of Typst code following `--- {name} ---`.
|
||||||
```bash
|
```bash
|
||||||
|
# Add --verbose to list which tests were run.
|
||||||
testit page stack
|
testit page stack
|
||||||
```
|
```
|
||||||
|
|
||||||
Running a test with the exact filename `page.typ`.
|
Running a test with the exact test name `math-attach-mixed`.
|
||||||
```bash
|
```bash
|
||||||
testit --exact page.typ
|
testit --exact math-attach-mixed
|
||||||
```
|
```
|
||||||
|
|
||||||
To make the integration tests go faster they don't generate PDFs by default.
|
To make the integration tests go faster they don't generate PDFs by default.
|
||||||
|
@ -1,29 +1,34 @@
|
|||||||
# Test helper
|
# Test helper
|
||||||
|
|
||||||
This is a small VS Code extension that helps with managing Typst's test suite.
|
This is a small VS Code extension that helps with managing Typst's test suite.
|
||||||
When installed, a new Code Lens appears in all `.typ` files in the `tests`
|
When installed, for all `.typ` files in the `tests` directory, the following
|
||||||
folder. It provides the following actions:
|
Code Lens buttons will appear above every test's name:
|
||||||
|
|
||||||
- View: Opens the output and reference image of a test to the side.
|
- View: Opens the output and reference image of a test to the side.
|
||||||
- Run: Runs the test and shows the results to the side.
|
- Run: Runs the test and shows the results to the side.
|
||||||
|
- Save: Runs the test with `--update` to save the reference image.
|
||||||
- Terminal: Runs the test in the integrated terminal.
|
- Terminal: Runs the test in the integrated terminal.
|
||||||
|
|
||||||
In the side panel, there are a few menu actions at the top right:
|
In the side panel opened by the Code Lens buttons, there are a few menu buttons
|
||||||
|
at the top right:
|
||||||
|
|
||||||
- Refresh: Reloads the panel to reflect changes to the images
|
- Refresh: Reloads the panel to reflect changes to the images.
|
||||||
- Run: Runs the test and shows the results
|
- Run: Runs the test and shows the results.
|
||||||
- Save: Runs the test with `--update` to save the reference image
|
- Save: Runs the test with `--update` to save the reference image.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
First, you need to build the extension:
|
In order for VS Code to run the extension with its built-in
|
||||||
|
[Node](https://nodejs.org) engine, you need to first build it from source.
|
||||||
|
Navigate to `test-helper` directory and build the extension:
|
||||||
```bash
|
```bash
|
||||||
npm i
|
npm install # Install the dependencies.
|
||||||
npm run build
|
npm run build # Build the extension from source.
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, you can easily install and (and keep it up-to-date) via VS Code's UI:
|
Then, you can easily install it (and keep it up-to-date) via VS Code's UI:
|
||||||
- Go to View > Command Palette or press Cmd/Ctrl+P,
|
- Go to View > Command Palette or press Cmd/Ctrl+P,
|
||||||
- In the drop down list, pick command "Developer: Install extension from
|
- In the drop down list, pick command "Developer: Install Extension from
|
||||||
location",
|
Location",
|
||||||
- Select this `test-helper` directory in the file explorer dialogue box. VS Code
|
- Select this `test-helper` directory in the file explorer dialogue box. VS Code
|
||||||
will add the extension's path to `~/.vscode/extensions/extensions.json`.
|
will add the extension's path to `~/.vscode/extensions/extensions.json` (or
|
||||||
|
`%USERPROFILE%\.vscode\extensions\extensions.json` on Windows).
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
"displayName": "Typst Test Helper",
|
"displayName": "Typst Test Helper",
|
||||||
"description": "Helps to run, compare and update Typst tests.",
|
"description": "Helps to run, compare and update Typst tests.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"engines": {
|
|
||||||
"vscode": "^1.71.0"
|
|
||||||
},
|
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
@ -97,8 +94,12 @@
|
|||||||
"watch": "tsc -watch -p ./"
|
"watch": "tsc -watch -p ./"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/vscode": "^1.88.0",
|
|
||||||
"@types/node": "18.x",
|
"@types/node": "18.x",
|
||||||
|
"@types/vscode": "^1.88.0",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.88.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user