 aacb45156b
			
		
	
	aacb45156b
	
	
	
		
			
			- 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>
		
			
				
	
	
		
			81 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var exec = require('child_process').exec;
 | |
| 
 | |
| var helpers = new (function () {
 | |
|   var _tests;
 | |
|   var _names = [];
 | |
|   var _name;
 | |
|   var _callback;
 | |
|   var _runner = function () {
 | |
|     if ((_name = _names.shift())) {
 | |
|       console.log('Running ' + _name);
 | |
|       _tests[_name]();
 | |
|     }
 | |
|     else {
 | |
|       _callback();
 | |
|     }
 | |
|   };
 | |
| 
 | |
|   this.exec = function () {
 | |
|     var args = Array.prototype.slice.call(arguments);
 | |
|     var arg;
 | |
|     var cmd = args.shift();
 | |
|     var opts = {};
 | |
|     var callback;
 | |
|     // Optional opts/callback or callback/opts
 | |
|     while ((arg = args.shift())) {
 | |
|       if (typeof arg == 'function') {
 | |
|         callback = arg;
 | |
|       }
 | |
|       else {
 | |
|         opts = arg;
 | |
|       }
 | |
|     }
 | |
| 
 | |
|     cmd += ' --trace';
 | |
|     var execOpts = opts.execOpts ? opts.execOpts : {};
 | |
|     exec(cmd, execOpts, function (err, stdout, stderr) {
 | |
|       var out = helpers.trim(stdout);
 | |
|       if (err) {
 | |
|         if (opts.breakOnError === false) {
 | |
|           return callback(err);
 | |
|         }
 | |
|         else {
 | |
|           throw err;
 | |
|         }
 | |
|       }
 | |
|       if (stderr) {
 | |
|         callback(stderr);
 | |
|       }
 | |
|       else {
 | |
|         callback(out);
 | |
|       }
 | |
|     });
 | |
|   };
 | |
| 
 | |
|   this.trim = function (s) {
 | |
|     var str = s || '';
 | |
|     return str.replace(/^\s*|\s*$/g, '');
 | |
|   };
 | |
| 
 | |
|   this.parse = function (s) {
 | |
|     var str = s || '';
 | |
|     str = helpers.trim(str);
 | |
|     str = str.replace(/'/g, '"');
 | |
|     return JSON.parse(str);
 | |
|   };
 | |
| 
 | |
|   this.run = function (tests, callback) {
 | |
|     _tests = tests;
 | |
|     _names = Object.keys(tests);
 | |
|     _callback = callback;
 | |
|     _runner();
 | |
|   };
 | |
| 
 | |
|   this.next = function () {
 | |
|     _runner();
 | |
|   };
 | |
| 
 | |
| })();
 | |
| 
 | |
| module.exports = helpers;
 |