Skip to content

Commit

Permalink
test: update test to include v2_routeConvention error message
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <logan@mcan.sh>
  • Loading branch information
mcansh committed Mar 1, 2023
1 parent b997cf1 commit 82b723e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/remix-dev/__tests__/create-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import stripAnsi from "strip-ansi";

import { run } from "../cli/run";
import { server } from "./msw";
import { flatRoutesWarning } from "../config";

beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
afterAll(() => server.close());
Expand Down Expand Up @@ -347,7 +348,9 @@ describe("the create command", () => {
"--no-typescript",
]);
expect(output.trim()).toBe(
getOptOutOfInstallMessage() +
flatRoutesWarning +
"\n\n" +
getOptOutOfInstallMessage() +
"\n\n" +
getSuccessMessage(path.join("<TEMP_DIR>", "template-to-js"))
);
Expand Down
7 changes: 3 additions & 4 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,7 @@ export async function readConfig(
if (appConfig.future?.v2_routeConvention) {
routesConvention = flatRoutes;
} else {
warnOnce(
"The old route convention has been deprecated in favor of 'flat routes'. Please enable it via your remix.config https://remix.run/docs/en/main/file-conventions/route-files-v2",
"v2_routeConvention"
);
warnOnce(flatRoutesWarning, "v2_routeConvention");
routesConvention = defineConventionalRoutes;
}

Expand Down Expand Up @@ -729,3 +726,5 @@ let listFormat = new Intl.ListFormat("en", {
style: "long",
type: "conjunction",
});

export let flatRoutesWarning = `The old route convention has been deprecated in favor of "flat routes". Please enable it via your remix.config https://remix.run/docs/en/main/file-conventions/route-files-v2`;

0 comments on commit 82b723e

Please sign in to comment.