Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): add back default storage mounts #2853

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/core/config/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type {

import { NitroDefaults } from "./defaults";

import { resolveAssetsOptions } from "./resolvers/assets";
// Resolvers
import { resolveAssetsOptions } from "./resolvers/assets";
import {
fallbackCompatibilityDate,
resolveCompatibilityOptions,
Expand All @@ -25,6 +25,7 @@ import { resolveOpenAPIOptions } from "./resolvers/open-api";
import { resolvePathOptions } from "./resolvers/paths";
import { resolveRouteRulesOptions } from "./resolvers/route-rules";
import { resolveRuntimeConfigOptions } from "./resolvers/runtime-config";
import { resolveStorageOptions } from "./resolvers/storage";
import { resolveURLOptions } from "./resolvers/url";

const configResolvers = [
Expand All @@ -39,6 +40,7 @@ const configResolvers = [
resolveOpenAPIOptions,
resolveURLOptions,
resolveAssetsOptions,
resolveStorageOptions,
] as const;

export async function loadOptions(
Expand Down
6 changes: 6 additions & 0 deletions test/fixture/api/storage/src.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default defineEventHandler(async (event) => {
const storage = useStorage();
return {
keys: await storage.getKeys("src"),
};
});
6 changes: 6 additions & 0 deletions test/presets/nitro-dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ describe.skipIf(isCI)("nitro:preset:nitro-dev", async () => {
expect(status).toBe(200);
});

it("dev storage", async () => {
const { data } = await callHandler({ url: "/api/storage/src" });
expect(data.keys.length).toBeGreaterThan(0);
expect(data.keys).includes("src:nitro.config.ts");
});

describe("openAPI", () => {
let spec: OpenAPI3;
it("/_openapi.json", async () => {
Expand Down
5 changes: 4 additions & 1 deletion test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ type TestHandler = (options: any) => Promise<TestHandlerResult | Response>;
export function testNitro(
ctx: Context,
getHandler: () => TestHandler | Promise<TestHandler>,
additionalTests?: (ctx: Context, callHandler: TestHandler) => void
additionalTests?: (
ctx: Context,
callHandler: (options: any) => Promise<TestHandlerResult>
) => void
) {
let _handler: TestHandler;

Expand Down