Skip to content

Commit 7c8b133

Browse files
committed
Investigate tauri test failures
1 parent 550a48e commit 7c8b133

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

packages/tauri/test-runner/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn main() {
1313
config.build.dev_url = Some(Url::parse(&url).expect("Could not parse URL"));
1414
}
1515

16+
println!("Running test tauri application");
1617
tauri::Builder::default()
1718
.plugin(tauri_plugin_powersync::init())
1819
.run(context)

packages/tauri/vitest.config.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as path from 'node:path';
22
import { ChildProcess, spawn, spawnSync } from 'node:child_process';
3+
import { createInterface } from 'node:readline';
34

45
import { defineConfig } from 'vitest/config';
5-
import { preview } from '@vitest/browser-preview'
6+
import { preview } from '@vitest/browser-preview';
67
import { BrowserProvider } from 'vitest/node';
78

89
// We can't define serverFactory ourselves because vitest doesn't export the building blocks,
@@ -27,7 +28,7 @@ class TauriBrowserProvider implements BrowserProvider {
2728
return {};
2829
}
2930

30-
async openPage(_sessionId: string, url: string, _options: { parallel: boolean; }) {
31+
async openPage(_sessionId: string, url: string, _options: { parallel: boolean }) {
3132
if (this.#tauriApp != null) {
3233
throw new Error('TODO: Calling openPage multiple times is not supported');
3334
}
@@ -47,9 +48,18 @@ class TauriBrowserProvider implements BrowserProvider {
4748
}
4849
});
4950

51+
createInterface(app.stdout).on('line', (line) => console.log(`[Test process]: ${line}`));
52+
createInterface(app.stderr).on('line', (line) => console.error(`[Test process]: ${line}`));
53+
5054
await new Promise<void>((resolve, reject) => {
51-
app.once('spawn', () => resolve());
52-
app.once('error', reject);
55+
app.once('spawn', () => {
56+
console.info(`Child process spawned, pid ${app.pid}`);
57+
resolve();
58+
});
59+
app.once('error', (e) => {
60+
console.error('Failed to spawn child process', e);
61+
reject(e);
62+
});
5363
});
5464
}
5565

@@ -78,6 +88,6 @@ export default defineConfig({
7888
browser: 'chrome'
7989
}
8090
]
81-
},
91+
}
8292
}
8393
});

0 commit comments

Comments
 (0)