From 18d292e2740c6c4c7674e4cc0b27e2f034ba15b6 Mon Sep 17 00:00:00 2001 From: Sparticuz Date: Tue, 27 Sep 2022 11:48:34 -0400 Subject: [PATCH] Add another headless check --- source/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/index.ts b/source/index.ts index ca5192e..cf41a79 100644 --- a/source/index.ts +++ b/source/index.ts @@ -209,13 +209,16 @@ class Chromium { /** * Returns a boolean indicating if we are running on AWS Lambda or Google Cloud Functions. + * True is returned if the NODE_ENV is set to 'test' for easier integration testing. * False is returned if Serverless environment variables `IS_LOCAL` or `IS_OFFLINE` are set. */ static get headless() { if (process.env.IS_LOCAL !== undefined || process.env.IS_OFFLINE !== undefined) { return false; } - + if (process.env.NODE_ENV === "test") { + return true; + } const environments = [ 'AWS_LAMBDA_FUNCTION_NAME', 'FUNCTION_NAME',