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
* adopt vitest; substitute images if they approximately match the expected images
* yarn deduplicate
* avoid toMatchFileSnapshot, for now
* fix test workflow
* simplify setup; jsdom
* jsdom 29
* upgrade actions
* more explicit context.dispatchValue test
* move fast check into function
* simplify withImages
* declare tests in (test) source
* regenerate snapshot for node 24
* don’t need alias
* vitest --typecheck
* switch to pnpm
* regenerate snapshots
* add missing d3-format dependency
* pnpm/action-setup@v5
* explicitly declare tests
* turn off isolation for fast tests
* write -changed files
---------
Co-authored-by: Mike Bostock <mbostock@gmail.com>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ We request that you abide by our [code of conduct](https://observablehq.com/@obs
9
9
To contribute to Observable Plot, you’ll need a local development environment to make and test changes to Plot’s source code. To get started, follow GitHub’s tutorial on [forking (and cloning) a repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). Once you’ve cloned your fork of the Plot repository, open a terminal and `cd` in your forked repository. Then run Yarn to install dependencies:
10
10
11
11
```bash
12
-
yarn
12
+
pnpm install
13
13
```
14
14
15
15
You may encounter an error installing [node-canvas](https://github.com/Automattic/node-canvas), such as:
After making changes to Plot’s source code, run Plot’s test suite to verify that your code is doing what you expect and that you haven’t introduced any other unexpected changes in behavior. Plot has two types of tests: **unit tests** and **snapshot tests**. Tests are run automatically on pull requests (via GitHub Actions), but you’ll want to run them locally to verify your changes before opening a pull request. To run the tests, use Yarn:
31
+
After making changes to Plot’s source code, run Plot’s test suite to verify that your code is doing what you expect and that you haven’t introduced any other unexpected changes in behavior. Plot has two types of tests: **unit tests** and **snapshot tests**. Tests are run automatically on pull requests (via GitHub Actions), but you’ll want to run them locally to verify your changes before opening a pull request. To run the tests:
32
32
33
33
```bash
34
-
yarntest
34
+
pnpm runtest
35
35
```
36
36
37
37
This will also run ESLint on Plot’s source to help catch simple mistakes, such as unused imports.
38
38
39
39
Please run Prettier before submitting any pull request. Check “format on save” in your code editor, or run:
40
40
41
41
```bash
42
-
yarn prettier --write .
42
+
pnpm exec prettier --write .
43
43
```
44
44
45
45
A test coverage report can be generated with [c8](https://github.com/bcoe/c8), in text and lcov formats, to help you identify which lines of code are not (yet!) covered by tests. Just run:
46
46
47
47
```bash
48
-
yarn test:coverage
48
+
pnpm run test:coverage
49
49
```
50
50
51
51
### Unit tests
@@ -65,7 +65,7 @@ Plot’s unit tests are written with [Mocha](https://mochajs.org).
65
65
If you like, you can also run Mocha in watch mode for a specific file, so that unit tests re-run automatically when you make changes. For example:
66
66
67
67
```bash
68
-
yarn run mocha --conditions=mocha --parallel --watch test/marks/bar-test.js
68
+
pnpm run test:vitest test/marks/bar-test.js
69
69
```
70
70
71
71
### Snapshot tests
@@ -98,7 +98,7 @@ export * from "./moby-dick.ts";
98
98
The best thing about snapshot tests is that you can see the live result in your browser as you make changes to Plot’s source code! This lets you immediately assess visually what Plot is doing. To preview snapshot tests during development, Plot uses [Vite](https://vitejs.dev). To start Vite:
99
99
100
100
```bash
101
-
yarn dev
101
+
pnpm run dev
102
102
```
103
103
104
104
This will open http://localhost:8008/ in your browser where you can choose a snapshot test. As you edit the source, the current test will update live in your browser as you save changes. You can change the selected test from the drop-down menu. When the drop-down menu is focused, the left and right arrow keys cycle between tests.
@@ -111,17 +111,17 @@ Running Plot’s snapshot tests will automatically generate any missing snapshot
111
111
112
112
```
113
113
rm -rf test/output
114
-
yarn test
114
+
pnpm run test:vitest
115
115
```
116
116
117
117
## Documentation
118
118
119
119
When submitting a pull request, please remember to update Plot’s documentation to reflect changes to the public API. You are also welcome to edit Plot’s [CHANGELOG.md](./CHANGELOG.md) to assist with writing future release notes. In addition, please reference any related [issues](https://github.com/observablehq/plot/issues) (or discussions) in your pull request description.
120
120
121
-
If you’d like to share a live demonstration or motivating example of your change to Plot, you can regenerate Plot’s release bundle using Yarn:
121
+
If you’d like to share a live demonstration or motivating example of your change to Plot, you can regenerate Plot’s release bundle like so:
122
122
123
123
```bash
124
-
yarn prepublishOnly
124
+
pnpm run prepublishOnly
125
125
```
126
126
127
127
The generated bundle `dist/plot.umd.js` can then be loaded like so:
0 commit comments