Github Actions 上的验收测试失败

您好 Discourse 社区 :wave:

我正在基于您提供的 skeleton 设置一个新插件,它已经帮了我很多忙。
我现在正在编写前端和后端的测试。在 Discourse 开发环境中,一切都按预期工作,包括运行良好的验收测试。

我的工作流文件非常简单:

name: Discourse Projects Plugin - CI

on:
  push:
    branches: [ main ]

jobs:
  discourse:
    uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1

但是,当我尝试在 Github Actions 上运行工作流时,我在 frontend_tests / Plugin QUnit 步骤中遇到了一个奇怪的错误:

Built project successfully. Stored in "/tmp/tests-dist-20231022-6082-zjfckn.1g5q".
not ok 1 Chrome 119.0 - [180 ms] - global failure
    ---
        stack: >
            Error: No tests were run.
                at done (http://localhost:7357/assets/chunk.74084cb2759545d0c671.js:108653:17)
                at advanceTestQueue (http://localhost:7357/assets/chunk.74084cb2759545d0c671.js:108565:7)
                at Object.advance (http://localhost:7357/assets/chunk.74084cb2759545d0c671.js:108520:7)
                at unblockAndAdvanceQueue (http://localhost:7357/assets/chunk.74084cb2759545d0c671.js:110490:21)
        message: >
            No tests were run.
        negative: >
            false
        browser log: |
            {"type":"log","text":"ℹ️ Ember v3.28.12"}
    ...
Out of requested 1 browser(s), 1 browser(s) was launched & completed.
All browsers to exited.
Used JS Heap Size: 0.073GB

除此之外,即使再次运行带有调试日志记录的工作流,我也无法获得任何详细信息。工作流中的所有其他步骤都已正确完成(linters、rspec 等)。

所以我的问题很简单:

  • 免费的 Github runner 是否足以运行验收步骤?
  • 有什么线索可以帮助我解决这个问题吗?

我确信我某处做错了,但我不知道从哪里开始查找。

感谢您的帮助以及在 Discourse 上所做的一切工作!

5 个赞

你好,Pierre!我们同意开发人员体验在某些方面可以更好,我正在努力弄清楚你是如何遇到这个问题的,以及我们可以做些什么来帮助你和未来的开发者获得更愉快的体验。

你如何在本地运行验收测试?

你在 test/javascripts 目录中定义了任何测试吗?

5 个赞

您好 @nbianca,感谢您的回答!

我通过 Qunit 页面在 http://localhost:4200/tests 上本地运行验收测试:

正如您所见,test/javascripts 中已经有一些测试了。

2 个赞

事实上,你的问题促使我试图理解为什么它会检测不到测试。所以我检查了你提供的 workflow,我看到 Qunit 是用“PLUGIN_NAME”执行的,而“PLUGIN_NAME”被填充为仓库名。

在我的例子中,仓库名和插件名是不同的。在 job 日志中甚至有关于此的警告。我将尝试相应地重命名仓库,并随时向你汇报 :slight_smile:

3 个赞

我确认使用相同的名称作为存储库和插件奏效了。

感谢 @nbianca 的帮助!

7 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.