mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-03-25 09:25:47 +00:00
✅ **Merge Conflicts Resolved** - Merged latest changes from main branch - Resolved conflicts in docs/spec.md by keeping comprehensive specification - Added PEEKABOO_CLI_TIMEOUT environment variable documentation 🧪 **Test Suite Updates for Linux Compatibility** - Added platform-specific test skipping for Swift-dependent tests - Created tests/setup.ts for global test configuration - Updated vitest.config.ts with platform detection - Modified integration tests to skip on non-macOS platforms: - tests/integration/peekaboo-cli-integration.test.ts - tests/integration/image-tool.test.ts - tests/integration/analyze-tool.test.ts 📦 **New Test Scripts** - `npm run test:unit` - Run only unit tests (any platform) - `npm run test:typescript` - Run TypeScript tests, skip Swift (Linux-friendly) - `npm run test:typescript:watch` - Watch mode for TypeScript-only tests 🌍 **Platform Support** - **macOS**: All tests run (unit + integration + Swift) - **Linux/CI**: Only TypeScript tests run (Swift tests auto-skipped) - **Environment Variables**: - `SKIP_SWIFT_TESTS=true` - Force skip Swift tests - `CI=true` - Auto-skip Swift tests in CI 📚 **Documentation Updates** - Added comprehensive testing section to README.md - Documented platform-specific test behavior - Added environment variable documentation for test control This allows the TypeScript parts of Peekaboo to be tested on Linux while maintaining full test coverage on macOS.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
/**
|
|
* Global test setup for platform-specific test skipping
|
|
* This file is loaded before all tests run
|
|
*/
|
|
|
|
// Make platform information available globally for tests
|
|
declare global {
|
|
var isSwiftBinaryAvailable: boolean;
|
|
var shouldSkipSwiftTests: boolean;
|
|
}
|
|
|
|
// Helper function to determine if Swift binary is available
|
|
const isSwiftBinaryAvailable = () => {
|
|
// On macOS, we expect the Swift binary to be available
|
|
// On other platforms (like Linux), we skip Swift-dependent tests
|
|
return process.platform === "darwin";
|
|
};
|
|
|
|
// Helper function to determine if we should skip Swift-dependent tests
|
|
const shouldSkipSwiftTests = () => {
|
|
// Skip Swift tests if:
|
|
// 1. Not on macOS (Swift binary not available)
|
|
// 2. In CI environment (to avoid flaky tests)
|
|
// 3. SKIP_SWIFT_TESTS environment variable is set
|
|
return (
|
|
process.platform !== "darwin" ||
|
|
process.env.CI === "true" ||
|
|
process.env.SKIP_SWIFT_TESTS === "true"
|
|
);
|
|
};
|
|
|
|
// Make these available globally
|
|
globalThis.isSwiftBinaryAvailable = isSwiftBinaryAvailable();
|
|
globalThis.shouldSkipSwiftTests = shouldSkipSwiftTests();
|
|
|
|
// Log platform information for debugging
|
|
console.log(`Test setup: Platform=${process.platform}, Swift available=${globalThis.isSwiftBinaryAvailable}, Skip Swift tests=${globalThis.shouldSkipSwiftTests}`);
|
|
|