diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b1559d986b..397ad2eb92 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -21,7 +21,7 @@ jobs:
- name: Code lint checker
run: pnpm checker
- test-ee:
+ test:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
strategy:
@@ -34,65 +34,41 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm
- - name: Coverage test report ee
- run: sh ./scripts/jest/run-ci-ee.sh ${{ matrix.shard }} ${{ strategy.job-total }}
+ - name: Coverage test report
+ run: sh ./scripts/jest/run-ci.sh ${{ matrix.shard }} ${{ strategy.job-total }}
- uses: actions/upload-artifact@v4
with:
name: coverage-artifacts-${{ matrix.shard }}
path: coverage/
- test-ce:
- runs-on: ubuntu-latest
- if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Install dependencies
- uses: ./.github/actions/catch-install-pnpm
-
- - name: Coverage test report ce
- run: sh ./scripts/jest/run-ci-ce.sh
-
- - uses: actions/upload-artifact@v4
- with:
- name: ce-coverage-artifacts
- path: ce_coverage/
-
report:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
- needs: [test-ee, test-ce]
+ needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Get CE Coverage
- uses: actions/download-artifact@v4
- with:
- name: ce-coverage-artifacts
- path: ce_coverage
-
- - name: Get EE Coverage 1
+ - name: Get Coverage 1
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-1
path: coverage
- - name: Get EE Coverage 2
+ - name: Get Coverage 2
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-2
path: coverage
- - name: Get EE Coverage 3
+ - name: Get Coverage 3
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-3
path: coverage
- - name: Get EE Coverage 4
+ - name: Get Coverage 4
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-4
@@ -115,7 +91,6 @@ jobs:
uses: geekyeggo/delete-artifact@v5
with:
name: |
- ce-coverage-artifacts
coverage-artifacts-1
coverage-artifacts-2
coverage-artifacts-3
diff --git a/jest.config.js b/jest.config.js
index 631a7d8b79..6515087c59 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -7,7 +7,37 @@ const { pathsToModuleNameMapper } = require('ts-jest');
compilerOptions.paths['~/*'][0] = path.resolve(compilerOptions.paths['~/*'][0]);
-module.exports = {
+const sharedModuleNameMapper = {
+ '.+\\.(css|style|less|sass|scss|ttf|woff|woff2)$': 'identity-obj-proxy',
+ '@ant-design/plots':
+ '/packages/shared/lib/testUtil/mockModule/mockAntDesignPlots.jsx',
+ 'monaco-editor':
+ '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
+ '@monaco-editor/react':
+ '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
+ '@uiw/react-md-editor':
+ '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
+ '@actiontech/(.*)': '/packages/$1',
+ '@react-sigma/core(.*)$':
+ '/packages/shared/lib/testUtil/mockModule/mockSigmaCore.tsx',
+ '@react-sigma/graph-search$':
+ '/packages/shared/lib/testUtil/mockModule/mockSigmaGraphSearch.tsx',
+ ...pathsToModuleNameMapper(compilerOptions.paths)
+};
+
+const sharedIgnorePatterns = ['/node_modules/', '/demo/', '/demos/'];
+
+// Naming conventions for condition-specific test files:
+// *.ce.test.{ts,tsx} → CE project (ee=false, ce=true, sqle=true, dms=false) 不要强制匹配 ce.test, ce.[可选项].test.{ts,tsx}
+// *.sqle.test.{ts,tsx} → EE project (ee=true, ce=false, sqle=true, dms=false) 同上
+// *.provision.test.{ts,tsx} → PROVISION project (ee=true, ce=false, sqle=false, provision=true, dms=false) 同上
+// *.test.{ts,tsx} → DMS project (ee=true, ce=false, sqle=true, provision=true, dms=true) [default] 同上
+// 实现:`.ce.` / `.sqle.` / `.provision.` 与 `.test.` 之间可有零段或多段 `.xxx.`(正则见下方 *_TEST_FILE_RE)。
+const CE_TEST_FILE_RE = '\\.ce(\\.[^./]+)*\\.test\\.[jt]sx?$';
+const SQLE_TEST_FILE_RE = '\\.sqle(\\.[^./]+)*\\.test\\.[jt]sx?$';
+const PROVISION_TEST_FILE_RE = '\\.provision(\\.[^./]+)*\\.test\\.[jt]sx?$';
+
+const sharedProjectConfig = {
transform: {
'^.+\\.(ts|tsx|js|jsx)$': '/scripts/jest/custom-transform.js',
'^.+\\.(png|jpg|jpeg|css|json)$': '/scripts/jest/file-transform.js'
@@ -19,24 +49,7 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx', 'node'],
testEnvironment: 'jest-environment-jsdom',
resetMocks: true,
- moduleNameMapper: {
- '.+\\.(css|style|less|sass|scss|ttf|woff|woff2)$': 'identity-obj-proxy',
- '@ant-design/plots':
- '/packages/shared/lib/testUtil/mockModule/mockAntDesignPlots.jsx',
- 'monaco-editor':
- '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
- '@monaco-editor/react':
- '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
- '@uiw/react-md-editor':
- '/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
- '@actiontech/(.*)': '/packages/$1',
- '@react-sigma/core(.*)$':
- '/packages/shared/lib/testUtil/mockModule/mockSigmaCore.tsx',
- '@react-sigma/graph-search$':
- '/packages/shared/lib/testUtil/mockModule/mockSigmaGraphSearch.tsx',
- ...pathsToModuleNameMapper(compilerOptions.paths)
- },
-
+ moduleNameMapper: sharedModuleNameMapper,
collectCoverageFrom: [
'packages/**/{src,lib}/{page,components,hooks,global,store,utils}/**/*.{ts,tsx}',
'packages/**/src/App.tsx',
@@ -49,8 +62,78 @@ module.exports = {
'!packages/**/demo/**',
'!packages/**/demos/**'
],
- setupFilesAfterEnv: ['/jest-setup.ts'],
- testPathIgnorePatterns: ['/node_modules/', '/demo/', '/demos/'],
+ setupFilesAfterEnv: ['/jest-setup.ts']
+};
+
+module.exports = {
+ projects: [
+ {
+ ...sharedProjectConfig,
+ displayName: 'dms',
+ globals: {
+ TEST_CONDITIONS: {
+ ee: true,
+ ce: false,
+ sqle: true,
+ provision: true,
+ dms: true
+ }
+ },
+ // Default tests only: exclude CE / sqle / provision condition tests (dedicated projects)
+ testPathIgnorePatterns: [
+ ...sharedIgnorePatterns,
+ CE_TEST_FILE_RE,
+ SQLE_TEST_FILE_RE,
+ PROVISION_TEST_FILE_RE
+ ]
+ },
+ {
+ ...sharedProjectConfig,
+ displayName: 'sqle-ce',
+ globals: {
+ TEST_CONDITIONS: {
+ ee: false,
+ ce: true,
+ sqle: true,
+ provision: false,
+ dms: false
+ }
+ },
+ testRegex: CE_TEST_FILE_RE,
+ testPathIgnorePatterns: sharedIgnorePatterns
+ },
+ {
+ ...sharedProjectConfig,
+ displayName: 'sqle-ee',
+ globals: {
+ TEST_CONDITIONS: {
+ ee: true,
+ ce: false,
+ sqle: true,
+ provision: false,
+ dms: false
+ }
+ },
+ testRegex: SQLE_TEST_FILE_RE,
+ // e.g. *.ce.sqle.test.* belongs to CE, not EE
+ testPathIgnorePatterns: [...sharedIgnorePatterns, CE_TEST_FILE_RE]
+ },
+ {
+ ...sharedProjectConfig,
+ displayName: 'provision',
+ globals: {
+ TEST_CONDITIONS: {
+ ee: true,
+ ce: false,
+ sqle: false,
+ provision: true,
+ dms: false
+ }
+ },
+ testRegex: PROVISION_TEST_FILE_RE,
+ testPathIgnorePatterns: [...sharedIgnorePatterns, CE_TEST_FILE_RE]
+ }
+ ],
reporters: [
'default',
[
diff --git a/package.json b/package.json
index 793e9cf061..567c18aebd 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"checker": "concurrently \"pnpm ts-check\" \"pnpm eslint\" \"pnpm stylelint\" \"pnpm prettier:c\"",
"test": "sh ./scripts/jest/run.sh",
"test:c": "sh ./scripts/jest/run-coverage.sh",
- "test:ci": "sh ./scripts/jest/run-ci-ee.sh && sh ./scripts/jest/run-ci-ce.sh && node ./scripts/jest/merge-report-json.js",
+ "test:ci": "sh ./scripts/jest/run-ci.sh 1 1 && node ./scripts/jest/merge-report-json.js",
"test:clean": "jest --clearCache",
"icon:g": "pnpm --filter @actiontech/icons icon:g",
"icon:docs:g": "pnpm --filter @actiontech/icons docs:g",
@@ -149,4 +149,4 @@
"@babel/core": "^7.22.0",
"@ant-design/cssinjs": "1.17.0"
}
-}
+}
\ No newline at end of file
diff --git a/packages/base/src/hooks/useOpPermission/index.sqle.test.tsx b/packages/base/src/hooks/useOpPermission/index.sqle.test.tsx
new file mode 100644
index 0000000000..89ea116535
--- /dev/null
+++ b/packages/base/src/hooks/useOpPermission/index.sqle.test.tsx
@@ -0,0 +1,55 @@
+import { cleanup, act, renderHook } from '@testing-library/react';
+import useOpPermission from '.';
+import userCenter from '@actiontech/shared/lib/testUtil/mockApi/base/userCenter';
+import { ListOpPermissionsServiceEnum } from '@actiontech/shared/lib/api/base/service/OpPermission/index.enum';
+
+// Verifies the [sqle && !dms] branch: service is set to sqle when calling ListOpPermissions
+
+describe('test useOpPermission - sqle mode', () => {
+ let listOpPermissionSpy: jest.SpyInstance;
+
+ beforeEach(() => {
+ listOpPermissionSpy = userCenter.getOpPermissionsList();
+ jest.useFakeTimers();
+ });
+
+ afterEach(() => {
+ jest.useRealTimers();
+ cleanup();
+ });
+
+ it('should call ListOpPermissions with service=sqle', async () => {
+ const { result } = renderHook(() => useOpPermission());
+
+ act(() => {
+ result.current.updateOpPermissionList();
+ });
+
+ await act(async () => jest.advanceTimersByTime(3000));
+
+ expect(listOpPermissionSpy).toHaveBeenCalledTimes(1);
+ expect(listOpPermissionSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ service: ListOpPermissionsServiceEnum.sqle
+ })
+ );
+ });
+
+ it('should call ListOpPermissions with service=sqle when filterBy is provided', async () => {
+ const { result } = renderHook(() => useOpPermission());
+
+ act(() => {
+ result.current.updateOpPermissionList();
+ });
+
+ await act(async () => jest.advanceTimersByTime(3000));
+
+ expect(listOpPermissionSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ service: ListOpPermissionsServiceEnum.sqle
+ })
+ );
+ expect(result.current.loading).toBeFalsy();
+ expect(result.current.opPermissionList.length).toBeGreaterThan(0);
+ });
+});
diff --git a/packages/base/src/page/DataSource/components/Form/__snapshots__/index.ce.test.tsx.snap b/packages/base/src/page/DataSource/components/Form/__snapshots__/index.ce.test.tsx.snap
index dfe5f0a2c1..acf08869e0 100644
--- a/packages/base/src/page/DataSource/components/Form/__snapshots__/index.ce.test.tsx.snap
+++ b/packages/base/src/page/DataSource/components/Form/__snapshots__/index.ce.test.tsx.snap
@@ -667,7 +667,7 @@ exports[`page/DataSource/DataSourceForm CE render business field when getProject
-
@@ -315,12 +314,6 @@ exports[`page/DataSource/DataSourceList render list snap 1`] = `
>
环境属性
- |
- 数据查询脱敏
- |
- |
-
-
-
- |
|
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+