|
6 | 6 | - [Build a dist version](#build-a-dist-version)
|
7 | 7 | - [Publishing new versions](#publishing-new-versions)
|
8 | 8 | - [Using prerelease versions](#using-prerelease-versions)
|
| 9 | +- [Testing strategy](#testing-strategy) |
| 10 | + - [CLI](#cli) |
| 11 | + - [HTTP API](#http-api) |
| 12 | + - [Core](#core) |
| 13 | + - [Non-Core](#non-core) |
9 | 14 |
|
10 | 15 | ## Clone and install dependencies
|
11 | 16 |
|
@@ -64,3 +69,37 @@ Please run the linter before submitting a PR, the build will not pass if it fail
|
64 | 69 | ## Using prerelease versions
|
65 | 70 |
|
66 | 71 | Any changed packages from each successful build of master are published to npm as canary builds under the npm tag `next`.
|
| 72 | + |
| 73 | +## Testing strategy |
| 74 | + |
| 75 | +This project has a number of components that have their own tests, then some components that share interface tests. |
| 76 | + |
| 77 | +When adding new features you may need to add tests to one or more of the test suites described below. |
| 78 | + |
| 79 | +### CLI |
| 80 | + |
| 81 | +Tests live in [/packages/ipfs/test/cli](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test/cli). |
| 82 | + |
| 83 | +All interactions with IPFS core are stubbed so we just ensure that the correct arguments are passed in |
| 84 | + |
| 85 | +### HTTP API |
| 86 | + |
| 87 | +Tests live in [/packages/ipfs/test/http-api](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test/http-api) and are similar to the CLI tests in that we stub out core interactions and inject requests with [shot](https://www.npmjs.com/package/@hapi/shot). |
| 88 | + |
| 89 | +### Core |
| 90 | + |
| 91 | +Anything non-implementation specific should be considered part of the 'Core API'. For example node setup code is not Core, but anything that does useful work, e.g. network/repo/etc interactions would be Core. |
| 92 | + |
| 93 | +All Core APIs should be documented in [/docs/core-api](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api). |
| 94 | + |
| 95 | +All Core APIs should have comprehensive tests in [/packages/interface-ipfs-core](https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core). |
| 96 | + |
| 97 | +`interface-ipfs-core` should ensure API compatibility across implementations. Tests are run: |
| 98 | + |
| 99 | +1. Against [/packages/ipfs/src/core](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core) directly |
| 100 | +1. Against [/packages/ipfs/src/http](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/http) over HTTP via `ipfs-http-client` |
| 101 | +1. Against `go-ipfs` over HTTP via `ipfs-http-client` |
| 102 | + |
| 103 | +### Non-Core |
| 104 | + |
| 105 | +Any non-core API functionality should have tests in the `tests` directory of the module in question, for example: [/packages/ipfs-http-api/tests](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client/test) and [/packages/ipfs/tests](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test) for `ipfs-http-client` and `ipfs` respectively. |
0 commit comments