Skip to content

Commit 845798a

Browse files
authored
remove spec from .mocharc.json (#978)
* remove spec from .mocharc.json * Update CONTRIBUTING.md
1 parent 664697f commit 845798a

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

.mocharc.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"require": ["module-alias/register.js"],
33
"loader": "./loader.js",
4-
"extensions": ["js", "ts"],
5-
"spec": [
6-
"test/**/*-test.*",
7-
"test/plot.js"
8-
],
9-
"watch-files": [
10-
"bundle.js",
11-
"test",
12-
"src"
13-
]
4+
"extensions": ["js", "ts"]
145
}

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ it("formatMonth(locale, format) does the right thing", () => {
5050

5151
Plot’s unit tests are written with [Mocha](https://mochajs.org).
5252

53+
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:
54+
55+
```bash
56+
yarn run mocha --conditions=mocha --parallel --watch test/marks/bar-test.js
57+
```
58+
5359
### Snapshot tests
5460

5561
Snapshot tests live in `test/plots` and are registered in [`test/plots/index.js`](./test/plots/index.js); see [`test/plots/aapl-bollinger.js`](./test/plots/aapl-bollinger.js) for example. Unlike unit tests which only test individual methods, snapshot tests actually visualize data—they’re more representative of how we expect people will use Plot. Snapshot tests can also serve as examples of how to use the Plot API, though note that some of the examples intentionally test edge case of the API and may not embody best practices. Each snapshot test defines a plot by exporting a default async function. For example, here’s a line chart using BLS unemployment data:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
],
2828
"scripts": {
2929
"test": "yarn test:typecheck && yarn test:lint && yarn test:mocha",
30-
"test:mocha": "mkdir -p test/output && mocha --conditions=mocha",
30+
"test:mocha": "mkdir -p test/output && mocha --conditions=mocha 'test/**/*-test.*' 'test/plot.js'",
3131
"test:lint": "eslint src test",
3232
"test:typecheck": "tsc --noEmit",
3333
"prepublishOnly": "rm -rf dist && rollup -c && tsc",

0 commit comments

Comments
 (0)