Set up comprehensive frontend testing infrastructure
- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
frontend/node_modules/jest-transform-stub/LICENSE
generated
vendored
Normal file
19
frontend/node_modules/jest-transform-stub/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2018 Edd Yerburgh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
42
frontend/node_modules/jest-transform-stub/README.md
generated
vendored
Normal file
42
frontend/node_modules/jest-transform-stub/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# jest-transform-stub
|
||||
|
||||
Jest doesn't handle non JavaScript assets by default.
|
||||
|
||||
You can use this module to avoid errors when importing non JavaScript assets.
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
npm install --save-dev jest-transform-stub
|
||||
```
|
||||
|
||||
In your Jest config, add jest-transform-stub to transform non JavaScript assets you want to stub:
|
||||
|
||||
```js
|
||||
{
|
||||
"jest": {
|
||||
// ..
|
||||
"transform": {
|
||||
"^.+\\.js$": "babel-jest",
|
||||
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
**My module isn't being transformed**
|
||||
|
||||
Jest doesn't apply transforms to node_modules by default. You can solve this by using `moduleNameMapper`:
|
||||
|
||||
```js
|
||||
{
|
||||
"jest": {
|
||||
// ..
|
||||
"moduleNameMapper": {
|
||||
"^.+.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
7
frontend/node_modules/jest-transform-stub/index.js
generated
vendored
Normal file
7
frontend/node_modules/jest-transform-stub/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
process: function() {
|
||||
return {
|
||||
code: 'module.exports = ""'
|
||||
}
|
||||
}
|
||||
}
|
||||
33
frontend/node_modules/jest-transform-stub/package.json
generated
vendored
Normal file
33
frontend/node_modules/jest-transform-stub/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "jest-transform-stub",
|
||||
"version": "2.0.0",
|
||||
"description": "Jest transform stub",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eddyerburgh/jest-transform-stub.git"
|
||||
},
|
||||
"keywords": [
|
||||
"jest"
|
||||
],
|
||||
"author": "Edd Yerburgh",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eddyerburgh/jest-transform-stub/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eddyerburgh/jest-transform-stub#readme",
|
||||
"devDependencies": {
|
||||
"jest": "^22.4.2"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
".+\\.png$": "<rootDir>/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user