Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Jan 9, 2024
1 parent 067e4e3 commit 366a347
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
20 changes: 19 additions & 1 deletion packages/playground/cases/file/missing-files/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { test, expect } from "@/fixtures";

test("missing files", async ({ page, fileAction }) => {
test("missing files should be able to recover if being added back", async ({
page,
fileAction
}) => {
let overlay = page.frameLocator("#webpack-dev-server-client-overlay");
await expect(
overlay.getByText("Can't resolve './missing-file-1'")
Expand All @@ -25,4 +28,19 @@ test("missing files", async ({ page, fileAction }) => {
await expect(page.locator("#missing-file-2")).toHaveText("missing-file-2", {
timeout: 30 * 1000
});

fileAction.deleteFile("src/missing-file-1.js");

await expect(
overlay.getByText("Can't resolve './missing-file-1'")
).toBeVisible();

fileAction.updateFile(
"src/missing-file-1.js",
() => "export const a = 'missing-file-1'"
);

await expect(page.locator("#missing-file-1")).toHaveText("missing-file-1", {
timeout: 30 * 1000
});
});
8 changes: 5 additions & 3 deletions packages/playground/cases/file/missing-files/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// @ts-nocheck
import { a } from "./missing-file-1";
const { b } = require("./missing-file-2");

document.getElementById(
"root"
).innerHTML = `<span id="missing-file-1">${a}</span><span id="missing-file-2">${b}</span>`;
document.getElementById("root").innerHTML = `
<span id="missing-file-1">${a}</span>
<span id="missing-file-2">${b}</span>
`;
4 changes: 0 additions & 4 deletions packages/rspack/src/Watching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,6 @@ export class Watching {
if (err) return handleError(err, cbs);
// @ts-expect-error
this.handler(null, stats);
console.log(
[...compilation.fileDependencies],
[...compilation.missingDependencies]
);

process.nextTick(() => {
if (!this.#closed) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/tests/StatsTestCases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe("StatsTestCases", () => {

expect(statsJson).toMatchSnapshot();
let statsString = stats.toString(statsOptions);
expect(statsString.replace(/\n[ ]+ /, "")).toMatchSnapshot();
expect(replace(statsString)).toMatchSnapshot();
});
});
});

0 comments on commit 366a347

Please sign in to comment.