-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
332b127
commit 5792887
Showing
12 changed files
with
64 additions
and
2 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
12 changes: 12 additions & 0 deletions
12
packages/rspack-test-tools/tests/configCases/target/async-node/index.js
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,12 @@ | ||
const fs = require("fs"); | ||
|
||
it("basic", () => { | ||
const os = require("os"); | ||
const cpus = os.cpus(); | ||
expect(cpus.length).toBeGreaterThan(0); | ||
}); | ||
|
||
it("format", () => { | ||
const content = fs.readFileSync(__filename, "utf-8"); | ||
expect(content).toMatch(/.cpus/); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/target/async-node/webpack.config.js
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 = { | ||
target: "async-node" | ||
}; |
8 changes: 8 additions & 0 deletions
8
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/cjs.js
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,8 @@ | ||
const cjs = require("./lib/cjs"); | ||
const esm = require("./lib/esm"); | ||
|
||
exports.getFilePath = async function () { | ||
const cjsLib = await cjs.getFilePath(); | ||
const esmLib = await esm.getFilePath(); | ||
return ["cjs.js", cjsLib, esmLib].join("|"); | ||
}; |
8 changes: 8 additions & 0 deletions
8
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/esm.js
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,8 @@ | ||
import cjs from "./lib/cjs"; | ||
import { getFilePath as esmGetFilePath } from "./lib/esm"; | ||
|
||
export async function getFilePath() { | ||
const cjsLib = await cjs.getFilePath(); | ||
const esmLib = await esmGetFilePath(); | ||
return ["esm.js", cjsLib, esmLib].join("|"); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/index.js
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,7 @@ | ||
const cjs = require("./cjs"); | ||
const esm = require("./esm"); | ||
|
||
it("should mix cjs and esm works", async () => { | ||
expect(await cjs.getFilePath()).toBe("cjs.js|lib/cjs.js|lib/esm.js"); | ||
expect(await esm.getFilePath()).toBe("esm.js|lib/cjs.js|lib/esm.js"); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/lib/cjs.js
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 @@ | ||
exports.getFilePath = async function () { | ||
return "lib/cjs.js"; | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/lib/esm.js
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 async function getFilePath() { | ||
return "lib/esm.js"; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/target/mix-cjs-esm/webpack.config.js
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 = { | ||
target: ["node", "es5"] | ||
}; |
12 changes: 12 additions & 0 deletions
12
packages/rspack-test-tools/tests/configCases/target/node/index.js
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,12 @@ | ||
const fs = require("fs"); | ||
|
||
it("basic", () => { | ||
const os = require("os"); | ||
const cpus = os.cpus(); | ||
expect(cpus.length).toBeGreaterThan(0); | ||
}); | ||
|
||
it("format", () => { | ||
const content = fs.readFileSync(__filename, "utf-8"); | ||
expect(content).toMatch(/.cpus/); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/target/node/webpack.config.js
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 = { | ||
target: "node" | ||
}; |
2 changes: 1 addition & 1 deletion
2
webpack-test/configCases/container/0-container-full/webpack.config.js
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