我正在尝试运行此代码,虽然我可以看到测试must run in num browsers loop
已被记录,但尽管上面正好显示了该行,但我却没有看到must run in browser prom
被记录了
(async () => {
try {
jest.setTimeout(300000);
const NUM_BROWSERS = 2;
const NUM_PAGES = 3;
const hrefss = [
];
const browserProms = [];
for (let i = 0; i < NUM_BROWSERS; i += 1) {
test('must run in num browsers loop', () => {
expect(1).toBe(1);
});
browserProms.push(
new Promise(async resBrowser => {
const browser = await puppeteer.launch();
console.log('about to run test in promise...')
test('must run in browser prom', () => {
expect(1).toBe(1);
});
await browser.close();
resBrowser();
})
);
}
await Promise.all(browserProms);
} catch (e) {
console.error('error in promise >>>>', e);
}
})();
注释掉第一个测试时,出现此错误:Your test suite must contain at least one test.