Skip to content

Commit

Permalink
chore: migrate normal cases
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Apr 23, 2024
1 parent 29581af commit 5100f94
Show file tree
Hide file tree
Showing 366 changed files with 7 additions and 692 deletions.
3 changes: 2 additions & 1 deletion packages/rspack-test-tools/jest.config.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
"<rootDir>/tests/Defaults.unittest.js",
"<rootDir>/tests/Stats.unittest.js",
"<rootDir>/tests/TreeShaking.test.js",
"<rootDir>/tests/ConfigTestCases.basictest.js"
"<rootDir>/tests/ConfigTestCases.basictest.js",
"<rootDir>/tests/TestCasesNormal.basictest.js"
]
};
1 change: 1 addition & 0 deletions packages/rspack-test-tools/jest.config.legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
"Builtin.test.js",
"HotTestStepWeb.test.js",
"ConfigTestCases.basictest.js",
"TestCasesNormal.basictest.js",
".difftest.js"
]
};
2 changes: 1 addition & 1 deletion packages/rspack-test-tools/src/case/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const creator = new BasicCaseCreator({
steps: ({ name }) => [
new RspackNormalProcessor({
name,
root: path.resolve(__dirname, "../../../rspack/tests/cases"),
root: path.resolve(__dirname, "../../tests/cases"),
compilerOptions: {}, // do not used in rspack
runable: true
})
Expand Down
11 changes: 0 additions & 11 deletions packages/rspack-test-tools/src/processor/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { BasicTaskProcessor } from "./basic";
import path from "path";
import fs from "fs";

const CWD = process.cwd();

export interface IRspackNormalProcessorOptions {
name: string;
root: string;
Expand All @@ -33,15 +31,6 @@ export class RspackNormalProcessor extends BasicTaskProcessor<ECompilerType.Rspa
});
}

async before(context: ITestContext) {
//TODO: remove this
process.chdir(path.resolve(__dirname, "../../../rspack"));
}

async after(context: ITestContext) {
process.chdir(CWD);
}

static defaultOptions({
compilerOptions,
root
Expand Down
6 changes: 3 additions & 3 deletions packages/rspack-test-tools/tests/TestCasesNormal.basictest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const path = require("path");
const { describeByWalk, createNormalCase } = require("..");

const NAME = "TestCases";
const caseDir = path.resolve(__dirname, "../../rspack/tests/cases");
const distDir = path.resolve(__dirname, `../../rspack/tests/js/normal`);
const caseDir = path.resolve(__dirname, "./cases");
const distDir = path.resolve(__dirname, `./js/normal`);

describeByWalk(NAME, caseDir, distDir, (name, src, dist) => {
createNormalCase(name, src, dist, path.resolve(__dirname, "../../rspack"));
createNormalCase(name, src, dist);
});
Loading

0 comments on commit 5100f94

Please sign in to comment.