Skip to content

Commit

Permalink
chore: clean up packages and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
work-kevin-flynn committed Nov 25, 2024
1 parent a875a30 commit 417ecd7
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 700 deletions.
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@
"@changesets/cli": "^2.27.1",
"@happy-dom/jest-environment": "^15.11.6",
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"@testing-library/react": "^14.1.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@types/node": "^22.9.3",
"@types/jest": "^29.5.12",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@vitest/coverage-v8": "^2.1.5",
Expand All @@ -71,13 +76,20 @@
"father": "^4.3.8",
"happy-dom": "^15.11.6",
"husky": "^8.0.3",
"babel-jest": "^29.7.0",
"node-fetch": "^3.3.2",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jest-transform-stub": "^2.0.0",
"jsdom": "^23.0.1",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"ts-jest": "^29.2.5",
"typescript": "^5.3.3",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.5"
},
"ci": {
Expand Down
9 changes: 1 addition & 8 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@
"@babel/preset-env": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@portkey/did-ui-react": "^2.15.9",
"@portkey/types": "^2.15.9",
"@types/jest": "^29.5.12",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-junit": "^16.0.0",
"jsdom": "^23.0.1",
"typescript": "^5.3.3"
"@portkey/types": "^2.15.9"
},
"peerDependencies": {
"@portkey/did-ui-react": "^2.15.9"
Expand Down
206 changes: 0 additions & 206 deletions packages/bridge/jest.config.ts

This file was deleted.

23 changes: 0 additions & 23 deletions packages/bridge/jest.setup.ts

This file was deleted.

6 changes: 1 addition & 5 deletions packages/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@
"@portkey/did-ui-react": "^2.15.9",
"@portkey/types": "^2.15.9",
"@portkey/utils": "^2.15.9",
"@swc/core": "^1.9.3",
"@swc/jest": "^0.2.37",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"antd": "4.24.14",
"father": "^4.3.8",
"jest": "^29.7.0",
"typescript": "^5.3.3"
"father": "^4.3.8"
},
"peerDependencies": {
"@portkey/did-ui-react": "^2.15.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "src/global.d.ts", ".fatherrc.ts"]
"include": ["src/**/*.ts", "src/**/*.tsx", ".fatherrc.ts"]
}
9 changes: 6 additions & 3 deletions packages/bridge/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { defineConfig, configDefaults } from 'vitest/config';
import tsconfigPaths from 'vite-tsconfig-paths';

const exclude = [...configDefaults.exclude, '**/dist/*.*', '**/.*', '**/*.setup.*'];

export default defineConfig({
plugins: [tsconfigPaths()],
test: {
maxConcurrency: 20,
pool: 'vmThreads',
Expand All @@ -17,26 +19,27 @@ export default defineConfig({
optimizer: {
web: {
enabled: true,
include: ['node-fetch'],
},
},
},
globals: true,
watch: false,
environment: 'happy-dom',
setupFiles: ['./vitest.setup.ts'],
include: ['./src/**/*(*.)?{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
name: 'bridge',
exclude,
reporters: ['junit'],
reporters: ['junit', 'default'],
outputFile: {
junit: './jest-report.xml',
},
coverage: {
all: false,
enabled: true,
provider: 'v8',
exclude: [...exclude, '**/__tests__/*.*'],
reportsDirectory: './coverage',
reporter: [['json', { file: 'coverage-summary.json' }]],
reporter: [['json', { file: 'coverage-summary.json' }], ['text']],
},
},
});
22 changes: 21 additions & 1 deletion packages/bridge/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
import '@testing-library/jest-dom';
import { cleanup } from '@testing-library/react';
import { afterEach, beforeAll, vi } from 'vitest';

beforeAll(() => {
global.ResizeObserver = class ResizeObserver {
observe() {
// do nothing
}
unobserve() {
// do nothing
}
disconnect() {
// do nothing
}
};
});

afterEach(() => {
cleanup();
});

// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
if (typeof window !== 'undefined') {
Expand All @@ -19,7 +39,7 @@ if (typeof window !== 'undefined') {

import { type TChainId } from '@aelf-web-login/wallet-adapter-base';
vi.mock('@aelf-web-login/wallet-adapter-portkey-aa', () => ({
PortkeyAAWallet: jest.fn(),
PortkeyAAWallet: vi.fn(),
}));
vi.mock('@portkey/did-ui-react', () => ({
getChainInfo: (c: TChainId) => (!c ? null : {}),
Expand Down
Loading

0 comments on commit 417ecd7

Please sign in to comment.