diff --git a/transcript-orchestration/functions/audio-transcoder/tests/unit/app.test.ts b/transcript-orchestration/functions/audio-transcoder/tests/unit/app.test.ts index 8f4756a..ac8bb61 100644 --- a/transcript-orchestration/functions/audio-transcoder/tests/unit/app.test.ts +++ b/transcript-orchestration/functions/audio-transcoder/tests/unit/app.test.ts @@ -7,7 +7,7 @@ import { sdkStreamMixin } from '@aws-sdk/util-stream-node' import { S3Client, PutObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3' import { mockedContext } from '../../../mock-utils/lambda-context' import { test, expect, vi } from 'vitest' -process.env.BUCKET_NAME = 'test-bucket' + import * as app from '../../app' import * as transcode from '../../transcode' diff --git a/transcript-orchestration/functions/lib/envs.ts b/transcript-orchestration/functions/lib/envs.ts index 8d077cc..5eaf625 100644 --- a/transcript-orchestration/functions/lib/envs.ts +++ b/transcript-orchestration/functions/lib/envs.ts @@ -8,7 +8,7 @@ interface Environment { * This eliminates the need to check the existence of each environment variable where it is used. */ const envProxy: Environment = new Proxy({}, { - get(target: Record, name: string): string { + get(_target: Record, name: string): string { const value = process.env[name] if (!value) { throw new Error(`Environment variable ${name} is not set`) diff --git a/transcript-orchestration/functions/s3-keys/tests/unit/app.test.ts b/transcript-orchestration/functions/s3-keys/tests/unit/app.test.ts index b6c10a3..908d516 100644 --- a/transcript-orchestration/functions/s3-keys/tests/unit/app.test.ts +++ b/transcript-orchestration/functions/s3-keys/tests/unit/app.test.ts @@ -1,8 +1,6 @@ import { test, expect } from 'vitest' import { handleEvent, S3KeysEvent } from '../../app' -process.env.BUCKET_NAME = 'test-bucket' - const testState: { options?: S3KeysEvent } = {} test('constructs keys from audio input key', async (t) => { diff --git a/transcript-orchestration/functions/transcript-processor/tests/unit/app.test.ts b/transcript-orchestration/functions/transcript-processor/tests/unit/app.test.ts index cfb56c5..8cf8a5c 100644 --- a/transcript-orchestration/functions/transcript-processor/tests/unit/app.test.ts +++ b/transcript-orchestration/functions/transcript-processor/tests/unit/app.test.ts @@ -10,7 +10,6 @@ import { test, assert } from 'vitest' import { VocabularySubstitutions } from '../../vocabulary' import { MergedTranscript } from '../../types' -process.env.BUCKET_NAME = 'test-bucket' import { handleEvent } from '../../app' const mockS3 = mockClient(S3Client) diff --git a/transcript-orchestration/tests/setup.ts b/transcript-orchestration/tests/setup.ts new file mode 100644 index 0000000..8ebed04 --- /dev/null +++ b/transcript-orchestration/tests/setup.ts @@ -0,0 +1,3 @@ +export function setup () { + process.env.BUCKET_NAME = 'test-bucket' +} \ No newline at end of file diff --git a/transcript-orchestration/vite.config.ts b/transcript-orchestration/vite.config.ts index 9ec3981..5a75c20 100644 --- a/transcript-orchestration/vite.config.ts +++ b/transcript-orchestration/vite.config.ts @@ -2,6 +2,9 @@ import { defineConfig, defaultExclude } from 'vitest/config' export default defineConfig({ test: { + globalSetup: [ + './tests/setup.ts' + ], coverage: { reporter: ['text', 'html', 'lcov'], exclude: [