Skip to content

🎥 Make videos programmatically with React

Use a ZIP fixture for the Windows Whisper installation test

Jonny Burger8f4ada1735b9
diff --git a/packages/install-whisper-cpp/src/test/fixtures/whisper.zip b/packages/install-whisper-cpp/src/test/fixtures/whisper.zip
new file mode 100644
index 0000000000..0c4f8b8c76
Binary files /dev/null and b/packages/install-whisper-cpp/src/test/fixtures/whisper.zip differ
diff --git a/packages/install-whisper-cpp/src/test/install-whisper-cpp.test.ts b/packages/install-whisper-cpp/src/test/install-whisper-cpp.test.ts
index 9511683dd9..78609e4707 100644
--- a/packages/install-whisper-cpp/src/test/install-whisper-cpp.test.ts
+++ b/packages/install-whisper-cpp/src/test/install-whisper-cpp.test.ts
@@ -1,13 +1,5 @@
import {expect, spyOn, test} from 'bun:test';
-import {execFileSync} from 'child_process';
-import {
- existsSync,
- mkdirSync,
- mkdtempSync,
- readFileSync,
- rmSync,
- writeFileSync,
-} from 'fs';
+import {existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync} from 'fs';
import os from 'os';
import path from 'path';
import {installWhisperCpp} from '../install-whisper-cpp';
@@ -26,31 +18,12 @@ test.skipIf(process.platform !== 'win32')(
"data [2] $value & 'quote' `tick`",
'whisper.cpp',
);
- const source = path.join(root, 'main.exe');
- const archive = path.join(root, 'fixture.zip');
const executableContents = 'Whisper executable fixture';
const fetchSpy = spyOn(globalThis, 'fetch');
try {
mkdirSync(project);
- writeFileSync(source, executableContents);
- execFileSync(
- 'powershell.exe',
- [
- '-NoProfile',
- '-NonInteractive',
- '-Command',
- 'Compress-Archive -LiteralPath $env:WHISPER_TEST_SOURCE -DestinationPath $env:WHISPER_TEST_ARCHIVE -ErrorAction Stop',
- ],
- {
- env: {
- ...process.env,
- WHISPER_TEST_SOURCE: source,
- WHISPER_TEST_ARCHIVE: archive,
- },
- },
- );
- const zip = readFileSync(archive);
+ const zip = readFileSync(path.join(__dirname, 'fixtures', 'whisper.zip'));
fetchSpy.mockResolvedValue(
new Response(new Uint8Array(zip).buffer, {
headers: {'content-length': String(zip.length)},