forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension-version.functional.test.ts
More file actions
67 lines (56 loc) · 2.46 KB
/
extension-version.functional.test.ts
File metadata and controls
67 lines (56 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { expect } from 'chai';
import * as fs from 'fs';
import * as glob from 'glob';
import * as path from 'path';
import { ApplicationEnvironment } from '../client/common/application/applicationEnvironment';
import { IApplicationEnvironment } from '../client/common/application/types';
import { EXTENSION_ROOT_DIR } from '../client/common/constants';
suite('Extension version tests', () => {
let version: string;
let applicationEnvironment: IApplicationEnvironment;
const branchName = process.env.CI_BRANCH_NAME;
suiteSetup(async function () {
// Skip the entire suite if running locally
if (!branchName) {
return this.skip();
}
});
setup(() => {
applicationEnvironment = new ApplicationEnvironment(undefined as any, undefined as any, undefined as any);
version = applicationEnvironment.packageJson.version;
});
test('If we are running a pipeline in the main branch, the extension version in `package.json` should have the "-dev" suffix', async function () {
if (branchName !== 'main') {
return this.skip();
}
return expect(
version.endsWith('-dev'),
'When running a pipeline in the main branch, the extension version in package.json should have the -dev suffix',
).to.be.true;
});
test('If we are running a pipeline in the release branch, the extension version in `package.json` should not have the "-dev" suffix', async function () {
if (!branchName!.startsWith('release')) {
return this.skip();
}
return expect(
version.endsWith('-dev'),
'When running a pipeline in the release branch, the extension version in package.json should not have the -dev suffix',
).to.be.false;
});
});
suite('Extension localization files', () => {
test('Load localization file', () => {
const filesFailed: string[] = [];
glob.sync('package.nls.*.json', { sync: true, cwd: EXTENSION_ROOT_DIR }).forEach((localizationFile) => {
try {
JSON.parse(fs.readFileSync(path.join(EXTENSION_ROOT_DIR, localizationFile)).toString());
} catch {
filesFailed.push(localizationFile);
}
});
expect(filesFailed).to.be.lengthOf(0, `Failed to load JSON for ${filesFailed.join(', ')}`);
});
});