mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-04-25 15:22:06 +00:00
Since the project's inception, I've missed a clear separation between default and third-party modules. This increases complexity within the project (exclude `modules`, but not `modules/default`), but the mixed use is particularly problematic in Docker setups. Therefore, with this pull request, I'm moving the default modules to a different directory. ~~I've chosen `default/modules`, but I'm not bothered about it; `defaultmodules` or something similar would work just as well.~~ Changed to `defaultmodules`. Let me know if there's a majority in favor of this change.
104 lines
2.3 KiB
JavaScript
104 lines
2.3 KiB
JavaScript
import { defineConfig } from "vitest/config";
|
|
|
|
/*
|
|
* Sequential execution keeps our shared test server stable:
|
|
* - All suites bind to port 8080
|
|
* - Fixtures and temp paths are reused between tests
|
|
* - Debugging becomes predictable
|
|
*
|
|
* Parallel execution would require dynamic ports and isolated fixtures,
|
|
* so we intentionally cap Vitest at a single worker for now.
|
|
*
|
|
* Projects separate unit, e2e (Playwright), and electron tests with
|
|
* appropriate timeouts for each test type.
|
|
*/
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// Shared settings for all test types
|
|
globals: true,
|
|
environment: "node",
|
|
setupFiles: ["./tests/utils/vitest-setup.js"],
|
|
// Stop test execution on first failure
|
|
bail: 3,
|
|
|
|
// Shared exclude patterns
|
|
exclude: [
|
|
"**/node_modules/**",
|
|
"**/dist/**",
|
|
"tests/unit/mocks/**",
|
|
"tests/unit/helpers/**",
|
|
"tests/electron/helpers/**",
|
|
"tests/e2e/helpers/**",
|
|
"tests/e2e/mocks/**",
|
|
"tests/configs/**",
|
|
"tests/utils/**"
|
|
],
|
|
|
|
// Projects with specific configurations per test type
|
|
projects: [
|
|
{
|
|
test: {
|
|
name: "unit",
|
|
globals: true,
|
|
environment: "node",
|
|
setupFiles: ["./tests/utils/vitest-setup.js"],
|
|
include: [
|
|
"tests/unit/**/*_spec.js",
|
|
"tests/unit/defaultmodules/calendar/calendar_fetcher_utils_bad_rrule.js"
|
|
],
|
|
testTimeout: 20000,
|
|
hookTimeout: 10000
|
|
}
|
|
},
|
|
{
|
|
test: {
|
|
name: "e2e",
|
|
globals: true,
|
|
environment: "node",
|
|
setupFiles: ["./tests/utils/vitest-setup.js"],
|
|
include: ["tests/e2e/**/*_spec.js"],
|
|
testTimeout: 60000,
|
|
hookTimeout: 30000
|
|
}
|
|
},
|
|
{
|
|
test: {
|
|
name: "electron",
|
|
globals: true,
|
|
environment: "node",
|
|
setupFiles: ["./tests/utils/vitest-setup.js"],
|
|
include: ["tests/electron/**/*_spec.js"],
|
|
testTimeout: 120000,
|
|
hookTimeout: 30000
|
|
}
|
|
}
|
|
],
|
|
|
|
// Coverage configuration
|
|
coverage: {
|
|
provider: "v8",
|
|
reporter: ["lcov", "text"],
|
|
include: [
|
|
"clientonly/**/*.js",
|
|
"js/**/*.js",
|
|
"defaultmodules/**/*.js",
|
|
"serveronly/**/*.js"
|
|
],
|
|
exclude: [
|
|
"**/node_modules/**",
|
|
"**/tests/**",
|
|
"**/dist/**"
|
|
]
|
|
},
|
|
|
|
/*
|
|
* Pool settings for isolated test execution. Keep maxWorkers at 1 so
|
|
* port 8080 and shared fixtures remain safe across the full suite.
|
|
*/
|
|
pool: "forks",
|
|
maxWorkers: 1,
|
|
isolate: true
|
|
}
|
|
});
|