Skip to content

Commit

Permalink
chore: migrate compat case (#6353)
Browse files Browse the repository at this point in the history
chore: migrate remain compat cases
  • Loading branch information
LingyuCoder authored Apr 24, 2024
1 parent 9e5a265 commit bc61872
Show file tree
Hide file tree
Showing 154 changed files with 472 additions and 636 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-ng.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Test new runner
run: |
set -e;
OUTPUT=$((pnpm run test:ng --no-colors --silent=true --force-exit 2>&1 && echo "Test new runner successed" || echo "Test new runner failed") | tail --bytes=50000)
OUTPUT=$((pnpm run test --no-colors --silent=true --force-exit 2>&1 && echo "Test new runner successed" || echo "Test new runner failed") | tail --bytes=50000)
echo 'RESULT<<EOF' >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
Expand Down
12 changes: 1 addition & 11 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,10 @@ packages/rspack/src/config/schema.check.js

packages/**/etc/**/*
packages/rspack/tests/fixtures/**/*
packages/rspack/tests/statsCases/**/*
packages/rspack/tests/cases/**/*
packages/rspack/tests/configCases/**/*
packages/rspack/tests/hotCases/**/*
packages/rspack/tests/diagnostics/**/*
packages/rspack/tests/js/**/*
packages/rspack/tests/copyPlugin/build/**/*
packages/rspack-test-tools/template/**/*
packages/rspack-test-tools/tests/statsCases/**/*
packages/rspack-test-tools/tests/cases/**/*
packages/rspack-test-tools/tests/configCases/**/*
packages/rspack-test-tools/tests/hotCases/**/*
packages/rspack-test-tools/tests/diagnostics/**/*
packages/rspack-test-tools/tests/js/**/*
packages/rspack-test-tools/tests/**/*
packages/rspack/tests/cases/parsing/issue-5120-binding/fail.js
packages/rspack/tests/diagnostics/module-parse-failed/lexically_name_error/index.js
packages/rspack-plugin-mini-css-extract/test/cases/**/*
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"test:diff": "pnpm --filter \"@rspack/*\" test:diff",
"test:hot": "pnpm --filter \"@rspack/*\" test:hot",
"test:unit": "pnpm --filter \"@rspack/*\" test",
"test:ng": "pnpm --filter \"@rspack/*\" test:ng",
"test:e2e": "pnpm --filter \"@rspack-e2e/*\" test",
"test:ci": "cross-env NODE_OPTIONS=--max_old_space_size=8192 pnpm run build:js && pnpm run test:unit && pnpm test:webpack",
"test:webpack": "pnpm --filter \"webpack-test\" test:metric",
Expand Down
4 changes: 0 additions & 4 deletions packages/rspack-test-tools/etc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,6 @@ export class StatsAPITaskProcessor<T extends ECompilerType> extends SimpleTaskPr
// (undocumented)
static addSnapshotSerializer(): void;
// (undocumented)
after(context: ITestContext): Promise<void>;
// (undocumented)
before(context: ITestContext): Promise<void>;
// (undocumented)
check(env: ITestEnv, context: ITestContext): Promise<void>;
// (undocumented)
compiler(context: ITestContext): Promise<void>;
Expand Down
21 changes: 0 additions & 21 deletions packages/rspack-test-tools/jest.config.compat.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/rspack-test-tools/jest.config.hot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ const config = require("./jest.config");
/** @type {import('jest').Config} */
module.exports = {
...config,
testMatch: ["<rootDir>/tests/HotTestStepWeb.test.js"]
testMatch: ["<rootDir>/tests/*.hottest.js"]
};
3 changes: 1 addition & 2 deletions packages/rspack-test-tools/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const config = {
"<rootDir>/tests/*.test.js",
"<rootDir>/tests/*.basictest.js",
"<rootDir>/tests/*.longtest.js",
"<rootDir>/tests/*.unittest.js",
"<rootDir>/tests/*.difftest.js"
"<rootDir>/tests/*.unittest.js"
],
moduleNameMapper: {
// Fixed jest-serialize-path not working when non-ascii code contains.
Expand Down
23 changes: 0 additions & 23 deletions packages/rspack-test-tools/jest.config.legacy.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/rspack-test-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"build:viewer": "rspack build",
"dev:viewer": "rspack serve",
"dev": "tsc -b -w",
"test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.compat.js",
"test:ng": "cross-env SNAPSHOT=legacy NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.legacy.js",
"test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.js",
"test:hot": "cross-env RSPACK_HOT_TEST=true NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.hot.js",
"test:diff": "cross-env RSPACK_DIFF=true NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage --config ./jest.config.diff.js",
"api-extractor": "api-extractor run --verbose",
Expand Down
10 changes: 0 additions & 10 deletions packages/rspack-test-tools/src/processor/stats-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
} from "../type";
import { createFsFromVolume, Volume } from "memfs";
import fs from "fs";
import path from "path";
const serializer = require("jest-serializer-path");
const FAKE_CWD = path.resolve(__dirname, "../../../rspack");
const CWD = process.cwd();

export interface IStatsAPITaskProcessorOptions<T extends ECompilerType> {
options?: (context: ITestContext) => TCompilerOptions<T>;
Expand Down Expand Up @@ -55,13 +52,6 @@ export class StatsAPITaskProcessor<
await this._statsAPIOptions.check?.(stats!, compiler.getCompiler()!);
}

async before(context: ITestContext): Promise<void> {
process.chdir(this._statsAPIOptions.cwd || FAKE_CWD);
}
async after(context: ITestContext): Promise<void> {
process.chdir(CWD);
}

static addSnapshotSerializer() {
expect.addSnapshotSerializer(serializer);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-test-tools/tests/HashTestCases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require("fs");
const { createHashCase } = require("..");

const NAME = "HashTestCases";
const caseDir = path.resolve(__dirname, "../../rspack/tests/hashCases");
const caseDir = path.resolve(__dirname, "./hashCases");

const tests = fs
.readdirSync(caseDir)
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-test-tools/tests/Stats.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require("path");
const fs = require("fs");
const srcDir = path.resolve(__dirname, "../../rspack/tests");
const srcDir = __dirname;
const caseDir = path.resolve(__dirname, "./statsAPICases");
const { StatsAPITaskProcessor, TestContext, ECompilerType } = require("..");

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

const NAME = "WatchTestCases";
const caseDir = path.resolve(__dirname, "../../rspack/tests/watchCases");
const distDir = path.resolve(__dirname, `../../rspack/tests/js/${NAME}`);
const tempDir = path.resolve(__dirname, `../../rspack/tests/js/${NAME}-src`);
const caseDir = path.resolve(__dirname, "./watchCases");
const distDir = path.resolve(__dirname, `./js/${NAME}`);
const tempDir = path.resolve(__dirname, `./js/${NAME}-src`);

describeByWalk(NAME, caseDir, distDir, (name, src, dist) => {
createWatchCase(
Expand Down
Loading

2 comments on commit bc61872

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs, self-hosted, Linux, ci ✅ success
_selftest, ubuntu-latest ✅ success
nx, ubuntu-latest ✅ success
rspress, ubuntu-latest ❌ failure
rsbuild, ubuntu-latest ❌ failure
compat, ubuntu-latest ✅ success
examples, ubuntu-latest ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-04-24 332b127) Current Change
10000_development-mode + exec 2.66 s ± 28 ms 2.7 s ± 32 ms +1.39 %
10000_development-mode_hmr + exec 682 ms ± 3.7 ms 696 ms ± 25 ms +2.12 %
10000_production-mode + exec 2.46 s ± 31 ms 2.62 s ± 47 ms +6.38 %
arco-pro_development-mode + exec 2.48 s ± 86 ms 2.52 s ± 60 ms +1.83 %
arco-pro_development-mode_hmr + exec 429 ms ± 1.2 ms 431 ms ± 2.6 ms +0.44 %
arco-pro_development-mode_hmr_intercept-plugin + exec 441 ms ± 5.4 ms 442 ms ± 3.9 ms +0.40 %
arco-pro_development-mode_intercept-plugin + exec 3.22 s ± 88 ms 3.25 s ± 99 ms +1.00 %
arco-pro_production-mode + exec 3.95 s ± 74 ms 4.01 s ± 72 ms +1.62 %
arco-pro_production-mode_intercept-plugin + exec 4.66 s ± 238 ms 4.79 s ± 129 ms +2.69 %
threejs_development-mode_10x + exec 2.05 s ± 16 ms 2.07 s ± 19 ms +0.86 %
threejs_development-mode_10x_hmr + exec 753 ms ± 13 ms 768 ms ± 32 ms +1.98 %
threejs_production-mode_10x + exec 5.14 s ± 40 ms 5.29 s ± 136 ms +3.06 %

Threshold exceeded: ["10000_production-mode + exec"]

Please sign in to comment.