Skip to content

Commit 1548216

Browse files
committed
feat: add rslib adapter
1 parent c7b4ec1 commit 1548216

4 files changed

Lines changed: 50 additions & 10 deletions

File tree

packages/rstack/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
},
4141
"devDependencies": {
4242
"@rstest/adapter-rsbuild": "catalog:",
43+
"@rstest/adapter-rslib": "catalog:",
4344
"@types/node": "catalog:",
4445
"lint-staged": "catalog:",
4546
"typescript": "catalog:"

packages/rstack/src/rstestConfig.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,27 @@ const extendsConfig = async (testConfig: RstestConfig, params: ConfigParams) =>
99

1010
const appConfig = getConfig('app');
1111
if (appConfig) {
12-
const { toRstestConfig } = await import(
12+
const { withRsbuildConfig } = await import(
1313
/* rspackChunkName: 'adapterRsbuild' */
1414
'@rstest/adapter-rsbuild'
1515
);
16-
const rsbuildConfig = typeof appConfig === 'function' ? await appConfig(params) : appConfig;
16+
const config = typeof appConfig === 'function' ? await appConfig(params) : appConfig;
1717

18-
testConfig.extends = toRstestConfig({
19-
rsbuildConfig,
18+
testConfig.extends = withRsbuildConfig({
19+
config,
20+
});
21+
}
22+
23+
const libConfig = getConfig('lib');
24+
if (libConfig) {
25+
const { withRslibConfig } = await import(
26+
/* rspackChunkName: 'adapterRslib' */
27+
'@rstest/adapter-rslib'
28+
);
29+
const config = typeof libConfig === 'function' ? await libConfig(params) : libConfig;
30+
31+
testConfig.extends = withRslibConfig({
32+
config,
2033
});
2134
}
2235

pnpm-lock.yaml

Lines changed: 30 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ catalog:
1616
'@rsbuild/plugin-react': '^2.1.0'
1717
'@rslib/core': '^0.23.1'
1818
'@rslint/core': '^0.6.3'
19-
'@rstest/adapter-rsbuild': '^0.10.6'
19+
'@rstest/adapter-rsbuild': 'https://pkg.pr.new/@rstest/adapter-rsbuild@880348c'
20+
'@rstest/adapter-rslib': 'https://pkg.pr.new/@rstest/adapter-rslib@880348c'
2021
'@rstest/core': '^0.10.6'
2122
'@testing-library/dom': '^10.4.1'
2223
'@testing-library/jest-dom': '^6.9.1'

0 commit comments

Comments
 (0)