-
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): failed to run preview with TS config file (#9468)
* fix(CLI): failed to run preview with ts config file * fix: port
- Loading branch information
1 parent
9cf027f
commit fa2bae1
Showing
11 changed files
with
154 additions
and
72 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
getRandomPort, | ||
normalizeStderr, | ||
runWatch | ||
} from "../../utils/test-utils"; | ||
|
||
describe("should run preview command as expected", () => { | ||
it("should work", async () => { | ||
const port = await getRandomPort(); | ||
const { stderr } = await runWatch( | ||
__dirname, | ||
["preview", "--port", port.toString()], | ||
{ | ||
killString: /localhost/ | ||
} | ||
); | ||
|
||
expect(normalizeStderr(stderr)).toContain("Project is running at"); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
mode: "production" | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("hello world"); |
20 changes: 20 additions & 0 deletions
20
packages/rspack-cli/tests/preview/ts-config-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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
getRandomPort, | ||
normalizeStderr, | ||
runWatch | ||
} from "../../utils/test-utils"; | ||
|
||
describe("should run preview command with ts config file as expected", () => { | ||
it("should work", async () => { | ||
const port = await getRandomPort(); | ||
const { stderr } = await runWatch( | ||
__dirname, | ||
["preview", "--port", port.toString()], | ||
{ | ||
killString: /localhost/ | ||
} | ||
); | ||
|
||
expect(normalizeStderr(stderr)).toContain("Project is running at"); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/rspack-cli/tests/preview/ts-config-file/rspack.config.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
mode: "production" | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("hello world"); |
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
fa2bae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
fa2bae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ecosystem CI detail: Open