Skip to content

Commit 754a7b9

Browse files
committed
chore: add ts tests
1 parent ab0f087 commit 754a7b9

File tree

6 files changed

+336
-87
lines changed

6 files changed

+336
-87
lines changed

.github/workflows/examples.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: examples
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- run: npm install
16+
- run: npx aegir lint
17+
- run: npx aegir ts -p check
18+
- run: npx aegir build
19+
test-auto-relay-example:
20+
needs: check
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- run: npm install
25+
- run: cd examples && yarn && npm run test -- auto-relay
26+
test-chat-example:
27+
needs: check
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- run: npm install
32+
- run: cd examples && yarn && npm run test -- chat
33+
test-connection-encryption-example:
34+
needs: check
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- run: npm install
39+
- run: cd examples && yarn && npm run test -- connection-encryption
40+
test-discovery-mechanisms-example:
41+
needs: check
42+
runs-on: macos-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- run: npm install
46+
- run: cd examples && yarn && npm run test -- discovery-mechanisms
47+
test-echo-example:
48+
needs: check
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- run: npm install
53+
- run: cd examples && yarn && npm run test -- echo
54+
test-libp2p-in-the-browser-example:
55+
needs: check
56+
runs-on: macos-latest
57+
steps:
58+
- uses: actions/checkout@v2
59+
- run: npm install
60+
- run: cd examples && yarn && npm run test -- libp2p-in-the-browser
61+
test-peer-and-content-routing-example:
62+
needs: check
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v2
66+
- run: npm install
67+
- run: cd examples && yarn && npm run test -- peer-and-content-routing
68+
test-pnet-example:
69+
needs: check
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v2
73+
- run: npm install
74+
- run: cd examples && yarn && npm run test -- pnet
75+
test-protocol-and-stream-muxing-example:
76+
needs: check
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
- run: npm install
81+
- run: cd examples && yarn && npm run test -- protocol-and-stream-muxing
82+
test-pubsub-example:
83+
needs: check
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v2
87+
- run: npm install
88+
- run: cd examples && yarn && npm run test -- pubsub
89+
test-transports-example:
90+
needs: check
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v2
94+
- run: npm install
95+
- run: cd examples && yarn && npm run test -- transports
96+
test-webrtc-direct-example:
97+
needs: check
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v2
101+
- run: npm install
102+
- run: cd examples && yarn && npm run test -- webrtc-direct

.github/workflows/main.yml

