添加测试配置及登陆部分的测试
Change-Id: I6fa1fe23ad8773548927fdc921dceab841f2368a
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 0000000..12166cc
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,24 @@
+module.exports = {
+ testEnvironment: 'jsdom',
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
+ setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
+ transform: {
+ '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest', // 使用 babel 处理所有文件
+ },
+ moduleNameMapper: {
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
+ '\\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/__mocks__/fileMock.js',
+ '^@/(.*)$': '<rootDir>/src/$1', // 如果你用了 path alias
+ '&/(.*)$': '<rootDir>/$1', // 如果你用了 path alias
+ },
+ testPathIgnorePatterns: ['/node_modules/', '/dist/', '/scripts/'],
+ roots: ['<rootDir>/test'],
+ collectCoverageFrom: [
+ 'src/**/*.{ts,tsx,js,jsx}',
+ '!src/**/*.d.ts',
+ '!src/**/index.ts',
+ '!src/**/index.tsx',
+ '!src/**/index.js',
+ '!src/**/index.jsx',
+ ],
+};