From 7576e8c20226bb799fb451ba802f90c8909304db Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Mon, 21 Oct 2019 22:27:25 -0300 Subject: [PATCH 1/5] test-api: Fail fast if .only is used --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b1ccdbf0..6f4a83af 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -80,7 +80,7 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless + yarn test-api --headless --forbid-only displayName: 'Linux Integration tests' - job: macOS_IntegrationTests @@ -97,7 +97,7 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless + yarn test-api --headless --forbid-only displayName: 'MacOS Integration tests' - job: Release From 51ef0d0680e53d61836bf85e14acea322df312fa Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Tue, 22 Oct 2019 03:00:18 +0000 Subject: [PATCH 2/5] Update test-unit to allow double dash args --- bin/test.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/test.js b/bin/test.js index 775ec004..760908a3 100644 --- a/bin/test.js +++ b/bin/test.js @@ -15,15 +15,22 @@ let testFiles = [ './out/**/*test.js' ]; -// ability to inject particular test files via -// yarn test [testFileA testFileB ...] +let flagArgs = []; + if (process.argv.length > 2) { - testFiles = process.argv.slice(2); + const args = process.argv.slice(2); + flagArgs = args.filter(e => e.startsWith('--')); + // ability to inject particular test files via + // yarn test [testFileA testFileB ...] + files = args.filter(e => !e.startsWith('--')); + if(files.length){ + testFiles = files; + } } const run = cp.spawnSync( path.resolve(__dirname, '../node_modules/.bin/mocha'), - testFiles, + [...testFiles, ...flagArgs], { cwd: path.resolve(__dirname, '..'), env, @@ -31,4 +38,4 @@ const run = cp.spawnSync( } ); -process.exit(run.status); \ No newline at end of file +process.exit(run.status); From 5c2479944ec865f4df2bb33935f32af4ba395563 Mon Sep 17 00:00:00 2001 From: Leonardo Bressan Motyczka Date: Tue, 22 Oct 2019 03:00:40 +0000 Subject: [PATCH 3/5] Ensure test-unit fails fast if .only present --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f4a83af..a58f7fe0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint @@ -38,7 +38,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint @@ -56,7 +56,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - yarn test-unit + yarn test-unit --forbid-only displayName: 'Unit tests' - script: | yarn lint From 3ce552cdec206e5e6ee7e5782740e9e90861698c Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 22 Oct 2019 06:33:07 -0700 Subject: [PATCH 4/5] Warn don't throw when open is called on unattached element Related microsoft/vscode#83016 --- src/Terminal.ts | 4 ++++ src/public/Terminal.ts | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Terminal.ts b/src/Terminal.ts index 597c14cd..3e7e55ca 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -508,6 +508,10 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp throw new Error('Terminal requires a parent element.'); } + if (!document.body.contains(parent)) { + this._logService.warn('Terminal.open was called on an element that was not attached to the DOM'); + } + this._document = this._parent.ownerDocument; // Create main element container diff --git a/src/public/Terminal.ts b/src/public/Terminal.ts index fe34cb36..c167bed8 100644 --- a/src/public/Terminal.ts +++ b/src/public/Terminal.ts @@ -56,9 +56,6 @@ export class Terminal implements ITerminalApi { this._core.resize(columns, rows); } public open(parent: HTMLElement): void { - if (!document.body.contains(parent)) { - throw new Error('open must be called on an element that is attached to the DOM'); - } this._core.open(parent); } public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void { From 5e2001f4b57393475d171b2b802e300782cfb7d6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 22 Oct 2019 07:14:32 -0700 Subject: [PATCH 5/5] Space out if --- bin/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/test.js b/bin/test.js index 760908a3..3b08d4a1 100644 --- a/bin/test.js +++ b/bin/test.js @@ -23,7 +23,7 @@ if (process.argv.length > 2) { // ability to inject particular test files via // yarn test [testFileA testFileB ...] files = args.filter(e => !e.startsWith('--')); - if(files.length){ + if (files.length) { testFiles = files; } }