Skip to content

Commit

Permalink
Add integration-test code coverage (microsoft#10632)
Browse files Browse the repository at this point in the history
* wip

* Update to latest vscodetestcover and add tests back in

* Update to latest version of vscodetestcover

* updates

* another yarn.lock

* update version

* Revert import path change
  • Loading branch information
Charles-Gagnon authored Jun 1, 2020
1 parent f2c3320 commit 7305bda
Show file tree
Hide file tree
Showing 38 changed files with 960 additions and 1,796 deletions.
2 changes: 1 addition & 1 deletion extensions/admin-tool-ext-win/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"should": "^13.2.3",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.6"
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8"
},
"__metadata": {
"id": "41",
Expand Down
6 changes: 3 additions & 3 deletions extensions/admin-tool-ext-win/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,9 @@ vscode-nls@^3.2.1:
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.5.tgz#25520c1955108036dec607c85e00a522f247f1a4"
integrity sha512-ITtoh3V4AkWXMmp3TB97vsMaHRgHhsSFPsUdzlueSL+dRZbSNTZeOmdQv60kjCV306ghPxhDeoNUEm3+EZMuyw==

"vscodetestcover@github:corivera/vscodetestcover#1.0.6":
version "1.0.5"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/14e0f2c46346b31bc1af2c590febeaf69a9112eb"
"vscodetestcover@github:corivera/vscodetestcover#1.0.8":
version "1.0.8"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/4331080eed9d2713807e9a3f47610947d5b0a1d7"
dependencies:
decache "^4.4.0"
glob "^7.1.2"
Expand Down
2 changes: 1 addition & 1 deletion extensions/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"mocha-multi-reporters": "^1.1.7",
"should": "^13.2.1",
"typemoq": "^2.1.0",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.6"
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8"
},
"__metadata": {
"id": "10",
Expand Down
6 changes: 3 additions & 3 deletions extensions/agent/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,9 @@ vscode-nls@^3.2.1:
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.5.tgz#25520c1955108036dec607c85e00a522f247f1a4"
integrity sha512-ITtoh3V4AkWXMmp3TB97vsMaHRgHhsSFPsUdzlueSL+dRZbSNTZeOmdQv60kjCV306ghPxhDeoNUEm3+EZMuyw==

"vscodetestcover@github:corivera/vscodetestcover#1.0.6":
version "1.0.5"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/14e0f2c46346b31bc1af2c590febeaf69a9112eb"
"vscodetestcover@github:corivera/vscodetestcover#1.0.8":
version "1.0.8"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/4331080eed9d2713807e9a3f47610947d5b0a1d7"
dependencies:
decache "^4.4.0"
glob "^7.1.2"
Expand Down
2 changes: 1 addition & 1 deletion extensions/azurecore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,6 @@
"mocha-multi-reporters": "^1.1.7",
"should": "^13.2.1",
"typemoq": "^2.1.0",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.6"
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8"
}
}
6 changes: 3 additions & 3 deletions extensions/azurecore/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,9 @@ vscode-nls@^4.0.0:
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==

