Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,14 @@ async function buildWebPack(webpackConfigName, args, env) {
['run', 'webpack', '--', ...args, ...['--mode', 'production', '--devtool', 'source-map']],
env,
);
// Strip ANSI color/style escape codes before parsing webpack output lines.
// Webpack colorizes output (e.g. "\u001b[1m\u001b[31mERROR\u001b[39m\u001b[22m in ..."),
// which would prevent startsWith('ERROR in') / startsWith('WARNING in') from matching.
// eslint-disable-next-line no-control-regex
const stripAnsi = (str) => str.replace(/\u001b\[[0-9;]*m/g, '');
const stdOutLines = stdOut
.split(os.EOL)
.map((item) => item.trim())
.map((item) => stripAnsi(item).trim())
.filter((item) => item.length > 0);
// Remember to perform a case insensitive search.
const warnings = stdOutLines
Expand Down
1,121 changes: 273 additions & 848 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@
},
"dependencies": {
"@iarna/toml": "^3.0.0",
"@vscode/extension-telemetry": "^0.8.4",
"@vscode/extension-telemetry": "^1.5.2",
"arch": "^2.1.0",
"fs-extra": "^11.2.0",
"glob": "^7.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/client/browser/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import TelemetryReporter from '@vscode/extension-telemetry';
import { TelemetryReporter } from '@vscode/extension-telemetry';
import { LanguageClientOptions } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/browser';
import { LanguageClientMiddlewareBase } from '../activation/languageClientMiddlewareBase';
Expand Down Expand Up @@ -153,7 +153,7 @@ function getTelemetryReporter() {
}

// eslint-disable-next-line global-require
const Reporter = require('@vscode/extension-telemetry').default as typeof TelemetryReporter;
const Reporter = require('@vscode/extension-telemetry').TelemetryReporter as typeof TelemetryReporter;
telemetryReporter = new Reporter(AppinsightsKey, [
{
lookup: /(errorName|errorMessage|errorStack)/g,
Expand Down
4 changes: 2 additions & 2 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import TelemetryReporter from '@vscode/extension-telemetry';
import { TelemetryReporter } from '@vscode/extension-telemetry';
import type * as vscodeTypes from 'vscode';
import { DiagnosticCodes } from '../application/diagnostics/constants';
import { AppinsightsKey, isTestExecution, isUnitTestExecution, PVSC_EXTENSION_ID } from '../common/constants';
Expand Down Expand Up @@ -78,7 +78,7 @@ export function getTelemetryReporter(): TelemetryReporter {
return telemetryReporter;
}

const Reporter = require('@vscode/extension-telemetry').default as typeof TelemetryReporter;
const Reporter = require('@vscode/extension-telemetry').TelemetryReporter as typeof TelemetryReporter;
telemetryReporter = new Reporter(AppinsightsKey, [
{
lookup: /(errorName|errorMessage|errorStack)/g,
Expand Down
2 changes: 1 addition & 1 deletion src/test/debugger/extension/adapter/factory.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ suite('Debugging - Adapter Factory', () => {
readJSONSyncStub = sinon.stub(fs, 'readJSONSync');
readJSONSyncStub.returns({ enableTelemetry: true });
rewiremock.enable();
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });
stateFactory = mock(PersistentStateFactory);
state = mock(PersistentState) as PersistentState<boolean | undefined>;
commandManager = mock(CommandManager);
Expand Down
10 changes: 5 additions & 5 deletions src/test/telemetry/index.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ suite('Telemetry', () => {

test('Send Telemetry', () => {
rewiremock.enable();
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });

const eventName = 'Testing';
const properties = { hello: 'world', foo: 'bar' };
Expand All @@ -75,7 +75,7 @@ suite('Telemetry', () => {
});
test('Send Telemetry with no properties', () => {
rewiremock.enable();
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });

const eventName = 'Testing';

Expand All @@ -87,7 +87,7 @@ suite('Telemetry', () => {
});
test('Send Telemetry with shared properties', () => {
rewiremock.enable();
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });

const eventName = 'Testing';
const properties = { hello: 'world', foo: 'bar' };
Expand All @@ -104,7 +104,7 @@ suite('Telemetry', () => {
});
test('Shared properties will replace existing ones', () => {
rewiremock.enable();
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });

const eventName = 'Testing';
const properties = { hello: 'world', foo: 'bar' };
Expand All @@ -122,7 +122,7 @@ suite('Telemetry', () => {
test('Send Exception Telemetry', () => {
rewiremock.enable();
const error = new Error('Boo');
rewiremock('@vscode/extension-telemetry').with({ default: Reporter });
rewiremock('@vscode/extension-telemetry').with({ TelemetryReporter: Reporter });

const eventName = 'Testing';
const measures = { start: 123, end: 987 };
Expand Down
Loading