mirror of
https://github.com/coder/code-server.git
synced 2025-07-31 14:04:06 +08:00
chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so that PR review is possible.
This commit is contained in:
@ -3,6 +3,10 @@
|
||||
* Licensed under the MIT License. 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('run', 'only run tests from <file>').string('run')
|
||||
@ -25,7 +29,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');
|
||||
@ -47,10 +51,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
|
||||
};
|
||||
@ -59,6 +63,7 @@ function deserializeSuite(suite) {
|
||||
function deserializeRunnable(runnable) {
|
||||
return {
|
||||
title: runnable.title,
|
||||
titlePath: () => runnable.titlePath,
|
||||
fullTitle: () => runnable.fullTitle,
|
||||
async: runnable.async,
|
||||
slow: () => runnable.slow,
|
||||
@ -68,6 +73,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;
|
||||
@ -138,6 +152,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);
|
||||
@ -148,11 +163,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);
|
||||
|
Reference in New Issue
Block a user