+8-85
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- run: npm install
16-
- run: npm run lint
17-
- uses: gozala/[email protected]
18-
- run: npm run build
19-
- run: yarn aegir dep-check
16+
- run: npx aegir lint
17+
- run: npx aegir ts -p check
18+
- run: npx aegir build
19+
- run: npx aegir dep-check
2020
- uses: ipfs/aegir/actions/bundle-size@master
2121
name: size
2222
with:
@@ -51,94 +51,17 @@ jobs:
5151
- uses: actions/checkout@v2
5252
- run: npm install
5353
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
54-
test-interop:
55-
needs: check
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@v2
59-
- run: npm install
60-
- run: cd node_modules/interop-libp2p && yarn && LIBP2P_JS=${GITHUB_WORKSPACE}/src/index.js npx aegir test -t node --bail
61-
test-auto-relay-example:
54+
test-ts:
6255
needs: check
6356
runs-on: ubuntu-latest
6457
steps:
6558
- uses: actions/checkout@v2
6659
- run: npm install
67-
- run: cd examples && yarn && npm run test -- auto-relay
68-
test-chat-example:
69-
needs: check
70-
runs-on: ubuntu-latest
71-
steps:
72-
- uses: actions/checkout@v2
73-
- run: npm install
74-
- run: cd examples && yarn && npm run test -- chat
75-
test-connection-encryption-example:
76-
needs: check
77-
runs-on: ubuntu-latest
78-
steps:
79-
- uses: actions/checkout@v2
80-
- run: npm install
81-
- run: cd examples && yarn && npm run test -- connection-encryption
82-
test-discovery-mechanisms-example:
83-
needs: check
84-
runs-on: macos-latest
85-
steps:
86-
- uses: actions/checkout@v2
87-
- run: npm install
88-
- run: cd examples && yarn && npm run test -- discovery-mechanisms
89-
test-echo-example:
90-
needs: check
91-
runs-on: ubuntu-latest
92-
steps:
93-
- uses: actions/checkout@v2
94-
- run: npm install
95-
- run: cd examples && yarn && npm run test -- echo
96-
test-libp2p-in-the-browser-example:
97-
needs: check
98-
runs-on: macos-latest
99-
steps:
100-
- uses: actions/checkout@v2
101-
- run: npm install
102-
- run: cd examples && yarn && npm run test -- libp2p-in-the-browser
103-
test-peer-and-content-routing-example:
104-
needs: check
105-
runs-on: ubuntu-latest
106-
steps:
107-
- uses: actions/checkout@v2
108-
- run: npm install
109-
- run: cd examples && yarn && npm run test -- peer-and-content-routing
110-
test-pnet-example:
111-
needs: check
112-
runs-on: ubuntu-latest
113-
steps:
114-
- uses: actions/checkout@v2
115-
- run: npm install
116-
- run: cd examples && yarn && npm run test -- pnet
117-
test-protocol-and-stream-muxing-example:
118-
needs: check
119-
runs-on: ubuntu-latest
120-
steps:
121-
- uses: actions/checkout@v2
122-
- run: npm install
123-
- run: cd examples && yarn && npm run test -- protocol-and-stream-muxing
124-
test-pubsub-example:
125-
needs: check
126-
runs-on: ubuntu-latest
127-
steps:
128-
- uses: actions/checkout@v2
129-
- run: npm install
130-
- run: cd examples && yarn && npm run test -- pubsub
131-
test-transports-example:
132-
needs: check
133-
runs-on: ubuntu-latest
134-
steps:
135-
- uses: actions/checkout@v2
136-
- run: npm install
137-
- run: cd examples && yarn && npm run test -- transports
138-
test-webrtc-direct-example:
60+
- run: npx aegir test:ts
61+
test-interop:
13962
needs: check
14063
runs-on: ubuntu-latest
14164
steps:
14265
- uses: actions/checkout@v2
14366
- run: npm install
144-
- run: cd examples && yarn && npm run test -- webrtc-direct
67+
- run: cd node_modules/interop-libp2p && yarn && LIBP2P_JS=${GITHUB_WORKSPACE}/src/index.js npx aegir test -t node --bail

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"prepare": "aegir build --no-bundle",
2222
"lint": "aegir lint",
2323
"build": "aegir build",
24-
"test": "npm run test:node && npm run test:browser",
24+
"test": "aegir test",
25+
"test:ts": "aegir build --no-bundle && npm run test --prefix test/ts-use",
2526
"test:node": "aegir test -t node -f \"./test/**/*.{node,spec}.js\"",
2627
"test:browser": "aegir test -t browser",
2728
"test:examples": "cd examples && npm run test:all",
@@ -57,7 +58,8 @@
5758
"eslintConfig": {
5859
"extends": "ipfs",
5960
"ignorePatterns": [
60-
"!.aegir.js"
61+
"!.aegir.js",
62+
"test/ts-use"
6163
]
6264
},
6365
"dependencies": {

test/ts-use/package.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ts-use",
3+
"private": true,
4+
"dependencies": {
5+
"datastore-level": "^4.0.0",
6+
"ipfs-http-client": "^49.0.4",
7+
"libp2p": "file:../..",
8+
"libp2p-bootstrap": "^0.12.2",
9+
"libp2p-delegated-content-routing": "^0.9.0",
10+
"libp2p-delegated-peer-routing": "^0.8.2",
11+
"libp2p-gossipsub": "^0.8.0",
12+
"libp2p-interfaces": "^0.8.4",
13+
"libp2p-kad-dht": "^0.21.0",
14+
"libp2p-mplex": "^0.10.2",
15+
"libp2p-noise": "^2.0.5",
16+
"libp2p-tcp": "^0.15.3",
17+
"libp2p-websockets": "^0.15.3",
18+
"peer-id": "^0.14.3"
19+
},
20+
"scripts": {
21+
"build": "npx tsc",
22+
"test": "npm install && npx -p typescript tsc --noEmit"
23+
}
24+
}

0 commit comments

Comments
 (0)