Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)

* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8

* Bump distro

* Upgrade GCC to 4.9 due to yarn install errors

* Update build image

* Fix bootstrap base url

* Bump distro

* Fix build errors

* Update source map file

* Disable checkbox for blocking migration issues (#15131)

* disable checkbox for blocking issues

* wip

* disable checkbox fixes

* fix strings

* Remove duplicate tsec command

* Default to off for tab color if settings not present

* re-skip failing tests

* Fix mocha error

* Bump sqlite version & fix notebooks search view

* Turn off esbuild warnings

* Update esbuild log level

* Fix overflowactionbar tests

* Fix ts-ignore in dropdown tests

* cleanup/fixes

* Fix hygiene

* Bundle in entire zone.js module

* Remove extra constructor param

* bump distro for web compile break

* bump distro for web compile break v2

* Undo log level change

* New distro

* Fix integration test scripts

* remove the "no yarn.lock changes" workflow

* fix scripts v2

* Update unit test scripts

* Ensure ads-kerberos2 updates in .vscodeignore

* Try fix unit tests

* Upload crash reports

* remove nogpu

* always upload crashes

* Use bash script

* Consolidate data/ext dir names

* Create in tmp directory

Co-authored-by: chlafreniere <hichise@gmail.com>
Co-authored-by: Christopher Suh <chsuh@microsoft.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Karl Burtram
2021-04-27 14:01:59 -07:00
committed by GitHub
parent 7e1c0076ba
commit 867a963882
1817 changed files with 81812 additions and 50843 deletions

View File

@@ -7,9 +7,9 @@
const path = require('path');
const glob = require('glob');
const fs = require('fs');
const events = require('events');
const mocha = require('mocha');
const createStatsCollector = require('../../../node_modules/mocha/lib/stats-collector');
const MochaJUnitReporter = require('mocha-junit-reporter');
const url = require('url');
const minimatch = require('minimatch');
@@ -131,6 +131,19 @@ const testModules = (async function () {
})
})();
function consoleLogFn(msg) {
const type = msg.type();
const candidate = console[type];
if (candidate) {
return candidate;
}
if (type === 'warning') {
return console.warn;
}
return console.log;
}
async function runTestsInBrowser(testModules, browserType) {
const args = process.platform === 'linux' && browserType === 'chromium' ? ['--no-sandbox'] : undefined; // disable sandbox to run chrome on certain Linux distros
@@ -149,7 +162,7 @@ async function runTestsInBrowser(testModules, browserType) {
});
page.on('console', async msg => {
console[msg.type()](msg.text(), await Promise.all(msg.args().map(async arg => await arg.jsonValue())));
consoleLogFn(msg)(msg.text(), await Promise.all(msg.args().map(async arg => await arg.jsonValue())));
});
withReporter(browserType, new EchoRunner(emitter, browserType.toUpperCase()));
@@ -186,6 +199,7 @@ class EchoRunner extends events.EventEmitter {
constructor(event, title = '') {
super();
createStatsCollector(this);
event.on('start', () => this.emit('start'));
event.on('end', () => this.emit('end'));
event.on('suite', (suite) => this.emit('suite', EchoRunner.deserializeSuite(suite, title)));
@@ -205,10 +219,10 @@ class EchoRunner extends events.EventEmitter {
suites: suite.suites,
tests: suite.tests,
title: titleExtra && suite.title ? `${suite.title} - /${titleExtra}/` : suite.title,
titlePath: () => suite.titlePath,
fullTitle: () => suite.fullTitle,
timeout: () => suite.timeout,
retries: () => suite.retries,
enableTimeouts: () => suite.enableTimeouts,
slow: () => suite.slow,
bail: () => suite.bail
};
@@ -218,6 +232,7 @@ class EchoRunner extends events.EventEmitter {
return {
title: runnable.title,
fullTitle: () => titleExtra && runnable.fullTitle ? `${runnable.fullTitle} - /${titleExtra}/` : runnable.fullTitle,
titlePath: () => runnable.titlePath,
async: runnable.async,
slow: () => runnable.slow,
speed: runnable.speed,

View File

@@ -70,9 +70,9 @@
tests: suite.tests.map(serializeRunnable),
title: suite.title,
fullTitle: suite.fullTitle(),
titlePath: suite.titlePath(),
timeout: suite.timeout(),
retries: suite.retries(),
enableTimeouts: suite.enableTimeouts(),
slow: suite.slow(),
bail: suite.bail()
};
@@ -80,6 +80,7 @@
function serializeRunnable(runnable) {
return {
title: runnable.title,
titlePath: runnable.titlePath(),
fullTitle: runnable.fullTitle(),
async: runnable.async,
slow: runnable.slow(),

View File

@@ -3,6 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// mocha disables running through electron by default. Note that this must
// come before any mocha imports.
process.env.MOCHA_COLORS = '1';
const { app, BrowserWindow, ipcMain } = require('electron');
const { tmpdir } = require('os');
const { join } = require('path');
@@ -11,13 +15,13 @@ const mocha = require('mocha');
const events = require('events');
const MochaJUnitReporter = require('mocha-junit-reporter');
const url = require('url');
const createStatsCollector = require('mocha/lib/stats-collector');
const FullJsonStreamReporter = require('../fullJsonStreamReporter');
// Disable render process reuse, we still have
// non-context aware native modules in the renderer.
app.allowRendererProcessReuse = false;
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
const optimist = require('optimist')
.describe('grep', 'only run tests matching <pattern>').alias('grep', 'g').alias('grep', 'f').string('grep')
.describe('invert', 'uses the inverse of the match specified by grep').alias('invert', 'i').string('invert')
@@ -26,7 +30,7 @@ const optimist = require('optimist')
.describe('build', 'run with build output (out-build)').boolean('build')
.describe('coverage', 'generate coverage report').boolean('coverage')
.describe('debug', 'open dev tools, keep window open, reuse app data').string('debug')
.describe('reporter', 'the mocha reporter').string('reporter').default('reporter', defaultReporterName)
.describe('reporter', 'the mocha reporter').string('reporter').default('reporter', 'spec')
.describe('reporter-options', 'the mocha reporter options').string('reporter-options').default('reporter-options', '')
.describe('tfs').string('tfs')
.describe('help', 'show the help').alias('help', 'h');
@@ -56,10 +60,10 @@ function deserializeSuite(suite) {
suites: suite.suites,
tests: suite.tests,
title: suite.title,
titlePath: () => suite.titlePath,
fullTitle: () => suite.fullTitle,
timeout: () => suite.timeout,
retries: () => suite.retries,
enableTimeouts: () => suite.enableTimeouts,
slow: () => suite.slow,
bail: () => suite.bail
};
@@ -68,6 +72,7 @@ function deserializeSuite(suite) {
function deserializeRunnable(runnable) {
return {
title: runnable.title,
titlePath: () => runnable.titlePath,
fullTitle: () => runnable.fullTitle,
async: runnable.async,
slow: () => runnable.slow,
@@ -77,6 +82,15 @@ function deserializeRunnable(runnable) {
};
}
function importMochaReporter(name) {
if (name === 'full-json-stream') {
return FullJsonStreamReporter;
}
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', name);
return require(reporterPath);
}
function deserializeError(err) {
const inspect = err.inspect;
err.inspect = () => inspect;
@@ -147,6 +161,7 @@ app.on('ready', () => {
win.loadURL(url.format({ pathname: path.join(__dirname, 'renderer.html'), protocol: 'file:', slashes: true }));
const runner = new IPCRunner();
createStatsCollector(runner);
if (argv.tfs) {
new mocha.reporters.Spec(runner);
@@ -157,11 +172,19 @@ app.on('ready', () => {
}
});
} else {
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
let Reporter;
// mocha patches symbols to use windows escape codes, but it seems like
// Electron mangles these in its output.
if (process.platform === 'win32') {
Object.assign(importMochaReporter('base').symbols, {
ok: '+',
err: 'X',
dot: '.',
});
}
let Reporter;
try {
Reporter = require(reporterPath);
Reporter = importMochaReporter(argv.reporter);
} catch (err) {
try {
Reporter = require(argv.reporter);

View File

@@ -35,7 +35,8 @@
mocha.setup({
ui: 'tdd',
timeout: 5000
timeout: 5000,
forbidOnly: typeof process.env['BUILD_ARTIFACTSTAGINGDIRECTORY'] === 'string' // disallow .only() when running on build machine
});
require('./renderer');
</script>

View File

@@ -5,6 +5,60 @@
/*eslint-env mocha*/
(function() {
const fs = require('fs');
const originals = {};
let logging = false;
let withStacks = false;
self.beginLoggingFS = (_withStacks) => {
logging = true;
withStacks = _withStacks || false;
};
self.endLoggingFS = () => {
logging = false;
withStacks = false;
};
function createSpy(element, cnt) {
return function(...args) {
if (logging) {
console.log(`calling ${element}: ` + args.slice(0, cnt).join(',') + (withStacks ? (`\n` + new Error().stack.split('\n').slice(2).join('\n')) : ''));
}
return originals[element].call(this, ...args);
};
}
function intercept(element, cnt) {
originals[element] = fs[element];
fs[element] = createSpy(element, cnt);
}
[
['realpathSync', 1],
['readFileSync', 1],
['openSync', 3],
['readSync', 1],
['closeSync', 1],
['readFile', 2],
['mkdir', 1],
['lstat', 1],
['stat', 1],
['watch', 1],
['readdir', 1],
['access', 2],
['open', 2],
['write', 1],
['fdatasync', 1],
['close', 1],
['read', 1],
['unlink', 1],
['rmdir', 1],
].forEach((element) => {
intercept(element[0], element[1]);
})
})();
const { ipcRenderer } = require('electron');
const assert = require('assert');
const path = require('path');
@@ -158,9 +212,9 @@ function serializeSuite(suite) {
tests: suite.tests.map(serializeRunnable),
title: suite.title,
fullTitle: suite.fullTitle(),
titlePath: suite.titlePath(),
timeout: suite.timeout(),
retries: suite.retries(),
enableTimeouts: suite.enableTimeouts(),
slow: suite.slow(),
bail: suite.bail()
};
@@ -170,6 +224,7 @@ function serializeRunnable(runnable) {
return {
title: runnable.title,
fullTitle: runnable.fullTitle(),
titlePath: runnable.titlePath(),
async: runnable.async,
slow: runnable.slow(),
speed: runnable.speed,

View File

@@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const { constants } = require('mocha/lib/runner');
const BaseRunner = require('mocha/lib/reporters/base');
const {
EVENT_TEST_PASS,
EVENT_TEST_FAIL,
EVENT_RUN_BEGIN,
EVENT_RUN_END,
} = constants;
/**
* Similar to the mocha JSON stream, but includes additional information
* on failure. Specifically, the mocha json-stream does not include unmangled
* expected versus actual results.
*
* Writes a superset of the data that json-stream normally would.
*/
module.exports = class FullJsonStreamReporter extends BaseRunner {
constructor(runner, options) {
super(runner, options);
const total = runner.total;
runner.once(EVENT_RUN_BEGIN, () => writeEvent(['start', { total }]));
runner.once(EVENT_RUN_END, () => writeEvent(['end', this.stats]));
runner.on(EVENT_TEST_PASS, test => writeEvent(['pass', clean(test)]));
runner.on(EVENT_TEST_FAIL, (test, err) => {
test = clean(test);
test.actual = err.actual;
test.expected = err.expected;
test.err = err.message;
test.stack = err.stack || null;
writeEvent(['fail', test]);
});
}
}
function writeEvent(event) {
process.stdout.write(JSON.stringify(event) + '\n');
}
const clean = test => ({
title: test.title,
fullTitle: test.fullTitle(),
duration: test.duration,
currentRetry: test.currentRetry()
});