From 1afffba1d8bed670401fbef2391d2fb4de4c1c78 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 4 Nov 2019 11:00:19 -0800 Subject: [PATCH 01/19] Only refresh rows that changed during parsing Fixes #2534 --- src/InputHandler.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 7b6ea1fe..74208482 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -347,6 +347,9 @@ export class InputHandler extends Disposable implements IInputHandler { } } + // Clear the dirty row service so we know which lines changed as a result of parsing + this._dirtyRowService.clearRange(); + // process big data in smaller chunks if (data.length > MAX_PARSEBUFFER_LENGTH) { for (let i = 0; i < data.length; i += MAX_PARSEBUFFER_LENGTH) { @@ -367,6 +370,8 @@ export class InputHandler extends Disposable implements IInputHandler { if (buffer.x !== cursorStartX || buffer.y !== cursorStartY) { this._onCursorMove.fire(); } + + // Refresh any dirty rows accumulated as part of parsing this._terminal.refresh(this._dirtyRowService.start, this._dirtyRowService.end); } From 267fbc7f5ee63a9318b3f6d048b61c91685608c0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 10:54:02 -0800 Subject: [PATCH 02/19] typescript@3.7 and fix errors --- package.json | 2 +- src/browser/Clipboard.ts | 12 ++++++------ yarn.lock | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index fa29486a..0150569d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "ts-loader": "^6.0.4", "tslint": "^5.18.0", "tslint-consistent-codestyle": "^1.13.0", - "typescript": "3.6", + "typescript": "3.7", "utf8": "^3.0.0", "webpack": "^4.35.3", "webpack-cli": "^3.1.0", diff --git a/src/browser/Clipboard.ts b/src/browser/Clipboard.ts index 594e4429..a7c48bfb 100644 --- a/src/browser/Clipboard.ts +++ b/src/browser/Clipboard.ts @@ -82,12 +82,12 @@ export function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextA // Reset the terminal textarea's styling // Timeout needs to be long enough for click event to be handled. setTimeout(() => { - textarea.style.position = null; - textarea.style.width = null; - textarea.style.height = null; - textarea.style.left = null; - textarea.style.top = null; - textarea.style.zIndex = null; + textarea.style.position = ''; + textarea.style.width = ''; + textarea.style.height = ''; + textarea.style.left = ''; + textarea.style.top = ''; + textarea.style.zIndex = ''; }, 200); } diff --git a/yarn.lock b/yarn.lock index c96c390c..cb02cf91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5184,10 +5184,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@3.6: - version "3.6.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da" - integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw== +typescript@3.7: + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== typescript@^3.5.1: version "3.5.1" From 843d5ff53ca966b809fe7371fb95464f79cc3b88 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:09:47 -0800 Subject: [PATCH 03/19] Adopt optional chaining --- src/Terminal.ts | 82 +++++++----------------- src/browser/MouseZoneManager.ts | 8 +-- src/browser/renderer/BaseRenderLayer.ts | 4 +- src/browser/services/SelectionService.ts | 4 +- 4 files changed, 27 insertions(+), 71 deletions(-) diff --git a/src/Terminal.ts b/src/Terminal.ts index 3e7e55ca..537ecb74 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -240,18 +240,12 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp return; } super.dispose(); - if (this._windowsMode) { - this._windowsMode.dispose(); - this._windowsMode = undefined; - } - if (this._renderService) { - this._renderService.dispose(); - } + this._windowsMode?.dispose(); + this._windowsMode = undefined; + this._renderService?.dispose(); this._customKeyEventHandler = null; this.write = () => {}; - if (this.element && this.element.parentNode) { - this.element.parentNode.removeChild(this.element); - } + this.element?.parentNode?.removeChild(this.element); } private _setup(): void { @@ -336,12 +330,8 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp case 'fontFamily': case 'fontSize': // When the font changes the size of the cells may change which requires a renderer clear - if (this._renderService) { - this._renderService.clear(); - } - if (this._charSizeService) { - this._charSizeService.measure(); - } + this._renderService?.clear(); + this._charSizeService?.measure(); break; case 'drawBoldTextInBrightColors': case 'letterSpacing': @@ -363,9 +353,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp break; case 'scrollback': this.buffers.resize(this.cols, this.rows); - if (this.viewport) { - this.viewport.syncScrollArea(); - } + this.viewport?.syncScrollArea(); break; case 'screenReaderMode': if (this.optionsService.options.screenReaderMode) { @@ -373,10 +361,8 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this._accessibilityManager = new AccessibilityManager(this, this._renderService); } } else { - if (this._accessibilityManager) { - this._accessibilityManager.dispose(); - this._accessibilityManager = null; - } + this._accessibilityManager?.dispose(); + this._accessibilityManager = null; } break; case 'tabStopWidth': this.buffers.setupTabStops(); break; @@ -389,10 +375,8 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this._windowsMode = applyWindowsMode(this); } } else { - if (this._windowsMode) { - this._windowsMode.dispose(); - this._windowsMode = undefined; - } + this._windowsMode?.dispose(); + this._windowsMode = undefined; } break; } @@ -665,15 +649,9 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp */ private _setTheme(theme: ITheme): void { this._theme = theme; - if (this._colorManager) { - this._colorManager.setTheme(theme); - } - if (this._renderService) { - this._renderService.setColors(this._colorManager.colors); - } - if (this.viewport) { - this.viewport.onThemeChange(this._colorManager.colors); - } + this._colorManager?.setTheme(theme); + this._renderService?.setColors(this._colorManager.colors); + this.viewport?.onThemeChange(this._colorManager.colors); } /** @@ -940,9 +918,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp * @param end The row to end at (between start and this.rows - 1). */ public refresh(start: number, end: number): void { - if (this._renderService) { - this._renderService.refreshRows(start, end); - } + this._renderService?.refreshRows(start, end); } /** @@ -951,9 +927,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp * @param end The row to end at (between start and this.rows - 1). */ private _queueLinkification(start: number, end: number): void { - if (this.linkifier) { - this.linkifier.linkifyRows(start, end); - } + this.linkifier?.linkifyRows(start, end); } /** @@ -1233,24 +1207,18 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp * Clears the current terminal selection. */ public clearSelection(): void { - if (this._selectionService) { - this._selectionService.clearSelection(); - } + this._selectionService?.clearSelection(); } /** * Selects all text within the terminal. */ public selectAll(): void { - if (this._selectionService) { - this._selectionService.selectAll(); - } + this._selectionService?.selectAll(); } public selectLines(start: number, end: number): void { - if (this._selectionService) { - this._selectionService.selectLines(start, end); - } + this._selectionService?.selectLines(start, end); } /** @@ -1457,9 +1425,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this._bufferService.resize(x, y); this.buffers.setupTabStops(this.cols); - if (this._charSizeService) { - this._charSizeService.measure(); - } + this._charSizeService?.measure(); // Sync the scroll area to make sure scroll events don't fire and scroll the viewport to an // invalid location @@ -1551,9 +1517,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp this._bufferService.reset(); this._coreService.reset(); this._coreMouseService.reset(); - if (this._selectionService) { - this._selectionService.reset(); - } + this._selectionService?.reset(); // reattach this._customKeyEventHandler = customKeyEventHandler; @@ -1563,9 +1527,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp // do a full screen refresh this.refresh(0, this.rows - 1); - if (this.viewport) { - this.viewport.syncScrollArea(); - } + this.viewport?.syncScrollArea(); } // TODO: Remove cancel function and cancelEvents option diff --git a/src/browser/MouseZoneManager.ts b/src/browser/MouseZoneManager.ts index 7eb7c5f8..d697c133 100644 --- a/src/browser/MouseZoneManager.ts +++ b/src/browser/MouseZoneManager.ts @@ -175,11 +175,9 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager { // Find the active zone, prevent event propagation if found to prevent other // components from handling the mouse event. const zone = this._findZoneEventAt(e); - if (zone) { - if (zone.willLinkActivate(e)) { - e.preventDefault(); - e.stopImmediatePropagation(); - } + if (zone?.willLinkActivate(e)) { + e.preventDefault(); + e.stopImmediatePropagation(); } } diff --git a/src/browser/renderer/BaseRenderLayer.ts b/src/browser/renderer/BaseRenderLayer.ts index e9ad5b3a..a33bef28 100644 --- a/src/browser/renderer/BaseRenderLayer.ts +++ b/src/browser/renderer/BaseRenderLayer.ts @@ -60,9 +60,7 @@ export abstract class BaseRenderLayer implements IRenderLayer { public dispose(): void { this._container.removeChild(this._canvas); - if (this._charAtlas) { - this._charAtlas.dispose(); - } + this._charAtlas?.dispose(); } private _initCanvas(): void { diff --git a/src/browser/services/SelectionService.ts b/src/browser/services/SelectionService.ts index 3631bbb7..4eb6550c 100644 --- a/src/browser/services/SelectionService.ts +++ b/src/browser/services/SelectionService.ts @@ -688,9 +688,7 @@ export class SelectionService implements ISelectionService { // reverseIndex) and delete in a splice is only ever used when the same // number of elements was just added. Given this is could actually be // beneficial to leave the selection as is for these cases. - if (this._trimListener) { - this._trimListener.dispose(); - } + this._trimListener.dispose(); this._trimListener = e.activeBuffer.lines.onTrim(amount => this._onTrim(amount)); } From 3dca46619c8ad4d6ca1879e24208e349ef26db62 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:30:11 -0800 Subject: [PATCH 04/19] Skip puppeteer download on unit test runs Fixes #2539 --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 177f581f..2326e981 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,8 @@ jobs: - job: Linux pool: vmImage: 'ubuntu-16.04' + variables: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: @@ -42,6 +44,8 @@ jobs: - job: macOS pool: vmImage: 'xcode9-macos10.13' + variables: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: @@ -57,6 +61,8 @@ jobs: - job: Windows pool: vmImage: 'vs2017-win2016' + variables: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: From 70500e31ac4da4468af267c2e3a0113ba4151d00 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:36:54 -0800 Subject: [PATCH 05/19] Add yarn cache caching --- azure-pipelines.yml | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2326e981..247395b3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,7 +18,12 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only displayName: 'Unit tests' @@ -51,7 +56,12 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only displayName: 'Unit tests' @@ -68,7 +78,12 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only displayName: 'Unit tests' @@ -87,7 +102,12 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: | yarn start & @@ -103,7 +123,12 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: | yarn start & @@ -130,7 +155,12 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' - - script: yarn + - task: CacheBeta@1 + inputs: + key: yarn | $(Agent.OS) | yarn.lock + path: $(YARN_CACHE_FOLDER) + displayName: Cache Yarn packages + - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js displayName: 'Package and publish to npm' From 86264d47635a8c360e7fecad10fa3fcfb2af58ee Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:42:35 -0800 Subject: [PATCH 06/19] Specify yarn cache folder --- azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 247395b3..0998781f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,7 @@ jobs: vmImage: 'ubuntu-16.04' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 + YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -51,6 +52,7 @@ jobs: vmImage: 'xcode9-macos10.13' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 + YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -73,6 +75,7 @@ jobs: vmImage: 'vs2017-win2016' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 + YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -93,6 +96,8 @@ jobs: - job: Linux_IntegrationTests pool: vmImage: 'ubuntu-16.04' + variables: + YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -118,6 +123,8 @@ jobs: - job: macOS_IntegrationTests pool: vmImage: 'xcode9-macos10.13' + variables: + YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: From 5411f60f44c71a4ecf9b3a9e125bf3afa66f700e Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:54:32 -0800 Subject: [PATCH 07/19] Try cache node_modules --- azure-pipelines.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0998781f..9ccc8393 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,6 @@ jobs: vmImage: 'ubuntu-16.04' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 - YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -22,7 +21,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -52,7 +51,6 @@ jobs: vmImage: 'xcode9-macos10.13' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 - YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -61,7 +59,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -75,7 +73,6 @@ jobs: vmImage: 'vs2017-win2016' variables: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 - YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -84,7 +81,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -97,7 +94,6 @@ jobs: pool: vmImage: 'ubuntu-16.04' variables: - YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -110,7 +106,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -124,7 +120,6 @@ jobs: pool: vmImage: 'xcode9-macos10.13' variables: - YARN_CACHE_FOLDER: .yarn-cache steps: - task: NodeTool@0 inputs: @@ -133,7 +128,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -165,7 +160,7 @@ jobs: - task: CacheBeta@1 inputs: key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) + path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' From 2960d5df53fd7626e121fdf1fe951bb93d75bf2d Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:55:06 -0800 Subject: [PATCH 08/19] New cache key --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9ccc8393..4eb35079 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ jobs: displayName: 'Install Yarn' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -58,7 +58,7 @@ jobs: displayName: 'Install Node.js' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -80,7 +80,7 @@ jobs: displayName: 'Install Node.js' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -105,7 +105,7 @@ jobs: displayName: 'Install Yarn' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -127,7 +127,7 @@ jobs: displayName: 'Install Node.js' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -159,7 +159,7 @@ jobs: displayName: 'Install Yarn' - task: CacheBeta@1 inputs: - key: yarn | $(Agent.OS) | yarn.lock + key: yarn1 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile From d2164584d53dfc59362f0e5702b45a6f56554488 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 11:56:44 -0800 Subject: [PATCH 09/19] Fix error in yml --- azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4eb35079..9117b885 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -93,7 +93,6 @@ jobs: - job: Linux_IntegrationTests pool: vmImage: 'ubuntu-16.04' - variables: steps: - task: NodeTool@0 inputs: @@ -119,7 +118,6 @@ jobs: - job: macOS_IntegrationTests pool: vmImage: 'xcode9-macos10.13' - variables: steps: - task: NodeTool@0 inputs: From c974b273d40c6e2f595539bcc2fa07152ce51fa3 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 12:41:03 -0800 Subject: [PATCH 10/19] Install puppeteer explicitly --- azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9117b885..ff13e616 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,6 +109,8 @@ jobs: displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' + - script: yarn add puppeteer + displayName: 'Install puppeteer' - script: | yarn start & sleep 10 @@ -130,6 +132,8 @@ jobs: displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' + - script: yarn add puppeteer + displayName: 'Install puppeteer' - script: | yarn start & sleep 10 From 0630baaf0295d4100c5d40e87463070c3fe316d3 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 5 Nov 2019 12:50:37 -0800 Subject: [PATCH 11/19] Don't cache on integration tests --- azure-pipelines.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ff13e616..aaa2b6ea 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ jobs: displayName: 'Install Yarn' - task: CacheBeta@1 inputs: - key: yarn1 | $(Agent.OS) | yarn.lock + key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -58,7 +58,7 @@ jobs: displayName: 'Install Node.js' - task: CacheBeta@1 inputs: - key: yarn1 | $(Agent.OS) | yarn.lock + key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -80,7 +80,7 @@ jobs: displayName: 'Install Node.js' - task: CacheBeta@1 inputs: - key: yarn1 | $(Agent.OS) | yarn.lock + key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile @@ -102,11 +102,6 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' - - task: CacheBeta@1 - inputs: - key: yarn1 | $(Agent.OS) | yarn.lock - path: node_modules - displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn add puppeteer @@ -125,11 +120,6 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' - - task: CacheBeta@1 - inputs: - key: yarn1 | $(Agent.OS) | yarn.lock - path: node_modules - displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn add puppeteer @@ -161,7 +151,7 @@ jobs: displayName: 'Install Yarn' - task: CacheBeta@1 inputs: - key: yarn1 | $(Agent.OS) | yarn.lock + key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules displayName: Cache Yarn packages - script: yarn --frozen-lockfile From fc0568074ffb7577680c6646725ce2053a145ada Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 10:37:00 -0800 Subject: [PATCH 12/19] Cache node modules with puppeteer --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index aaa2b6ea..b4a6d940 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -98,6 +98,11 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' + - task: CacheBeta@1 + inputs: + key: yarn_puppeteer | $(Agent.OS) | yarn.lock + path: node_modules + displayName: Cache Yarn packages - task: YarnInstaller@3 inputs: versionSpec: '1.x' @@ -120,6 +125,11 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' + - task: CacheBeta@1 + inputs: + key: yarn_puppeteer | $(Agent.OS) | yarn.lock + path: node_modules + displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn add puppeteer From d4dbdac73f6bd20764ee2e1626c0f9a4265502c6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 10:53:42 -0800 Subject: [PATCH 13/19] Don't cache integration test modules --- azure-pipelines.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b4a6d940..7ddb534f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ jobs: inputs: key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules - displayName: Cache Yarn packages + displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only @@ -60,7 +60,7 @@ jobs: inputs: key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules - displayName: Cache Yarn packages + displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only @@ -82,7 +82,7 @@ jobs: inputs: key: yarn2 | $(Agent.OS) | yarn.lock path: node_modules - displayName: Cache Yarn packages + displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn test-unit --forbid-only @@ -102,7 +102,7 @@ jobs: inputs: key: yarn_puppeteer | $(Agent.OS) | yarn.lock path: node_modules - displayName: Cache Yarn packages + displayName: Cache node modules - task: YarnInstaller@3 inputs: versionSpec: '1.x' @@ -125,11 +125,6 @@ jobs: inputs: versionSpec: '8.x' displayName: 'Install Node.js' - - task: CacheBeta@1 - inputs: - key: yarn_puppeteer | $(Agent.OS) | yarn.lock - path: node_modules - displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: yarn add puppeteer @@ -159,11 +154,6 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' - - task: CacheBeta@1 - inputs: - key: yarn2 | $(Agent.OS) | yarn.lock - path: node_modules - displayName: Cache Yarn packages - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js From d079775690a5e93f4d06971c7cc151912a7e569b Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:04:37 -0800 Subject: [PATCH 14/19] Merge coverage check into regular unit test check Fixes #2542 --- azure-pipelines.yml | 17 +++-------------- bin/test.js | 21 ++++++++++++++++++++- package.json | 1 + 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7ddb534f..415f1fb2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,26 +25,15 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-unit --forbid-only + - script: yarn test-coverage --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' - - script: | - NODE_PATH=$(pwd)/out ./node_modules/.bin/nyc ./node_modules/.bin/mocha './out/*test.js' './out/**/*test.js' - ./node_modules/.bin/nyc report --reporter=cobertura - displayName: 'Coverage report' - task: PublishCodeCoverageResults@1 inputs: codeCoverageTool: Cobertura summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml' displayName: 'Publish coverage' - - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@6 - displayName: 'Check build quality' - inputs: - checkCoverage: true - coverageType: lines - coverageThreshold: 60 - coverageFailOption: fixed - job: macOS pool: @@ -63,7 +52,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-unit --forbid-only + - script: yarn test-coverage --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' @@ -85,7 +74,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-unit --forbid-only + - script: yarn test-coverage --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' diff --git a/bin/test.js b/bin/test.js index 3b08d4a1..2b15e907 100644 --- a/bin/test.js +++ b/bin/test.js @@ -28,6 +28,26 @@ if (process.argv.length > 2) { } } +const checkCoverage = flagArgs.indexOf('--coverage') >= 0; + +if (checkCoverage) { + flagArgs.splice(flagArgs.indexOf('--coverage'), 1); + const executable = path.resolve(__dirname, '../node_modules/.bin/nyc'); + const args = ['--check-coverage', '--lines=100', path.resolve(__dirname, '../node_modules/.bin/mocha'), ...testFiles, ...flagArgs]; + console.info('executable', executable); + console.info('args', args); + const run = cp.spawnSync( + executable, + args, + { + cwd: path.resolve(__dirname, '..'), + env, + stdio: 'inherit' + } + ); + process.exit(run.status); +} + const run = cp.spawnSync( path.resolve(__dirname, '../node_modules/.bin/mocha'), [...testFiles, ...flagArgs], @@ -37,5 +57,4 @@ const run = cp.spawnSync( stdio: 'inherit' } ); - process.exit(run.status); diff --git a/package.json b/package.json index 0150569d..c33c48bd 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "posttest": "npm run lint", "test-api": "mocha \"**/*.api.js\"", "test-unit": "node ./bin/test.js", + "test-coverage": "node ./bin/test.js --coverage", "build": "tsc -b ./tsconfig.all.json", "prepare": "npm run setup", "setup": "npm run build", From 030a8bda80359623fd4a80cce7ee2c8d5dd2508f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:08:39 -0800 Subject: [PATCH 15/19] Set coverage lines threshold to 60% --- bin/test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/test.js b/bin/test.js index 2b15e907..94b4ac7b 100644 --- a/bin/test.js +++ b/bin/test.js @@ -6,6 +6,8 @@ const cp = require('child_process'); const path = require('path'); +const COVERAGE_LINES_THRESHOLD = 60; + // Add `out` to the NODE_PATH so absolute paths can be resolved. const env = { ...process.env }; env.NODE_PATH = path.resolve(__dirname, '../out'); @@ -33,7 +35,7 @@ const checkCoverage = flagArgs.indexOf('--coverage') >= 0; if (checkCoverage) { flagArgs.splice(flagArgs.indexOf('--coverage'), 1); const executable = path.resolve(__dirname, '../node_modules/.bin/nyc'); - const args = ['--check-coverage', '--lines=100', path.resolve(__dirname, '../node_modules/.bin/mocha'), ...testFiles, ...flagArgs]; + const args = ['--check-coverage', `--lines=${COVERAGE_LINES_THRESHOLD}`, path.resolve(__dirname, '../node_modules/.bin/mocha'), ...testFiles, ...flagArgs]; console.info('executable', executable); console.info('args', args); const run = cp.spawnSync( From 48b20e32005d98a905c463c1acf9acc0bd9fd6b7 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:08:47 -0800 Subject: [PATCH 16/19] Don't run through nyc on mac and Windows --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 415f1fb2..a4f6ede8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,7 +52,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-coverage --forbid-only + - script: yarn test-unit --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' @@ -74,7 +74,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-coverage --forbid-only + - script: yarn test-unit --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' From fe2f1ea4df1b0b426057944af9d5d352bbd96fc7 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:20:52 -0800 Subject: [PATCH 17/19] Get Windows unit tests running again Fixes #2543 --- bin/test.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/test.js b/bin/test.js index 94b4ac7b..bd1784fb 100644 --- a/bin/test.js +++ b/bin/test.js @@ -34,8 +34,8 @@ const checkCoverage = flagArgs.indexOf('--coverage') >= 0; if (checkCoverage) { flagArgs.splice(flagArgs.indexOf('--coverage'), 1); - const executable = path.resolve(__dirname, '../node_modules/.bin/nyc'); - const args = ['--check-coverage', `--lines=${COVERAGE_LINES_THRESHOLD}`, path.resolve(__dirname, '../node_modules/.bin/mocha'), ...testFiles, ...flagArgs]; + const executable = npmBinScript('nyc'); + const args = ['--check-coverage', `--lines=${COVERAGE_LINES_THRESHOLD}`, npmBinScript('mocha'), ...testFiles, ...flagArgs]; console.info('executable', executable); console.info('args', args); const run = cp.spawnSync( @@ -51,7 +51,7 @@ if (checkCoverage) { } const run = cp.spawnSync( - path.resolve(__dirname, '../node_modules/.bin/mocha'), + npmBinScript('mocha'), [...testFiles, ...flagArgs], { cwd: path.resolve(__dirname, '..'), @@ -59,4 +59,9 @@ const run = cp.spawnSync( stdio: 'inherit' } ); + +function npmBinScript(script) { + return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? `${script}.cmd` : script)); +} + process.exit(run.status); From 31afe5b30545da59a965ff69ba756c54bbe02308 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:23:42 -0800 Subject: [PATCH 18/19] test-coverage -> test-unit-coverage --- azure-pipelines.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a4f6ede8..1ee66ddb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: yarn test-coverage --forbid-only + - script: yarn test-unit-coverage --forbid-only displayName: 'Unit tests' - script: yarn lint displayName: 'Lint' diff --git a/package.json b/package.json index c33c48bd..7ed71741 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "posttest": "npm run lint", "test-api": "mocha \"**/*.api.js\"", "test-unit": "node ./bin/test.js", - "test-coverage": "node ./bin/test.js --coverage", + "test-unit-coverage": "node ./bin/test.js --coverage", "build": "tsc -b ./tsconfig.all.json", "prepare": "npm run setup", "setup": "npm run build", From 08782949648f064620a1cc646d7199cd70842c36 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 6 Nov 2019 11:24:34 -0800 Subject: [PATCH 19/19] Skip Terminal2 tests on Windows --- src/Terminal2.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Terminal2.test.ts b/src/Terminal2.test.ts index efb2a446..f7046240 100644 --- a/src/Terminal2.test.ts +++ b/src/Terminal2.test.ts @@ -34,7 +34,6 @@ if (os.platform() === 'darwin') { // filter skipFilenames const FILES = TESTFILES.filter(value => SKIP_FILES.indexOf(value.split('/').slice(-1)[0]) === -1); - describe('Escape Sequence Files', function(): void { this.timeout(1000); @@ -44,6 +43,9 @@ describe('Escape Sequence Files', function(): void { let customHandler: IDisposable | undefined; before(() => { + if (process.platform === 'win32') { + return; + } ptyTerm = (pty as any).open({cols: COLS, rows: ROWS}); slaveEnd = ptyTerm._slave; term = new Terminal({cols: COLS, rows: ROWS}); @@ -51,12 +53,15 @@ describe('Escape Sequence Files', function(): void { }); after(() => { + if (process.platform === 'win32') { + return; + } ptyTerm._master.end(); ptyTerm._master.destroy(); }); FILES.forEach(filename => { - it(filename.split('/').slice(-1)[0], async () => { + (process.platform === 'win32' ? it.skip : it)(filename.split('/').slice(-1)[0], async () => { // reset terminal and handler if (customHandler) { customHandler.dispose();