-
-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd0cdc1
commit dde3676
Showing
26 changed files
with
212 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,6 @@ | |
"tokio", | ||
"ukey", | ||
"Ukey" | ||
] | ||
], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
53 changes: 30 additions & 23 deletions
53
packages/playground/cases/context/delete-file/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
import { test, expect } from "@/fixtures"; | ||
|
||
|
||
test("delete file should work", async ({ page, request, fileAction, rspack }) => { | ||
// asset page status | ||
const statusText = await page.textContent("#root"); | ||
expect(statusText).toBe('__PAGE_RENDER__'); | ||
// asset script content | ||
const response = await request.get(`http://localhost:${rspack.devServer.options.port}/main.js`); | ||
const bodyResponse = (await response.body()).toString(); | ||
expect(bodyResponse).toContain('this is mod1'); | ||
expect(bodyResponse).toContain('this is mod2'); | ||
// mock file delete action | ||
fileAction.deleteFile("src/mod1.js"); | ||
await rspack.waitingForHmr(async () => { | ||
// ensure page status changed | ||
const statusText = await page.textContent("#root"); | ||
return statusText === "__HMR_UPDATED__"; | ||
}); | ||
// asset new script content | ||
const responseAfterDelete = await request.get(`http://localhost:${rspack.devServer.options.port}/main.js`); | ||
const bodyResponseAfterDelete = (await responseAfterDelete.body()).toString(); | ||
expect(bodyResponseAfterDelete).not.toContain('this is mod1'); | ||
expect(bodyResponseAfterDelete).toContain('this is mod2'); | ||
test("delete file should work", async ({ | ||
page, | ||
request, | ||
fileAction, | ||
rspack | ||
}) => { | ||
// asset page status | ||
const statusText = await page.textContent("#root"); | ||
expect(statusText).toBe("__PAGE_RENDER__"); | ||
// asset script content | ||
const response = await request.get( | ||
`http://localhost:${rspack.devServer.options.port}/main.js` | ||
); | ||
const bodyResponse = (await response.body()).toString(); | ||
expect(bodyResponse).toContain("this is mod1"); | ||
expect(bodyResponse).toContain("this is mod2"); | ||
// mock file delete action | ||
fileAction.deleteFile("src/mod1.js"); | ||
await rspack.waitingForHmr(async () => { | ||
// ensure page status changed | ||
const statusText = await page.textContent("#root"); | ||
return statusText === "__HMR_UPDATED__"; | ||
}); | ||
// asset new script content | ||
const responseAfterDelete = await request.get( | ||
`http://localhost:${rspack.devServer.options.port}/main.js` | ||
); | ||
const bodyResponseAfterDelete = (await responseAfterDelete.body()).toString(); | ||
expect(bodyResponseAfterDelete).not.toContain("this is mod1"); | ||
expect(bodyResponseAfterDelete).toContain("this is mod2"); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.