diff --git a/scripts/generate-constants.ts b/scripts/generate-constants.ts index 6004adb6f..4da51b7dc 100644 --- a/scripts/generate-constants.ts +++ b/scripts/generate-constants.ts @@ -13,10 +13,12 @@ const ui = ora('Generate constants file').start(); config({ path: resolve(__dirname, '../.env') }); +const segmentKey = process.env.SEGMENT_KEY || 'test-segment-key'; + (async () => { await writeFile( `${ROOT_DIR}/constants.json`, - JSON.stringify({ segmentKey: process.env.SEGMENT_KEY }, null, 2), + JSON.stringify({ segmentKey }, null, 2), ); ui.succeed('The constants file has been generated'); })().catch((error) => { diff --git a/src/test/suite/index.ts b/src/test/suite/index.ts index 35b007469..e3bbec7dd 100644 --- a/src/test/suite/index.ts +++ b/src/test/suite/index.ts @@ -7,6 +7,10 @@ import MDBExtensionController from '../../mdbExtensionController'; import { ExtensionContextStub } from './stubs'; import { mdbTestExtension } from './stubbableMdbExtension'; +if (!process.env.SEGMENT_KEY) { + process.env.SEGMENT_KEY = 'test-segment-key'; +} + export async function run(): Promise { const reporterOptions = { spec: '-',