mirror of
https://github.com/outline/outline.git
synced 2026-11-28 16:19:46 +03:00
fix(test): restore plugin loading under Vite 8 (#12792)
* fix(test): restore plugin loading under Vite 8 Vite 8 dropped support for extglob negation (`!(...)`) in glob patterns, so the test setup's plugin glob matched zero files and no plugin routes were registered, causing every plugin API test to 404. Use Vite's array-with-negative-patterns syntax to exclude test and schema files. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
da68359292
commit
e646b14225
3 files changed
+23
-11
No files matched your search
Vendored
+10
-1
@@ -6,7 +6,16 @@ declare global {
|
||||
/**
|
||||
* A special feature that allows you to get all matching modules starting from some base directory.
|
||||
*/
|
||||
glob: (pattern: string, option?: { eager: boolean }) => any;
|
||||
glob: {
|
||||
(
|
||||
pattern: string | string[],
|
||||
option: { eager: true }
|
||||
): Record<string, unknown>;
|
||||
(
|
||||
pattern: string | string[],
|
||||
option?: { eager?: false }
|
||||
): Record<string, () => Promise<unknown>>;
|
||||
};
|
||||
}
|
||||
|
||||
interface Window {
|
||||
|
||||
@@ -48,7 +48,7 @@ await import("@server/storage/database");
|
||||
// import.meta.glob to load them through the Vite resolver instead.
|
||||
const { PluginManager } = await import("@server/utils/PluginManager");
|
||||
const pluginModules = import.meta.glob(
|
||||
"../../plugins/*/server/!(*.test|schema).{js,ts}",
|
||||
["../../plugins/*/server/*.{js,ts}", "!**/*.test.*", "!**/schema.*"],
|
||||
{ eager: true }
|
||||
);
|
||||
void pluginModules;
|
||||
|
||||
@@ -14,21 +14,24 @@ import { __setRequireDirectoryCache } from "@server/utils/fs";
|
||||
// they live in.
|
||||
__setRequireDirectoryCache(
|
||||
"emails/templates",
|
||||
import.meta.glob("../emails/templates/!(index|*.test).{js,ts}", {
|
||||
eager: true,
|
||||
})
|
||||
import.meta.glob(
|
||||
["../emails/templates/*.{js,ts,tsx}", "!**/index.*", "!**/*.test.*"],
|
||||
{ eager: true }
|
||||
)
|
||||
);
|
||||
__setRequireDirectoryCache(
|
||||
"queues/processors",
|
||||
import.meta.glob("../queues/processors/!(index|*.test).{js,ts}", {
|
||||
eager: true,
|
||||
})
|
||||
import.meta.glob(
|
||||
["../queues/processors/*.{js,ts,tsx}", "!**/index.*", "!**/*.test.*"],
|
||||
{ eager: true }
|
||||
)
|
||||
);
|
||||
__setRequireDirectoryCache(
|
||||
"queues/tasks",
|
||||
import.meta.glob("../queues/tasks/!(index|*.test).{js,ts}", {
|
||||
eager: true,
|
||||
})
|
||||
import.meta.glob(
|
||||
["../queues/tasks/*.{js,ts,tsx}", "!**/index.*", "!**/*.test.*"],
|
||||
{ eager: true }
|
||||
)
|
||||
);
|
||||
|
||||
vi.mock("ioredis", async () => {
|
||||
|
||||
Reference in new issue
Block a user