spec: fix check for electron_common_testing binding in logging-spec.ts (#30086)

This commit is contained in:
Milan Burda 2021-07-13 07:11:19 +02:00 committed by GitHub
parent 19a6286dfd
commit 9959f01e4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,8 +7,17 @@ import * as fs from 'fs/promises';
import * as path from 'path'; import * as path from 'path';
import * as uuid from 'uuid'; 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. // 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 () => { it('does not log by default', async () => {
// ELECTRON_ENABLE_LOGGING is turned on in the appveyor config. // ELECTRON_ENABLE_LOGGING is turned on in the appveyor config.
const { ELECTRON_ENABLE_LOGGING: _, ...envWithoutEnableLogging } = process.env; const { ELECTRON_ENABLE_LOGGING: _, ...envWithoutEnableLogging } = process.env;