diff --git a/.fatherrc.ts b/.fatherrc.ts index 7edefed..e983fef 100644 --- a/.fatherrc.ts +++ b/.fatherrc.ts @@ -16,6 +16,9 @@ export default defineConfig({ filename: 'index.min.js', }, platform: 'browser', + targets: { + chrome: 51, + }, externals: { lodash: '_', 'lodash-es': '_', diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 475f5c3..96d4084 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,16 +32,13 @@ jobs: uses: ./.github/actions/prepare-install with: node-version: ${{ matrix.node-version }} - - name: Check run: | pnpm check-deps pnpm check-format - - name: Lint run: pnpm lint:ts - # todo test # unit-test: # runs-on: ubuntu-latest # strategy: @@ -53,10 +50,8 @@ jobs: # uses: ./.github/actions/prepare-install # with: # node-version: ${{ matrix.node-version }} - - # - name: Coverage Test - # run: pnpm unit - + # - name: Unit Test + # run: pnpm test:unit size-test: runs-on: ubuntu-latest @@ -69,6 +64,5 @@ jobs: uses: ./.github/actions/prepare-install with: node-version: ${{ matrix.node-version }} - - name: Szie Test With Build run: pnpm test:size diff --git a/jest.config.ts b/jest.config.ts index a7e2103..5442e15 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,11 +1,18 @@ import type { Config } from 'jest'; +const esm = ['internmap', 'd3-*'].join('|'); + const config: Config = { preset: 'ts-jest', testEnvironment: 'jsdom', collectCoverage: false, testRegex: '(/__tests__/.*\\.(test|spec))\\.ts$', collectCoverageFrom: ['src/**/*.ts'], + // Transform esm to cjs. + transformIgnorePatterns: [ + `/node_modules/(?!(${esm}))`, + `/node_modules/.pnpm/(?!(${esm}))`, + ], }; export default config; diff --git a/package.json b/package.json index 0e495e9..6c7a199 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "prettier-plugin-organize-imports": "^4.1.0", "react": "^18.0.0", "ts-jest": "^29.2.5", + "ts-node": "^10.9.2", "typescript": "^5.6.3", "typescript-eslint": "^8.13.0", "webpack-bundle-analyzer": "^4.10.2"