From 9959f01e4cea8f42827dc4ff27929d7d6cf752ef Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Tue, 13 Jul 2021 07:11:19 +0200 Subject: [PATCH] spec: fix check for electron_common_testing binding in logging-spec.ts (#30086) --- spec-main/logging-spec.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec-main/logging-spec.ts b/spec-main/logging-spec.ts index b3414279761..a98ed4b9532 100644 --- a/spec-main/logging-spec.ts +++ b/spec-main/logging-spec.ts @@ -7,8 +7,17 @@ import * as fs from 'fs/promises'; import * as path from 'path'; import * as uuid from 'uuid'; +function isTestingBindingAvailable () { + try { + process._linkedBinding('electron_common_testing'); + return true; + } catch { + return false; + } +} + // This test depends on functions that are only available when DCHECK_IS_ON. -ifdescribe(process._linkedBinding('electron_common_testing'))('logging', () => { +ifdescribe(isTestingBindingAvailable())('logging', () => { it('does not log by default', async () => { // ELECTRON_ENABLE_LOGGING is turned on in the appveyor config. const { ELECTRON_ENABLE_LOGGING: _, ...envWithoutEnableLogging } = process.env;