Skip to content

Commit 21dc1aa

Browse files
committed
feat: detect from matrix include
1 parent 6c8f8a6 commit 21dc1aa

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

lib/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ internals.detectFromTravisYaml = (travisYaml) => {
2727
}
2828
}
2929

30+
if (travisYaml.matrix && travisYaml.matrix.include) {
31+
32+
for (const include of travisYaml.matrix.include) {
33+
34+
raw.add(include.node_js);
35+
}
36+
}
37+
3038
if (!raw.size) {
3139
raw.add('latest');
3240
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: node_js
2+
notifications:
3+
email: false
4+
matrix:
5+
fast_finish: true
6+
include:
7+
- node_js: 6
8+
env: CMD=test
9+
- node_js: 8
10+
env: CMD=test
11+
- node_js: 9
12+
env: CMD=test
13+
- node_js: 10
14+
env: CMD=test
15+
- node_js: 12
16+
env: CMD=test
17+
- node_js: stable
18+
env: CMD=test-browsers
19+
addons:
20+
sauce_connect: true
21+
hosts:
22+
- airtap.local
23+
script: npm run $CMD

test/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ describe('node-support', () => {
9292
});
9393
});
9494

95-
9695
it('returns default node version', async () => {
9796

9897
const path = internals.prepareFixture('_minimal.yml');
@@ -153,6 +152,21 @@ describe('node-support', () => {
153152
});
154153
});
155154

155+
it('returns node versions from matrix include', async () => {
156+
157+
const path = internals.prepareFixture('nodejs-readable-stream.yml');
158+
159+
const result = await NodeSupport.detect({ path });
160+
161+
expect(result).to.equal({
162+
name: 'test-module',
163+
version: '0.0.0-development',
164+
travis: {
165+
raw: ['6', '8', '9', '10', '12', 'stable']
166+
}
167+
});
168+
});
169+
156170
it('handles missing env.matrix', async () => {
157171

158172
const path = internals.prepareFixture('_no-env-matrix.yml');

0 commit comments

Comments
 (0)