Pulling in jest as a dependency for the frontent, example test included
This commit is contained in:
		
							parent
							
								
									15a83882ef
								
							
						
					
					
						commit
						54cca2b151
					
				
					 6 changed files with 3087 additions and 59 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/node.js.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/node.js.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -34,4 +34,4 @@ jobs:
 | 
				
			||||||
    - run: npm ci
 | 
					    - run: npm ci
 | 
				
			||||||
    - run: npm run lint
 | 
					    - run: npm run lint
 | 
				
			||||||
    - run: npm run build --if-present
 | 
					    - run: npm run build --if-present
 | 
				
			||||||
    # - run: npm test # Not implemented yet
 | 
					    - run: npm test
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ module.exports = {
 | 
				
			||||||
    'plugin:react-hooks/recommended',
 | 
					    'plugin:react-hooks/recommended',
 | 
				
			||||||
    'plugin:prettier/recommended',
 | 
					    'plugin:prettier/recommended',
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  ignorePatterns: ['dist', '.eslintrc.cjs', 'tailwind.config.js', 'postcss.config.js'],
 | 
					  ignorePatterns: ['dist', '.eslintrc.cjs', 'tailwind.config.js', 'postcss.config.js', 'jest.config.cjs'],
 | 
				
			||||||
  parser: '@typescript-eslint/parser',
 | 
					  parser: '@typescript-eslint/parser',
 | 
				
			||||||
  plugins: ['react-refresh', 'prettier'],
 | 
					  plugins: ['react-refresh', 'prettier'],
 | 
				
			||||||
  rules: {
 | 
					  rules: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								frontend/jest.config.cjs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								frontend/jest.config.cjs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
					    transform: {
 | 
				
			||||||
 | 
					        '^.+\\.(t|j)sx?$': '@swc/jest',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										3117
									
								
								frontend/package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										3117
									
								
								frontend/package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -8,13 +8,17 @@
 | 
				
			||||||
    "build": "tsc && vite build",
 | 
					    "build": "tsc && vite build",
 | 
				
			||||||
    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
 | 
					    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
 | 
				
			||||||
    "preview": "vite preview",
 | 
					    "preview": "vite preview",
 | 
				
			||||||
    "format": "prettier --config .prettierrc '**/*.ts' '**/*.tsx' '**/*.js' '**/*.json' --write"
 | 
					    "format": "prettier --config .prettierrc '**/*.ts' '**/*.tsx' '**/*.js' '**/*.json' --write",
 | 
				
			||||||
 | 
					    "test": "jest"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "react": "^18.2.0",
 | 
					    "react": "^18.2.0",
 | 
				
			||||||
    "react-dom": "^18.2.0"
 | 
					    "react-dom": "^18.2.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
 | 
					    "@swc/core": "^1.4.2",
 | 
				
			||||||
 | 
					    "@swc/jest": "^0.2.36",
 | 
				
			||||||
 | 
					    "@types/jest": "^29.5.12",
 | 
				
			||||||
    "@types/react": "^18.2.55",
 | 
					    "@types/react": "^18.2.55",
 | 
				
			||||||
    "@types/react-dom": "^18.2.19",
 | 
					    "@types/react-dom": "^18.2.19",
 | 
				
			||||||
    "@typescript-eslint/eslint-plugin": "^6.21.0",
 | 
					    "@typescript-eslint/eslint-plugin": "^6.21.0",
 | 
				
			||||||
| 
						 | 
					@ -27,8 +31,10 @@
 | 
				
			||||||
    "eslint-plugin-react": "^7.33.2",
 | 
					    "eslint-plugin-react": "^7.33.2",
 | 
				
			||||||
    "eslint-plugin-react-hooks": "^4.6.0",
 | 
					    "eslint-plugin-react-hooks": "^4.6.0",
 | 
				
			||||||
    "eslint-plugin-react-refresh": "^0.4.5",
 | 
					    "eslint-plugin-react-refresh": "^0.4.5",
 | 
				
			||||||
 | 
					    "jest": "^29.7.0",
 | 
				
			||||||
    "postcss": "^8.4.35",
 | 
					    "postcss": "^8.4.35",
 | 
				
			||||||
    "prettier": "3.2.5",
 | 
					    "prettier": "3.2.5",
 | 
				
			||||||
 | 
					    "react-test-renderer": "^18.2.0",
 | 
				
			||||||
    "tailwindcss": "^3.4.1",
 | 
					    "tailwindcss": "^3.4.1",
 | 
				
			||||||
    "typescript": "^5.2.2",
 | 
					    "typescript": "^5.2.2",
 | 
				
			||||||
    "vite": "^5.1.0"
 | 
					    "vite": "^5.1.0"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								frontend/src/Components/__tests__/CountButton.test.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								frontend/src/Components/__tests__/CountButton.test.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					import { describe, expect, test } from "@jest/globals";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function sum(a: number, b: number): number {
 | 
				
			||||||
 | 
					  return a + b;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// This is obviously not testing the proper component
 | 
				
			||||||
 | 
					describe("sum module", () => {
 | 
				
			||||||
 | 
					  test("adds 1 + 2 to equal 3", () => {
 | 
				
			||||||
 | 
					    expect(sum(1, 1)).toBe(2);
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue