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
* type=module; update dependencies
* remove cjs bundle
* add the *mode* aggregation (#463)
the plot example shows the most common word of length x as a title for each bar
closes#420
(cherry-pick of ea9f8cd)
* fix path to d3’s package.json
* remove erroneous hard wrap
Co-authored-by: Philippe Rivière <[email protected]>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7-28Lines changed: 7 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,7 @@ cd plot
10
10
yarn
11
11
```
12
12
13
-
Plot is written in ES modules and uses [Snowpack](https://snowpack.dev/) for
14
-
development; this means that you can edit the Plot source code and examples, and
15
-
they’ll update live as you save changes. To start Snowpack:
13
+
Plot is written in ES modules and uses [Snowpack](https://snowpack.dev/) for development; this means that you can edit the Plot source code and examples, and they’ll update live as you save changes. To start Snowpack:
16
14
17
15
```
18
16
yarn dev
@@ -24,15 +22,9 @@ This should open http://localhost:8008/ where you can browse the tests.
24
22
25
23
Plot has both unit tests and snapshot tests.
26
24
27
-
**Unit tests** live in `test` and have the `-test.js` extension. These tests are
28
-
written using [Tape](https://github.com/substack/tape) (more precisely,
29
-
[tape-await](https://github.com/mbostock/tape-await) for easier async testing).
30
-
Generally speaking, unit tests make specific assertions about the behavior of
31
-
Plot’s internals and helper methods.
25
+
**Unit tests** live in `test` and have the `-test.js` extension. These tests are written using [Mocha](https://mochajs.org). Generally speaking, unit tests make specific assertions about the behavior of Plot’s internals and helper methods.
32
26
33
-
**Snapshot tests** live in `test/plots`; these also serve as examples of how to
34
-
use the Plot API. Each snapshot test defines a plot by exporting a default async
35
-
function. For example, here’s a line chart using BLS unemployment data:
27
+
**Snapshot tests** live in `test/plots`; these also serve as examples of how to use the Plot API. Each snapshot test defines a plot by exporting a default async function. For example, here’s a line chart using BLS unemployment data:
When a snapshot test is run, its output is compared against the SVG snapshot
53
-
saved in the `test/output` folder. This makes it easier to see the effect of
54
-
code changes and to catch unintended changes.
44
+
When a snapshot test is run, its output is compared against the SVG snapshot saved in the `test/output` folder. This makes it easier to see the effect of code changes and to catch unintended changes.
55
45
56
-
To add a new snapshot test, create a new JavaScript file in the `test/plots`
57
-
folder. Then register your test in the test registry, `test/plots/index.js`.
58
-
Once you’ve registered your test, it will also appear automatically in the test
59
-
browser (http://localhost:8008), where you can inspect and debug the output.
60
-
(Snapshot tests must have deterministic, reproducible behavior; they should not
61
-
depend on live data, external servers, the current time, the weather, etc. To
62
-
use randomness in a test, use a seeded random number generator such as
To add a new snapshot test, create a new JavaScript file in the `test/plots` folder. Then register your test in the test registry, `test/plots/index.js`. Once you’ve registered your test, it will also appear automatically in the test browser (http://localhost:8008), where you can inspect and debug the output. (Snapshot tests must have deterministic, reproducible behavior; they should not depend on live data, external servers, the current time, the weather, etc. To use randomness in a test, use a seeded random number generator such as [d3.randomLcg](https://github.com/d3/d3-random/blob/master/README.md#randomLcg).)
64
47
65
48
To run the tests:
66
49
67
50
```
68
51
yarn test
69
52
```
70
53
71
-
This will automatically generate any missing snapshots in `test/output`, which
72
-
you should remember to `git add` before committing your changes. (If you forget,
73
-
your PR will fail in CI, and you’ll get a reminder.)
54
+
This will automatically generate any missing snapshots in `test/output`, which you should remember to `git add` before committing your changes. (If you forget, your PR will fail in CI, and you’ll get a reminder.)
74
55
75
-
If your code intentionally changes some of the existing snapshots, simply blow
76
-
away the existing snapshots and run the tests again. You can then review what’s
77
-
changed using `git diff`.
56
+
If your code intentionally changes some of the existing snapshots, simply blow away the existing snapshots and run the tests again. You can then review what’s changed using `git diff`.
0 commit comments