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
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+50-10Lines changed: 50 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,7 @@ Include this badge in your readme if you make a new module that implements inter
52
52
## Install
53
53
54
54
In JavaScript land:
55
+
55
56
```js
56
57
npm install interface-ipfs-core
57
58
```
@@ -68,20 +69,59 @@ In Go land:
68
69
69
70
Install `interface-ipfs-core` as one of the dependencies of your project and as a test file. Then, using `mocha` (for Node.js) or a test runner with compatible API, do:
70
71
71
-
```
72
-
var test = require('interface-ipfs-core')
73
-
74
-
var common = {
75
-
setup: function (cb) {
76
-
cb(null, IPFSFactory)
72
+
```js
73
+
consttests=require('interface-ipfs-core')
74
+
75
+
// Create common setup and teardown
76
+
constcreateCommon= () => ({
77
+
// Do some setup common to all tests
78
+
setup (cb) {
79
+
// Must call back with an "IPFS factory", an object with a `spawnNode` method
80
+
cb(null, {
81
+
// Use ipfsd-ctl or other to spawn an IPFS node for testing
82
+
spawnNode (cb) { /* ... */ }
83
+
})
77
84
},
78
-
teardown: function (cb) {
85
+
// Dispose of nodes created by the IPFS factory and any other teardown
86
+
teardown (cb) {
79
87
cb()
80
88
}
81
-
}
89
+
})
90
+
91
+
tests.block(createCommon)
92
+
tests.config(createCommon)
93
+
tests.dag(createCommon)
94
+
// ...etc. (see js/src/index.js)
95
+
```
96
+
97
+
#### Running tests by command
98
+
99
+
```js
100
+
tests.repo.version(createCommon)
101
+
```
102
+
103
+
#### Skipping tests
104
+
105
+
```js
106
+
tests.repo.version(createCommon)
107
+
tests.repo.stat(createCommon)
108
+
tests.repo.gc(createCommon, { skip:true }) // pass an options object to skip these tests
109
+
110
+
// OR, at the subsystem level
111
+
112
+
tests.repo(createCommon, { skip: ['gc'] })
113
+
```
114
+
115
+
#### Running only some tests
116
+
117
+
```js
118
+
tests.repo.version(createCommon)
119
+
tests.repo.stat(createCommon)
120
+
tests.repo.gc(createCommon, { only:true }) // pass an options object to run only these tests
0 commit comments