Add pipeline args for testing (#7028)

* add pipeline args for testing

* fix test publish step

* simplify some testing code

* change coverage reporters

* fix coverage reports
This commit is contained in:
Anthony Dresser
2019-09-03 17:59:19 -07:00
committed by GitHub
parent c94291af52
commit b8518f5795
4 changed files with 23 additions and 36 deletions

View File

@@ -62,23 +62,25 @@ steps:
displayName: "Compile"
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
displayName: "Tests"
DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests"
displayName: Run Unit Tests
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter --coverage
DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests" --coverage
displayName: "Tests"
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
- task: PublishTestResults@2
displayName: Publish Tests Results
inputs:
testResultsFiles: "**/test-results.xml"
testResultsFiles: '*-results.xml'
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: "cobertura"
codeCoverageTool: 'cobertura'
summaryFileLocation: $(System.DefaultWorkingDirectory)/.build/coverage/cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/.build/coverage/lcov-reports
reportDirectory: $(System.DefaultWorkingDirectory)/.build/coverage/lcov-report
condition: ne(variables['Agent.OS'], 'Linux')

View File

@@ -49,17 +49,12 @@ steps:
yarn compile
displayName: "Compile"
- script: |
.\scripts\test.bat --reporter mocha-junit-reporter --coverage
displayName: "Test"
- powershell: |
.\scripts\test.bat --tfs "Unit Tests"
- task: PublishTestResults@2
displayName: Publish Tests Results
inputs:
testResultsFiles: "test-results.xml"
testResultsFiles: "*-results.xml"
searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: "cobertura"
summaryFileLocation: $(System.DefaultWorkingDirectory)\.build\coverage\cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)\.build\coverage\lcov-report

View File

@@ -12,15 +12,12 @@ const iLibSourceMaps = require('istanbul-lib-source-maps');
const iLibReport = require('istanbul-lib-report');
const iReports = require('istanbul-reports');
// {{SQL CARBON EDIT}}
var SQL_TEST_GLOB = '**/test/**/*.test.js|**/sqltest/**/*.test.jss';
const REPO_PATH = toUpperDriveLetter(path.join(__dirname, '..'));
exports.initialize = function (loaderConfig) {
const instrumenter = iLibInstrument.createInstrumenter();
loaderConfig.nodeInstrumenter = function (contents, source) {
if (minimatch(source, SQL_TEST_GLOB)) { // {{SQL CARBON EDIT}}
if (minimatch(source, '**/test/**/*.test.js')) {
// tests don't get instrumented
return contents;
}
@@ -45,10 +42,9 @@ exports.createReport = function (isSingle) {
Object.keys(transformed.map.data).forEach((file) => {
const entry = transformed.map.data[file];
const fixedPath = fixPath(entry.path);
if (!fixedPath.includes('\\vs\\') && !fixedPath.includes('/vs/')) {
entry.data.path = fixedPath;
newData[fixedPath] = entry;
}
if (fixedPath.includes('\\vs\\') || fixedPath.includes('/vs/')) { return; } // {{SQL CARBON EDIT}} skip vscode files
entry.data.path = fixedPath;
newData[fixedPath] = entry;
});
transformed.map.data = newData;
@@ -64,6 +60,7 @@ exports.createReport = function (isSingle) {
reports.push(iReports.create('json'));
reports.push(iReports.create('lcov'));
reports.push(iReports.create('html'));
reports.push(iReports.create('cobertura')); // {{SQL CARBON EDIT}} add covertura
}
reports.forEach(report => tree.visit(report, context));
};

View File

@@ -13,19 +13,14 @@ const util = require('util');
const bootstrap = require('../../src/bootstrap');
const coverage = require('../coverage');
// {{SQL CARBON EDIT}}
require('reflect-metadata');
require('reflect-metadata'); // {{SQL CARBON EDIT}}
// Disabled custom inspect. See #38847
if (util.inspect && util.inspect['defaultOptions']) {
util.inspect['defaultOptions'].customInspect = false;
}
// {{SQL CARBON EDIT}}
let _tests_glob = '**/*test*/**/*.test.js';
// {{SQL CARBON EDIT}}
let _sql_tests_glob = '**/sqltest/**/*.test.js';
let _tests_glob = '**/test/**/*.test.js';
let loader;
let _out;
@@ -40,16 +35,14 @@ function initLoader(opts) {
nodeMain: __filename,
catchError: true,
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../src')),
// {{SQL CARBON EDIT}}
paths: {
'vs': `../${outdir}/vs`,
'sqltest': `../${outdir}/sqltest`,
'sql': `../${outdir}/sql`,
'sqltest': `../${outdir}/sqltest`, // {{SQL CARBON EDIT}}
'sql': `../${outdir}/sql`, // {{SQL CARBON EDIT}}
'lib': `../${outdir}/lib`,
'bootstrap-fork': `../${outdir}/bootstrap-fork`
},
// {{SQL CARBON EDIT}}
nodeModules: [
nodeModules: [ // {{SQL CARBON EDIT}}
'@angular/common',
'@angular/core',
'@angular/forms',