From 01d1ea52e639615c4513689ce66576829438f748 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 26 Nov 2021 08:56:58 +0100 Subject: [PATCH] tests - skip flaky in node.js env (#137853) --- src/vs/base/common/platform.ts | 6 +++++- .../contrib/testing/test/common/testResultService.test.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts index 723d1c3ed31..aa1e3dc4e1a 100644 --- a/src/vs/base/common/platform.ts +++ b/src/vs/base/common/platform.ts @@ -11,6 +11,7 @@ let _isLinux = false; let _isLinuxSnap = false; let _isNative = false; let _isWeb = false; +let _isElectron = false; let _isIOS = false; let _locale: string | undefined = undefined; let _language: string = LANGUAGE_DEFAULT; @@ -61,7 +62,8 @@ if (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== ' nodeProcess = process; } -const isElectronRenderer = typeof nodeProcess?.versions?.electron === 'string' && nodeProcess.type === 'renderer'; +const isElectronProcess = typeof nodeProcess?.versions?.electron === 'string'; +const isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer'; export const isElectronSandboxed = isElectronRenderer && nodeProcess?.sandboxed; interface INavigator { @@ -89,6 +91,7 @@ else if (typeof nodeProcess === 'object') { _isMacintosh = (nodeProcess.platform === 'darwin'); _isLinux = (nodeProcess.platform === 'linux'); _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION']; + _isElectron = isElectronProcess; _locale = LANGUAGE_DEFAULT; _language = LANGUAGE_DEFAULT; const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG']; @@ -140,6 +143,7 @@ export const isMacintosh = _isMacintosh; export const isLinux = _isLinux; export const isLinuxSnap = _isLinuxSnap; export const isNative = _isNative; +export const isElectron = _isElectron; export const isWeb = _isWeb; export const isIOS = _isIOS; export const platform = _platform; diff --git a/src/vs/workbench/contrib/testing/test/common/testResultService.test.ts b/src/vs/workbench/contrib/testing/test/common/testResultService.test.ts index 2022a47b7f9..49965171530 100644 --- a/src/vs/workbench/contrib/testing/test/common/testResultService.test.ts +++ b/src/vs/workbench/contrib/testing/test/common/testResultService.test.ts @@ -18,6 +18,7 @@ import { TestResultService } from 'vs/workbench/contrib/testing/common/testResul import { InMemoryResultStorage, ITestResultStorage } from 'vs/workbench/contrib/testing/common/testResultStorage'; import { Convert, getInitializedMainTestCollection, TestItemImpl, testStubs } from 'vs/workbench/contrib/testing/common/testStubs'; import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices'; +import { isNative, isElectron } from 'vs/base/common/platform'; export const emptyOutputController = () => new LiveOutputController( new Lazy(() => [newWriteableBufferStream(), Promise.resolve()]), @@ -311,7 +312,11 @@ suite('Workbench - Test Results Service', () => { }); }); - test('resultItemParents', () => { + test('resultItemParents', function () { + if (isNative && !isElectron) { + this.skip(); // TODO@connor4312 https://github.com/microsoft/vscode/issues/137853 + } + assert.deepStrictEqual([...resultItemParents(r, r.getStateById(new TestId(['ctrlId', 'id-a', 'id-aa']).toString())!)], [ r.getStateById(new TestId(['ctrlId', 'id-a', 'id-aa']).toString()), r.getStateById(new TestId(['ctrlId', 'id-a']).toString()),