19 lines
571 B
JavaScript
19 lines
571 B
JavaScript
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
module.exports = async function globalSetup() {
|
|
const port = parseInt(process.env.WECHAT_DEVTOOLS_PORT || '63956', 10);
|
|
|
|
// 将共享配置写入临时文件,供测试套件读取
|
|
const stateFile = path.resolve(__dirname, '.test-state.json');
|
|
fs.writeFileSync(stateFile, JSON.stringify({
|
|
port,
|
|
launched: true,
|
|
timestamp: Date.now()
|
|
}), 'utf8');
|
|
|
|
console.log('\n=== 全局测试环境初始化 ===');
|
|
console.log('服务端口:', port);
|
|
console.log('状态文件:', stateFile);
|
|
};
|