Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/rstack/rstack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define.test(async () => {
return {
extends: withRslibConfig(),
source: {
tsconfigPath: './test/tsconfig.json',
tsconfigPath: './tests/tsconfig.json',
},
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"#test-helpers": ["./helpers/index.ts"]
}
},
"include": ["./**/*.ts", "../src"]
"include": ["./**/*.ts", "../src"],
"exclude": ["./types"]
}
6 changes: 6 additions & 0 deletions packages/rstack/tests/types/core-types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Verify that `rstack/types` exposes Rsbuild's preset module declarations.
import styles from './style.module.css';

const className: string = styles.root;

export { className };
10 changes: 10 additions & 0 deletions packages/rstack/tests/types/core-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "ES2022",
"moduleResolution": "bundler",
"skipLibCheck": false,
"types": ["rstack/types", "node"]
},
"include": ["index.ts"]
}
24 changes: 24 additions & 0 deletions packages/rstack/tests/types/resolution-bundler/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This folder checks Rstack's exports and APIs with bundler resolution.
import 'rstack/test/globals';
import 'rstack/test/importMeta';
import 'rstack/types';
import { define } from 'rstack';
import { createRsbuild, defineConfig as defineAppConfig } from 'rstack/app';
import { defineConfig as defineLibConfig } from 'rstack/lib';
import { js, ts } from 'rstack/lint';
import { expect as importedExpect, test as importedTest } from 'rstack/test';

const appConfig = defineAppConfig({});
const libConfig = defineLibConfig({});

createRsbuild({ config: appConfig });
define.app(appConfig);
define.lib(libConfig);
define.doc({});
define.test({});
define.lint([js.configs.recommended, ts.configs.recommended]);
define.staged({});

importedTest('exposes the Rstest APIs', () => {
importedExpect(true).toBe(true);
});
8 changes: 8 additions & 0 deletions packages/rstack/tests/types/resolution-bundler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "ES2022",
"moduleResolution": "bundler"
},
"include": ["index.ts"]
}
24 changes: 24 additions & 0 deletions packages/rstack/tests/types/resolution-nodenext/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This folder checks Rstack's exports and APIs with NodeNext resolution.
import 'rstack/test/globals';
import 'rstack/test/importMeta';
import 'rstack/types';
import { define } from 'rstack';
import { createRsbuild, defineConfig as defineAppConfig } from 'rstack/app';
import { defineConfig as defineLibConfig } from 'rstack/lib';
import { js, ts } from 'rstack/lint';
import { expect as importedExpect, test as importedTest } from 'rstack/test';

const appConfig = defineAppConfig({});
const libConfig = defineLibConfig({});

createRsbuild({ config: appConfig });
define.app(appConfig);
define.lib(libConfig);
define.doc({});
define.test({});
define.lint([js.configs.recommended, ts.configs.recommended]);
define.staged({});

importedTest('exposes the Rstest APIs', () => {
importedExpect(true).toBe(true);
});
8 changes: 8 additions & 0 deletions packages/rstack/tests/types/resolution-nodenext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": ["index.ts"]
}
17 changes: 17 additions & 0 deletions packages/rstack/tests/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Type tests",
"compilerOptions": {
"lib": ["DOM", "ESNext"],
"target": "ES2022",
"types": ["node"],
"skipLibCheck": true,
"moduleDetection": "force",
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true
}
}
3 changes: 2 additions & 1 deletion rstack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ define.lint(async () => {
parserOptions: {
project: [
'./packages/*/tsconfig.json',
'./packages/*/test/tsconfig.json',
'./packages/*/tests/tsconfig.json',
'./packages/rstack/tests/types/*/tsconfig.json',
'./examples/*/tsconfig.json',
'./website/tsconfig.json',
],
Expand Down