Skip to content

Commit e9bb27f

Browse files
committed
feat: add nodes from NODE_VER
1 parent 6975cda commit e9bb27f

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internals.detectFromTravisYaml = (travisYaml) => {
2121

2222
for (const env of travisYaml.env.matrix) {
2323

24-
const matches = env.match(/(?:NODEJS_VER|TRAVIS_NODE_VERSION)="?(node\/)?(?<version>[\w./*]+)"?/); /* hack syntax highlighter 🤦‍♂️ */
24+
const matches = env.match(/(?:NODEJS_VER|TRAVIS_NODE_VERSION|NODE_VER)="?(node\/)?(?<version>[\w./*]+)"?/); /* hack syntax highlighter 🤦‍♂️ */
2525

2626
raw.add(matches.groups.version);
2727
}

test/fixtures/reactivex-rxjs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Source: https://github.com/ReactiveX/rxjs/blob/ef88ded3d671f48466ea3a42f9a2af656bd51d36/.travis.yml
2+
3+
language: node_js
4+
sudo: false
5+
6+
addons:
7+
sauce_connect:
8+
# Update SAUCE_USERNAME / SAUCE_ACCESS_KEY in travis if necessary
9+
# https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
10+
sauce_connect: true
11+
12+
cache:
13+
directories:
14+
- node_modules
15+
16+
env:
17+
matrix:
18+
- NODE_VER=4 FULL_VALIDATE=false
19+
- NODE_VER=6 FULL_VALIDATE=true alias grunt=./node_modules/grunt-cli/bin/grunt
20+
- NODE_VER=7 FULL_VALIDATE=false
21+
matrix:
22+
fast_finish: true
23+
24+
before_install:
25+
- nvm install $NODE_VER
26+
- npm install -g npm@4 && npm install -g npx && node -v && npm -v
27+
- if [ "$FULL_VALIDATE" == "true" ]; then npm install [email protected] grunt-cli grunt-contrib-connect grunt-run; fi
28+
29+
install:
30+
- npm install
31+
- if [ "$FULL_VALIDATE" == "true" ]; then npm run lint && npm run check_circular_dependencies; fi
32+
33+
script:
34+
- if [ "$FULL_VALIDATE" == "true" ] && [ -n "DANGER_GITHUB_API_TOKEN" ]; then echo {} > ./.babelrc && npx danger; fi
35+
- npm run build_spec && npm run test_mocha && node ./node_modules/markdown-doctest/bin/cmd.js
36+
37+
after_success:
38+
- if [ "$FULL_VALIDATE" == "true" ]; then npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js; fi
39+
- if [ "$FULL_VALIDATE" == "true" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ -n "$SAUCE_ACCESS_KEY" ]; then npm run build_spec_browser && grunt --gruntfile spec/support/mocha.sauce.gruntfile.js; fi

test/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('node-support', () => {
4848

4949
describe('path', () => {
5050

51-
it('returns node versions from iamitcs-nodejs-nan.yml at the path', async () => {
51+
it('returns node versions from .travis.yml at the path', async () => {
5252

5353
const path = Path.join(__dirname, '..');
5454

@@ -107,6 +107,21 @@ describe('node-support', () => {
107107
}
108108
});
109109
});
110+
111+
it('returns node versions from matrix env vars (NODE_VER)', async () => {
112+
113+
const path = internals.prepareFixture('reactivex-rxjs.yml');
114+
115+
const result = await NodeSupport.detect({ path });
116+
117+
expect(result).to.equal({
118+
name: 'test-module',
119+
version: '0.0.0-development',
120+
travis: {
121+
raw: ['4', '6', '7']
122+
}
123+
});
124+
});
110125
});
111126
});
112127
});

0 commit comments

Comments
 (0)