Skip to content
This repository was archived by the owner on Mar 13, 2021. It is now read-only.

Commit 987d189

Browse files
committedApr 17, 2018
Add tests to enforce version sameness
The following files should always contain the same version number: - package.json - package-lock.json - node-invoker.yaml In addition, these versions should match the tag (when tagged). Fixes #53
1 parent 919d131 commit 987d189

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed
 

‎package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"eslint": "^4.17.0",
2323
"eslint-plugin-jasmine": "^2.9.2",
2424
"jasmine": "^3.1.0",
25+
"js-yaml": "^3.11.0",
2526
"supertest": "^3.0.0",
2627
"wait-for-port": "0.0.2"
2728
}

‎spec/version.spec.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const fs = require('fs');
18+
const path = require('path');
19+
const yaml = require('js-yaml');
20+
21+
fdescribe('version', () => {
22+
23+
const { version } = require('../package.json');
24+
25+
it('matches the package lock version', async () => {
26+
const packageLock = require('../package-lock.json');
27+
expect(packageLock.version).toBe(version);
28+
});
29+
30+
it('matches the invoker.yaml version', async () => {
31+
const filepath = path.resolve(__dirname, '..', 'node-invoker.yaml');
32+
const invokerResource = yaml.safeLoad(fs.readFileSync(filepath, 'utf8'));
33+
expect(invokerResource.spec.version).toBe(version);
34+
});
35+
36+
if (process.env.TRAVIS_TAG) {
37+
it('matches the tag name', () => {
38+
expect(process.env.TRAVIS_TAG).toBe(`v${version}`);
39+
});
40+
}
41+
42+
});

0 commit comments

Comments
 (0)
This repository has been archived.