It takes a long time to finish the process after testing

未关闭
#4,294 3 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
领域
testing-qa

调研方向

首先,使用提供的 CodeceptJS 配置和 --verbose 输出重现延迟,重点关注 Puppeteer helper 和 teardown hook。比较快速完成的运行与在“finished teardown hook”之后仍未退出的运行;对于通过和失败的测试,只要测试进程都能及时退出,就表示完成。

由索引模型根据 Issue 内容生成。

描述

stale
What are you trying to achieve?

I'm trying to run a test.

What do you get instead?

After running the test, codecept takes a long time to quit the process. It does not matter if the test succeeds or fails. After the test runs are finished, it just stays at OK in ... or finished teardown hook with --verbose. This happens randomly, sometimes finishing fast, but more often lasting up to several minutes.

Provide console output if related. Use --verbose mode for more details.

  ✔ OK in 12663ms

    --- STARTED "after each" hook: After for "Scenario1" ---
    Emitted | provisioning.user.removed ([object Object])
    Emitted | provisioning.user.removed ([object Object])
    --- ENDED "after each" hook: After for "Scenario1" ---

  OK  | 1 passed   // 16s
    started teardown hook
    Emitted | provisioning.context.removed ([object Object])
    finished teardown hook


✨  Done in 316.64s.

Provide test source code if related
Happens randomly to all tests.

Details
  • CodeceptJS version: v3.5.3
  • NodeJS Version: v21.6.2
  • Operating System: Sonoma 14.2.1
  • puppeteer version: 20.8.2
  • Configuration file:
    (cut sensitive data)
module.exports.config = {
  tests: './tests/**/*_test.js',
  timeout: 90,
  output: './output/',
  helpers: {
    Puppeteer: {
      url: process.env.LAUNCH_URL,
      smartWait: 1000,
      waitForTimeout: Number(process.env.WAIT_TIMEOUT),
      browser: 'chrome',
      restart: true,
      windowSize: '1280x1024',
      uniqueScreenshotNames: true,
      timeouts: {
        script: 5000
      },
      chrome: {
        executablePath: process.env.CHROME_BIN,
        args: [
          '--disable-crash-reporter',
          '--disable-dev-shm-usage',
          '--disable-features=IsolateOrigins',
          '--disable-gpu',
          '--disable-notifications', // to disable native notification window on Mac OS,
          '--disable-print-preview',
          '--disable-setuid-sandbox',
          '--disable-site-isolation-trials',
          '--disable-web-security',
          process.env.HEADLESS === 'false' ? '' : `--headless=${process.env.HEADLESS}`,
          '--no-first-run',
          '--no-sandbox',
          '--no-zygote',
            `--unsafely-treat-insecure-origin-as-secure=${process.env.LAUNCH_URL}`
        ].concat((process.env.CHROME_ARGS || '').split(' '))
      },
      show: process.env.HEADLESS === 'false' || 'new',
      waitForNavigation: ['domcontentloaded', 'networkidle0']
    },
    MockRequestHelper: {
      require: '@codeceptjs/mock-request'
    }
  },
  async teardown () {
    const { contexts } = global.inject()
    for (const ctx of contexts.filter(ctx => ctx.id > 100)) {
      if (ctx.id !== 10) await ctx.remove().catch(e => console.error(e.message))
    }
  },

}
主要语言
JavaScript
星标
4.2k
派生
756
平均合并
2 天 9 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。