Skip to content

Commit

Permalink
Updated for Stryker
Browse files Browse the repository at this point in the history
  • Loading branch information
gramster committed Sep 9, 2020
1 parent dfdc37e commit fc88313
Show file tree
Hide file tree
Showing 39 changed files with 1,538 additions and 209 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ debugpy*.log
pydevd*.log
nodeLanguageServer/**
nodeLanguageServer.*/**
+.stryker-tmp
1,612 changes: 1,480 additions & 132 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,13 @@
"@nteract/transforms": "^4.4.7",
"@phosphor/widgets": "^1.9.3",
"@sinonjs/fake-timers": "^6.0.1",
"@stryker-mutator/core": "^4.0.0-beta.4",
"@stryker-mutator/javascript-mutator": "^4.0.0-beta.4",
"@stryker-mutator/mocha-framework": "^4.0.0-beta.4",
"@stryker-mutator/mocha-runner": "^4.0.0-beta.4",
"@stryker-mutator/typescript": "^4.0.0-beta.4",
"@stryker-mutator/typescript-checker": "^4.0.0-beta.4",
"@stryker-mutator/webpack-transpiler": "^3.3.1",
"@testing-library/react": "^9.4.0",
"@types/ansi-regex": "^4.0.0",
"@types/chai": "^4.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/languageServer/languageClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DotNetDownloadedLanguageClientFactory implements ILanguageClientFac
run: { command: serverModule, args: [], options },
debug: { command: serverModule, args: ['--debug'], options }
};
const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node');
const vscodeLanguageClient = require('vscode-languageclient/node'); // as typeof import('vscode-languageclient/node');
return new vscodeLanguageClient.LanguageClient(
PYTHON_LANGUAGE,
languageClientName,
Expand Down Expand Up @@ -69,7 +69,7 @@ export class DotNetSimpleLanguageClientFactory implements ILanguageClientFactory
run: { command: dotNetCommand, args: [serverModule], options },
debug: { command: dotNetCommand, args: [serverModule, '--debug'], options }
};
const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node');
const vscodeLanguageClient = require('vscode-languageclient/node'); // as typeof import('vscode-languageclient/node');
return new vscodeLanguageClient.LanguageClient(
PYTHON_LANGUAGE,
languageClientName,
Expand Down
2 changes: 1 addition & 1 deletion src/client/activation/node/languageClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NodeLanguageClientFactory implements ILanguageClientFactory {
}
};

