fix: e2e test did not exit successfully (#3427)
* fix: e2e test did not exit successfully * fix: tree kill --------- Co-authored-by: dream2023 <1098626505@qq.com>
This commit is contained in:
		
							parent
							
								
									1b2c67fea7
								
							
						
					
					
						commit
						2792cb1b0a
					
				@ -79,6 +79,7 @@
 | 
				
			|||||||
    "pretty-quick": "^3.1.0",
 | 
					    "pretty-quick": "^3.1.0",
 | 
				
			||||||
    "react": "^18.0.0",
 | 
					    "react": "^18.0.0",
 | 
				
			||||||
    "react-dom": "^18.0.0",
 | 
					    "react-dom": "^18.0.0",
 | 
				
			||||||
 | 
					    "tree-kill": "^1.2.2",
 | 
				
			||||||
    "typescript": "5.1.3"
 | 
					    "typescript": "5.1.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "volta": {
 | 
					  "volta": {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,7 @@ const { execSync } = require('node:child_process');
 | 
				
			|||||||
const axios = require('axios');
 | 
					const axios = require('axios');
 | 
				
			||||||
const { pTest } = require('./p-test');
 | 
					const { pTest } = require('./p-test');
 | 
				
			||||||
const os = require('os');
 | 
					const os = require('os');
 | 
				
			||||||
 | 
					const treeKill = require('tree-kill');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 检查服务是否启动成功
 | 
					 * 检查服务是否启动成功
 | 
				
			||||||
@ -91,6 +92,17 @@ async function runApp(options = {}) {
 | 
				
			|||||||
  run('nocobase', [process.env.APP_ENV === 'production' ? 'start' : 'dev'], options);
 | 
					  run('nocobase', [process.env.APP_ENV === 'production' ? 'start' : 'dev'], options);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					process.on('SIGINT', async () => {
 | 
				
			||||||
 | 
					  treeKill(process.pid, (error) => {
 | 
				
			||||||
 | 
					    if (error) {
 | 
				
			||||||
 | 
					      console.error(error);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      console.log('所有子进程已被杀掉,应用程序即将退出');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    process.exit();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const commonConfig = {
 | 
					const commonConfig = {
 | 
				
			||||||
  stdio: 'inherit',
 | 
					  stdio: 'inherit',
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -150,6 +162,10 @@ module.exports = (cli) => {
 | 
				
			|||||||
      console.log('APP_BASE_URL:', process.env.APP_BASE_URL);
 | 
					      console.log('APP_BASE_URL:', process.env.APP_BASE_URL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					  process.on('SIGINT', () => {
 | 
				
			||||||
 | 
					    console.log('SIGINT......');
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  e2e
 | 
					  e2e
 | 
				
			||||||
    .command('test')
 | 
					    .command('test')
 | 
				
			||||||
    .allowUnknownOption()
 | 
					    .allowUnknownOption()
 | 
				
			||||||
 | 
				
			|||||||
@ -24424,7 +24424,7 @@ transformation-matrix@^2.11.1:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
tree-kill@^1.2.2:
 | 
					tree-kill@^1.2.2:
 | 
				
			||||||
  version "1.2.2"
 | 
					  version "1.2.2"
 | 
				
			||||||
  resolved "https://registry.npmmirror.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
 | 
					  resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
 | 
				
			||||||
  integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
 | 
					  integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
trim-lines@^3.0.0:
 | 
					trim-lines@^3.0.0:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user