'use strict'; const { spawnSync } = require('node:child_process'), path = require('node:path'), fs = require('node:fs'); const root = path.resolve(__dirname, '../..'), artifacts = path.join(root, 'temp/taobao-h5-compatibility'); const gitOpenSSL = 'C:\\Program Files\\Git\\usr\\bin'; const testEnv = { ...process.env, H5_ARTIFACT_DIR: artifacts }; if (process.platform === 'win32' && fs.existsSync(path.join(gitOpenSSL, 'openssl.exe'))) testEnv.Path = gitOpenSSL + path.delimiter + (process.env.Path || process.env.PATH); fs.mkdirSync(artifacts, { recursive: true }); for (const name of ['guest-privacy.mjs', 'wechat-browser.mjs', 'report-persistence.mjs', 'wrinkle-async-browser.mjs']) { console.log('H5 compatibility: ' + name); const result = spawnSync(process.execPath, ['--require', path.join(__dirname, 'legacy-playwright.cjs'), path.join(root, 'h5/test', name)], { cwd: root, env: testEnv, stdio: 'inherit', timeout: 120000 }); if (result.status !== 0) { if (result.error) console.error(result.error.message); process.exit(result.status || 1); } } console.log('PASS: H5 guest privacy, WeChat /state/ OAuth flow, full report persistence and async wrinkle layers');