mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from master
This commit is contained in:
@@ -10,6 +10,7 @@ const path = require('path');
|
||||
const mocha = require('mocha');
|
||||
const events = require('events');
|
||||
const MochaJUnitReporter = require('mocha-junit-reporter');
|
||||
const url = require('url');
|
||||
|
||||
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
|
||||
|
||||
@@ -117,7 +118,7 @@ app.on('ready', () => {
|
||||
win.webContents.send('run', argv);
|
||||
});
|
||||
|
||||
win.loadURL(`file://${__dirname}/renderer.html`);
|
||||
win.loadURL(url.format({ pathname: path.join(__dirname, 'renderer.html'), protocol: 'file:', slashes: true }));
|
||||
|
||||
const runner = new IPCRunner();
|
||||
|
||||
|
||||
@@ -13,13 +13,21 @@ const minimatch = require('minimatch');
|
||||
const istanbul = require('istanbul');
|
||||
const i_remap = require('remap-istanbul/lib/remap');
|
||||
const util = require('util');
|
||||
const bootstrap = require('../../src/bootstrap');
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
require('reflect-metadata');
|
||||
|
||||
// Disabled custom inspect. See #38847
|
||||
if (util.inspect && util.inspect['defaultOptions']) {
|
||||
util.inspect['defaultOptions'].customInspect = false;
|
||||
}
|
||||
|
||||
let _tests_glob = '**/test/**/*.test.js';
|
||||
// {{SQL CARBON EDIT}}
|
||||
let _tests_glob = '**/*test*/**/*.test.js';
|
||||
// {{SQL CARBON EDIT}}
|
||||
let _sql_tests_glob = '**/sqltest/**/*.test.js';
|
||||
|
||||
let loader;
|
||||
let _out;
|
||||
|
||||
@@ -33,12 +41,31 @@ function initLoader(opts) {
|
||||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
catchError: true,
|
||||
baseUrl: path.join(__dirname, '../../src'),
|
||||
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../src')),
|
||||
// {{SQL CARBON EDIT}}
|
||||
paths: {
|
||||
'vs/css': '../test/css.mock',
|
||||
'vs': `../${outdir}/vs`,
|
||||
'sqltest': `../${outdir}/sqltest`,
|
||||
'sql': `../${outdir}/sql`,
|
||||
'lib': `../${outdir}/lib`,
|
||||
'bootstrap': `../${outdir}/bootstrap`
|
||||
}
|
||||
'bootstrap-fork': `../${outdir}/bootstrap-fork`
|
||||
},
|
||||
// {{SQL CARBON EDIT}}
|
||||
nodeModules: [
|
||||
'@angular/common',
|
||||
'@angular/core',
|
||||
'@angular/forms',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'angular2-grid',
|
||||
'ng2-charts/ng2-charts',
|
||||
'rxjs/add/observable/of',
|
||||
'rxjs/Observable',
|
||||
'rxjs/Subject',
|
||||
'rxjs/Observer'
|
||||
]
|
||||
};
|
||||
|
||||
// nodeInstrumenter when coverage is requested
|
||||
@@ -46,6 +73,11 @@ function initLoader(opts) {
|
||||
const instrumenter = new istanbul.Instrumenter();
|
||||
|
||||
loaderConfig.nodeInstrumenter = function (contents, source) {
|
||||
// {{SQL CARBON EDIT}}
|
||||
if (minimatch(source, _sql_tests_glob)) {
|
||||
return contents;
|
||||
}
|
||||
|
||||
return minimatch(source, _tests_glob)
|
||||
? contents // don't instrument tests itself
|
||||
: instrumenter.instrumentSync(contents, source);
|
||||
@@ -92,7 +124,10 @@ function createCoverageReport(opts) {
|
||||
for (const entryKey in remappedCoverage) {
|
||||
const entry = remappedCoverage[entryKey];
|
||||
entry.path = fixPath(entry.path);
|
||||
finalCoverage[fixPath(entryKey)] = entry;
|
||||
// {{SQL CARBON EDIT}}
|
||||
if (!entry.path.includes('\\vs\\') && !entry.path.includes('/vs/')) {
|
||||
finalCoverage[fixPath(entryKey)] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
const collector = new istanbul.Collector();
|
||||
@@ -105,7 +140,8 @@ function createCoverageReport(opts) {
|
||||
coveragePath += '-single';
|
||||
reportTypes = ['lcovonly'];
|
||||
} else {
|
||||
reportTypes = ['json', 'lcov', 'html'];
|
||||
// {{SQL CARBON EDIT}}
|
||||
reportTypes = ['json', 'lcov', 'html', 'cobertura'];
|
||||
}
|
||||
|
||||
const reporter = new istanbul.Reporter(null, coveragePath);
|
||||
@@ -119,6 +155,8 @@ function loadTestModules(opts) {
|
||||
if (opts.run) {
|
||||
const files = Array.isArray(opts.run) ? opts.run : [opts.run];
|
||||
const modules = files.map(file => {
|
||||
file = file.replace(/^src/, 'out');
|
||||
file = file.replace(/\.ts$/, '.js');
|
||||
return path.relative(_out, file).replace(/\.js$/, '');
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user