 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>
		
			
				
	
	
		
			113 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| let proc = require('child_process');
 | |
| 
 | |
| const PROJECT_DIR = process.cwd();
 | |
| process.env.PROJECT_DIR = PROJECT_DIR;
 | |
| 
 | |
| namespace('doc', function () {
 | |
|   task('generate', ['doc:clobber'], function () {
 | |
|     var cmd = '../node-jsdoc-toolkit/app/run.js -n -r=100 ' +
 | |
|         '-t=../node-jsdoc-toolkit/templates/codeview -d=./doc/ ./lib';
 | |
|     jake.logger.log('Generating docs ...');
 | |
|     jake.exec([cmd], function () {
 | |
|       jake.logger.log('Done.');
 | |
|       complete();
 | |
|     });
 | |
|   }, {async: true});
 | |
| 
 | |
|   task('clobber', function () {
 | |
|     var cmd = 'rm -fr ./doc/*';
 | |
|     jake.exec([cmd], function () {
 | |
|       jake.logger.log('Clobbered old docs.');
 | |
|       complete();
 | |
|     });
 | |
|   }, {async: true});
 | |
| 
 | |
| });
 | |
| 
 | |
| desc('Generate docs for Jake');
 | |
| task('doc', ['doc:generate']);
 | |
| 
 | |
| npmPublishTask('jake', function () {
 | |
|   this.packageFiles.include([
 | |
|     'Makefile',
 | |
|     'jakefile.js',
 | |
|     'README.md',
 | |
|     'package.json',
 | |
|     'usage.txt',
 | |
|     'lib/**',
 | |
|     'bin/**',
 | |
|     'test/**'
 | |
|     ]);
 | |
|   this.packageFiles.exclude([
 | |
|     'test/tmp'
 | |
|   ]);
 | |
| });
 | |
| 
 | |
| jake.Task['publish:package'].directory = PROJECT_DIR;
 | |
| 
 | |
| namespace('test', function () {
 | |
| 
 | |
|   let integrationTest = task('integration', async function () {
 | |
|     let testArgs = [];
 | |
|     if (process.env.filter) {
 | |
|       testArgs.push(process.env.filter);
 | |
|     }
 | |
|     else {
 | |
|       testArgs.push('*.js');
 | |
|     }
 | |
|     let spawned = proc.spawn(`${PROJECT_DIR}/node_modules/.bin/mocha`, testArgs, {
 | |
|       stdio: 'inherit'
 | |
|     });
 | |
|     return new Promise((resolve, reject) => {
 | |
|       spawned.on('exit', () => {
 | |
|         resolve();
 | |
|       });
 | |
|     });
 | |
| 
 | |
|   });
 | |
|   integrationTest.directory = `${PROJECT_DIR}/test/integration`;
 | |
| 
 | |
|   let integrationClobber = task('integrationClobber', function () {
 | |
|     proc.execSync('rm -rf package.json pkg tmp_publish');
 | |
|   });
 | |
|   integrationClobber.directory = `${PROJECT_DIR}/test/integration`;
 | |
| 
 | |
|   let unitTest = task('unit', async function () {
 | |
|     let testArgs = [];
 | |
|     if (process.env.filter) {
 | |
|       testArgs.push(process.env.filter);
 | |
|     }
 | |
|     else {
 | |
|       testArgs.push('*.js');
 | |
|     }
 | |
|     let spawned = proc.spawn(`${PROJECT_DIR}/node_modules/.bin/mocha`, testArgs, {
 | |
|       stdio: 'inherit'
 | |
|     });
 | |
|   });
 | |
|   unitTest.directory = `${PROJECT_DIR}/test/unit`;
 | |
| 
 | |
| });
 | |
| 
 | |
| desc('Runs all tests');
 | |
| task('test', ['test:unit', 'test:integration', 'test:integrationClobber']);
 | |
| 
 | |
| desc('Runs eslint for both lib and test directories');
 | |
| task('lint', function (doFix) {
 | |
| 
 | |
|   let cmd = 'eslint --format codeframe "lib/**/*.js" "test/**/*.js"';
 | |
|   if (doFix) {
 | |
|     cmd += ' --fix';
 | |
|   }
 | |
|   try {
 | |
|     proc.execSync(cmd);
 | |
|   }
 | |
|   catch (err) {
 | |
|     console.log(err.message);
 | |
|     console.log(err.stderr.toString());
 | |
|     console.log(err.stdout.toString());
 | |
|     fail('eslint failed');
 | |
|   }
 | |
| });
 | |
| 
 | |
| 
 |