"vscodetestcover@github:corivera/vscodetestcover#1.0.6":
version "1.0.5"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/14e0f2c46346b31bc1af2c590febeaf69a9112eb"
"vscodetestcover@github:corivera/vscodetestcover#1.0.8":
version "1.0.8"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/4331080eed9d2713807e9a3f47610947d5b0a1d7"
dependencies:
decache "^4.4.0"
glob "^7.1.2"
Expand Down
2 changes: 1 addition & 1 deletion extensions/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
"mocha-multi-reporters": "^1.1.7",
"mocha": "^5.2.0",
"should": "^13.2.1",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.6",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8",
"typemoq": "^2.1.0"
},
"__metadata": {
Expand Down
6 changes: 3 additions & 3 deletions extensions/cms/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,9 @@ vscode-nls@^4.0.0:
resolved "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==

"vscodetestcover@github:corivera/vscodetestcover#1.0.6":
version "1.0.5"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/14e0f2c46346b31bc1af2c590febeaf69a9112eb"
"vscodetestcover@github:corivera/vscodetestcover#1.0.8":
version "1.0.8"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/4331080eed9d2713807e9a3f47610947d5b0a1d7"
dependencies:
decache "^4.4.0"
glob "^7.1.2"
Expand Down
2 changes: 1 addition & 1 deletion extensions/dacpac/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"should": "^13.2.1",
"vscodetestcover": "github:corivera/vscodetestcover#1.0.6"
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8"
},
"__metadata": {
"id": "33",
Expand Down
6 changes: 3 additions & 3 deletions extensions/dacpac/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,9 @@ vscode-nls@^4.0.0:
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==

"vscodetestcover@github:corivera/vscodetestcover#1.0.6":
version "1.0.5"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/14e0f2c46346b31bc1af2c590febeaf69a9112eb"
"vscodetestcover@github:corivera/vscodetestcover#1.0.8":
version "1.0.8"
resolved "https://codeload.github.com/corivera/vscodetestcover/tar.gz/4331080eed9d2713807e9a3f47610947d5b0a1d7"
dependencies:
decache "^4.4.0"
glob "^7.1.2"
Expand Down
21 changes: 21 additions & 0 deletions extensions/integration-tests/coverConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"enabled": true,
"relativeSourcePath": "../../../",
"relativeCoverageDir": "../../coverage",
"ignorePatterns": [
"**/coverage/**",
"**/generated/**",
"**/node_modules/**",
"**/test/**"
],
"includePid": false,
"reports": [
"cobertura",
"lcov"
],
"verbose": false,
"remapOptions": {
"basePath": "../../../",
"useAbsolutePaths": true
}
}
5 changes: 2 additions & 3 deletions extensions/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"Microsoft.azuredatastudio-postgresql"
],
"scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json",
"postinstall": "node ./node_modules/vscode/bin/install"
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json"
},
"devDependencies": {
"@types/chai": "3.4.34",
Expand All @@ -33,6 +32,6 @@
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"ms-rest-azure": "^2.6.0",
"vscode": "1.1.5"
"vscodetestcover": "github:corivera/vscodetestcover#1.0.8"
}
}
48 changes: 48 additions & 0 deletions extensions/integration-tests/src/test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as testRunner from 'vscodetestcover';

const suite = 'Extension Integration Tests';

const mochaOptions: any = {
ui: 'tdd',
useColors: true,
timeout: 60000
};

// set relevant mocha options from the environment
if (process.env.ADS_TEST_GREP) {
mochaOptions.grep = process.env.ADS_TEST_GREP;
console.log(`setting options.grep to: ${mochaOptions.grep}`);
}
if (process.env.ADS_TEST_INVERT_GREP) {
mochaOptions.invert = parseInt(process.env.ADS_TEST_INVERT_GREP);
console.log(`setting options.invert to: ${mochaOptions.invert}`);
}
if (process.env.ADS_TEST_TIMEOUT) {
mochaOptions.timeout = parseInt(process.env.ADS_TEST_TIMEOUT);
console.log(`setting options.timeout to: ${mochaOptions.timeout}`);
}
if (process.env.ADS_TEST_RETRIES) {
mochaOptions.retries = parseInt(process.env.ADS_TEST_RETRIES);
console.log(`setting options.retries to: ${mochaOptions.retries}`);
}

if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
mochaOptions.reporter = 'mocha-multi-reporters';
mochaOptions.reporterOptions = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
testsuitesTitle: `${suite} ${process.platform}`,
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
}
};
}

testRunner.configure(mochaOptions, { coverConfig: '../../coverConfig.json' });

export = testRunner;
50 changes: 0 additions & 50 deletions extensions/integration-tests/src/tests/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions extensions/integration-tests/src/typings/ref.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/// <reference path='../../../../src/sql/azdata.d.ts'/>
/// <reference path='../../../../src/sql/azdata.proposed.d.ts'/>
/// <reference path='../../../../src/sql/azdata.test.d.ts'/>
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference types='@types/node'/>
Loading

0 comments on commit 7305bda

Please sign in to comment.