const vscodeLanguageClient = require('vscode-languageclient/node') as typeof import('vscode-languageclient/node');
const vscodeLanguageClient = require('vscode-languageclient/node'); // as typeof import('vscode-languageclient/node');
return new vscodeLanguageClient.LanguageClient(
PYTHON_LANGUAGE,
languageClientName,
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/application/customEditorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CustomEditorService implements ICustomEditorService {
// tslint:disable-next-line: no-any
private async addCustomEditors(currentPackageJson: any) {
// tslint:disable-next-line:no-require-imports no-var-requires
const _mergeWith = require('lodash/mergeWith') as typeof import('lodash/mergeWith');
const _mergeWith = require('lodash/mergeWith');// as typeof import('lodash/mergeWith');
const improvedContents = await this.fileSystem.readFile(path.join(EXTENSION_ROOT_DIR, 'customEditor.json'));
const improved = _mergeWith({ ...currentPackageJson }, JSON.parse(improvedContents), (l, r) => {
if (Array.isArray(l) && Array.isArray(r)) {
Expand Down
12 changes: 6 additions & 6 deletions src/client/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function getTextEditsFromPatch(before: string, patch: string): TextEdit[]
// # Work around missing newline (http://bugs.python.org/issue2142).
patch = patch.replace(/\\ No newline at end of file[\r\n]/, '');
// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch');// as typeof import('diff-match-patch');
const d = new dmp.diff_match_patch();
const patches = patch_fromText.call(d, patch);
if (!Array.isArray(patches) || patches.length === 0) {
Expand Down Expand Up @@ -123,7 +123,7 @@ export function getWorkspaceEditsFromPatch(
patch = patch.replace(/\\ No newline at end of file[\r\n]/, '');

// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch'); // as typeof import('diff-match-patch');
const d = new dmp.diff_match_patch();
const patches = patch_fromText.call(d, patch);
if (!Array.isArray(patches) || patches.length === 0) {
Expand Down Expand Up @@ -161,7 +161,7 @@ export function getWorkspaceEditsFromPatch(
}
export function getTextEdits(before: string, after: string): TextEdit[] {
// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch'); // as typeof import('diff-match-patch');
const d = new dmp.diff_match_patch();
const diffs = d.diff_main(before, after);
return getTextEditsInternal(before, diffs).map((edit) => edit.apply());
Expand Down Expand Up @@ -192,7 +192,7 @@ function getTextEditsInternal(before: string, diffs: [number, string][], startLi
}

// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch'); // as typeof import('diff-match-patch');
// tslint:disable-next-line:switch-default
switch (diffs[i][0]) {
case dmp.DIFF_DELETE:
Expand Down Expand Up @@ -319,7 +319,7 @@ function patch_fromText(textline: string): Patch[] {
}
textPointer += 1;
// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch'); // as typeof import('diff-match-patch');

while (textPointer < text.length) {
const sign = text[textPointer].charAt(0);
Expand Down Expand Up @@ -375,7 +375,7 @@ export class EditorUtils implements IEditorUtils {
patch = patch.replace(/\\ No newline at end of file[\r\n]/, '');

// tslint:disable-next-line:no-require-imports
const dmp = require('diff-match-patch') as typeof import('diff-match-patch');
const dmp = require('diff-match-patch'); // as typeof import('diff-match-patch');
const d = new dmp.diff_match_patch();
const patches = patch_fromText.call(d, patch);
if (!Array.isArray(patches) || patches.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/nuget/azureBlobStoreNugetRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ interface IAZBlobStore {

async function _getAZBlobStore(uri: string): Promise<IAZBlobStore> {
// tslint:disable-next-line:no-require-imports
const az = (await import('azure-storage')) as typeof import('azure-storage');
const az = (await import('azure-storage'));// as typeof import('azure-storage');
return az.createBlobServiceAnonymous(uri);
}
6 changes: 3 additions & 3 deletions src/client/common/platform/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function getArchitectureDisplayName(arch?: Architecture) {

async function getRegistryValue(options: Options, name: string = '') {
// tslint:disable-next-line:no-require-imports
const Registry = require('winreg') as typeof import('winreg');
const Registry = require('winreg');// as typeof import('winreg');
return new Promise<string | undefined | null>((resolve) => {
new Registry(options).get(name, (error, result) => {
if (error || !result || typeof result.value !== 'string') {
Expand All @@ -53,7 +53,7 @@ async function getRegistryValue(options: Options, name: string = '') {

async function getRegistryKeys(options: Options): Promise<string[]> {
// tslint:disable-next-line:no-require-imports
const Registry = require('winreg') as typeof import('winreg');
const Registry = require('winreg');// as typeof import('winreg');
// https://github.com/python/peps/blob/master/pep-0514.txt#L85
return new Promise<string[]>((resolve) => {
new Registry(options).keys((error, result) => {
Expand All @@ -76,7 +76,7 @@ function translateArchitecture(arch?: Architecture): RegistryArchitectures | und
}
function translateHive(hive: RegistryHive): string | undefined {
// tslint:disable-next-line:no-require-imports
const Registry = require('winreg') as typeof import('winreg');
const Registry = require('winreg');// as typeof import('winreg');
switch (hive) {
case RegistryHive.HKCU:
return Registry.HKCU;
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/utils/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getCacheKeyFromFunctionArgs, getGlobalCacheStore, InMemoryInterpreterSp
import { TraceInfo, tracing } from './misc';

// tslint:disable-next-line:no-require-imports no-var-requires
const _debounce = require('lodash/debounce') as typeof import('lodash/debounce');
const _debounce = require('lodash/debounce');// as typeof import('lodash/debounce');

type VoidFunction = () => any;
type AsyncVoidFunction = () => Promise<any>;
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/baseJupyterSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export abstract class BaseJupyterSession implements IJupyterSession {
private get jupyterLab(): undefined | typeof import('@jupyterlab/services') {
if (!this._jupyterLab) {
// tslint:disable-next-line:no-require-imports
this._jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR
this._jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services'); // NOSONAR
}
return this._jupyterLab;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '../types';

// tslint:disable-next-line:no-require-imports no-var-requires
const _escapeRegExp = require('lodash/escapeRegExp') as typeof import('lodash/escapeRegExp'); // NOSONAR
const _escapeRegExp = require('lodash/escapeRegExp');// as typeof import('lodash/escapeRegExp'); // NOSONAR
const LineNumberMatchRegex = /(;32m[ ->]*?)(\d+)/g;

interface IRangedCellHash extends ICellHash {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ export abstract class InteractiveBase extends WebviewPanelHost<IInteractiveWindo
private handleKernelMessage(msg: KernelMessage.IIOPubMessage, _requestId: string) {
// Only care about one sort of message, UpdateDisplayData
// tslint:disable-next-line: no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR
const jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services'); // NOSONAR
if (jupyterLab.KernelMessage.isUpdateDisplayDataMsg(msg)) {
this.handleUpdateDisplayData(msg as KernelMessage.IUpdateDisplayDataMsg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { NativeEditorOldWebView } from './nativeEditorOldWebView';
import { NativeEditorSynchronizer } from './nativeEditorSynchronizer';

// tslint:disable-next-line:no-require-imports no-var-requires
const debounce = require('lodash/debounce') as typeof import('lodash/debounce');
const debounce = require('lodash/debounce');// as typeof import('lodash/debounce');

@injectable()
export class NativeEditorProviderOld extends NativeEditorProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class IPyWidgetMessageDispatcher implements IIPyWidgetMessageDispatcher {
this.mirrorSend = this.mirrorSend.bind(this);
this.onKernelSocketMessage = this.onKernelSocketMessage.bind(this);
// tslint:disable-next-line: no-require-imports
const jupyterLabSerialize = require('@jupyterlab/services/lib/kernel/serialize') as typeof import('@jupyterlab/services/lib/kernel/serialize'); // NOSONAR
const jupyterLabSerialize = require('@jupyterlab/services/lib/kernel/serialize');// as typeof import('@jupyterlab/services/lib/kernel/serialize'); // NOSONAR
this.deserialize = jupyterLabSerialize.deserialize;
}
public dispose() {
Expand Down Expand Up @@ -150,7 +150,7 @@ export class IPyWidgetMessageDispatcher implements IIPyWidgetMessageDispatcher {
if (!this.jupyterLab) {
// Lazy load jupyter lab for faster extension loading.
// tslint:disable-next-line:no-require-imports
this.jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR
this.jupyterLab = require('@jupyterlab/services'); // as typeof import('@jupyterlab/services'); // NOSONAR
}

// If we have any pending targets, register them now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
import { Telemetry } from '../constants';
import { CellState, ICell, INotebookEditor, INotebookEditorProvider, INotebookExecutionLogger } from '../types';
// tslint:disable-next-line:no-require-imports no-var-requires
const flatten = require('lodash/flatten') as typeof import('lodash/flatten');
const flatten = require('lodash/flatten');// as typeof import('lodash/flatten');

@injectable()
export class CellOutputMimeTypeTracker implements IExtensionSingleActivationService, INotebookExecutionLogger {
Expand Down
4 changes: 2 additions & 2 deletions src/client/datascience/jupyter/jupyterNotebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ export class JupyterNotebookBase implements INotebook {
this.getLoggers().forEach((f) => (msg = f.preHandleIOPub ? f.preHandleIOPub(msg) : msg));

// tslint:disable-next-line:no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services');
const jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services');

// Create a trimming function. Only trim user output. Silent output requires the full thing
const trimFunc = silent ? (s: string) => s : this.trimOutput.bind(this);
Expand Down Expand Up @@ -1057,7 +1057,7 @@ export class JupyterNotebookBase implements INotebook {
msg: KernelMessage.IShellControlMessage
) {
// tslint:disable-next-line:no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services');
const jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services');

// Create a trimming function. Only trim user output. Silent output requires the full thing
const trimFunc = silent ? (s: string) => s : this.trimOutput.bind(this);
Expand Down
6 changes: 3 additions & 3 deletions src/client/datascience/jupyter/kernels/cellExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '../../types';
import { IKernel } from './types';
// tslint:disable-next-line: no-var-requires no-require-imports
const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed');
const vscodeNotebookEnums = require('vscode');// as typeof import('vscode-proposed');

export class CellExecutionFactory {
constructor(
Expand Down Expand Up @@ -310,7 +310,7 @@ export class CellExecution {
loggers.forEach((f) => (msg = f.preHandleIOPub ? f.preHandleIOPub(msg) : msg));

// tslint:disable-next-line:no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services');
const jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services');

// Keep track of we need to send an update to VS code or not.
let shouldUpdate = true;
Expand Down Expand Up @@ -511,7 +511,7 @@ export class CellExecution {

private handleReply(clearState: RefBool, msg: KernelMessage.IShellControlMessage) {
// tslint:disable-next-line:no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services');
const jupyterLab = require('@jupyterlab/services'); // as typeof import('@jupyterlab/services');

if (jupyterLab.KernelMessage.isExecuteReplyMsg(msg)) {
this.handleExecuteReply(msg, clearState);
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/jupyter/kernels/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as fastDeepEqual from 'fast-deep-equal';
import { IJupyterKernelSpec } from '../../types';
import { JupyterKernelSpec } from './jupyterKernelSpec';
// tslint:disable-next-line: no-var-requires no-require-imports
const NamedRegexp = require('named-js-regexp') as typeof import('named-js-regexp');
const NamedRegexp = require('named-js-regexp');// as typeof import('named-js-regexp');

// tslint:disable-next-line: no-require-imports
import cloneDeep = require('lodash/cloneDeep');
Expand Down
4 changes: 2 additions & 2 deletions src/client/datascience/jupyter/kernels/kernelExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IDataScienceErrorHandler, INotebook, INotebookEditorProvider } from '..
import { CellExecution, CellExecutionFactory } from './cellExecution';
import type { IKernel, IKernelProvider, IKernelSelectionUsage } from './types';
// tslint:disable-next-line: no-var-requires no-require-imports
const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed');
const vscodeNotebookEnums = require('vscode');// as typeof import('vscode-proposed');

/**
* Separate class that deals just with kernel execution.
Expand Down Expand Up @@ -162,7 +162,7 @@ export class KernelExecution implements IDisposable {

private onIoPubMessage(document: NotebookDocument, msg: KernelMessage.IIOPubMessage) {
// tslint:disable-next-line:no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services');
const jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services');
if (jupyterLab.KernelMessage.isUpdateDisplayDataMsg(msg) && handleUpdateDisplayDataMessage(msg, document)) {
this.contentProvider.notifyChangesToDocument(document);
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/jupyter/kernels/kernelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { JupyterKernelSpec } from './jupyterKernelSpec';
import { LiveKernelModel } from './types';

// tslint:disable-next-line: no-var-requires no-require-imports
const NamedRegexp = require('named-js-regexp') as typeof import('named-js-regexp');
const NamedRegexp = require('named-js-regexp');// as typeof import('named-js-regexp');

/**
* Helper to ensure we can differentiate between two types in union types, keeping typing information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class GuestJupyterNotebook
private get jupyterLab(): typeof import('@jupyterlab/services') {
if (!this._jupyterLab) {
// tslint:disable-next-line:no-require-imports
this._jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR
this._jupyterLab = require('@jupyterlab/services');// as typeof import('@jupyterlab/services'); // NOSONAR
}
return this._jupyterLab!;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/kernel-launcher/kernelFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { IDataScienceFileSystem, IJupyterKernelSpec } from '../types';
import { getKernelInterpreter } from './helpers';
import { IKernelFinder } from './types';
// tslint:disable-next-line:no-require-imports no-var-requires
const flatten = require('lodash/flatten') as typeof import('lodash/flatten');
const flatten = require('lodash/flatten');// as typeof import('lodash/flatten');

const winJupyterPath = path.join('AppData', 'Roaming', 'jupyter', 'kernels');
const linuxJupyterPath = path.join('.local', 'share', 'jupyter', 'kernels');
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/notebook/contentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { notebookModelToVSCNotebookData } from './helpers/helpers';
import { NotebookEditorCompatibilitySupport } from './notebookEditorCompatibilitySupport';
import { INotebookContentProvider } from './types';
// tslint:disable-next-line: no-var-requires no-require-imports
const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed');
const vscodeNotebookEnums = require('vscode');// as typeof import('vscode-proposed');

/**
* This class is responsible for reading a notebook file (ipynb or other files) and returning VS Code with the NotebookData.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NotebookCell, NotebookCellRunState, NotebookDocument } from 'vscode';
import { createErrorOutput } from '../../../../datascience-ui/common/cellFactory';
import { createIOutputFromCellOutputs, createVSCCellOutputsFromOutputs, translateErrorOutput } from './helpers';
// tslint:disable-next-line: no-var-requires no-require-imports
const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed');
const vscodeNotebookEnums = require('vscode');// as typeof import('vscode-proposed');

/**
* Updates the cell in notebook model as well as the notebook document.
Expand Down
Loading

0 comments on commit fc88313

Please sign in to comment.