Bare headless test proxy for packages

未关闭
#51 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript

调研方向

Compare the linked Meteor Community Packages examples, then use the issue's package.json as the starting point for a new example in this repository. Include the described headless test, lint, setup, and documentation tooling, and add a README explaining the stack, setup, and usage; the example should be usable as a bare package test proxy.

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

描述

A very common and repeatedly encountered usecase is to create a bare project within a Meteor package that is used to manage headless mocha tests. There are multiple advantages:

  • the proxy projects allows to install and manage puppeteer for headless mocha tests
  • the proxy project allows to install and manage additional test tools, such as chai and sinon, helping to avoid Npm.depends in package.js
  • it automatically integrates with dependabot on GitHub for the (dev-/test-) dependencies installed in the proxy project
  • the proxy project allows to install and execute lint tools, such as oxlint or biome and other custom scripts (for example for docs generation) via npm scripts section, providing a neat way to include dev/test/docs tooling for package repos

The project itself contains no js files but just the package.json. Multiple examples can be found in Meteor Community Packages Repos, for example:

Here is a slightly modified example package.json from meteor roles:

{
  "name": "testapp2",
  "private": true,
  "scripts": {
    "setup": "mkdir -p packages && ln -sfn ../../ ./packages/meteor-roles",
    "test": "TEST_BROWSER_DRIVER=puppeteer meteor test-packages --raw-logs --once --driver-package meteortesting:mocha ./packages/meteor-roles",
    "test:watch": "TEST_BROWSER_DRIVER=puppeteer TEST_WATCH=1 meteor test-packages --raw-logs --driver-package meteortesting:mocha ./packages/meteor-roles",
    "test:coverage": "TEST_BROWSER_DRIVER=puppeteer TEST_CLIENT=1 TEST_SERVER=1 COVERAGE=1 COVERAGE_OUT_JSON=1 COVERAGE_OUT_HTML=1 COVERAGE_APP_FOLDER=$(pwd)/ meteor test-packages --raw-logs --once --driver-package meteortesting:mocha ./packages/meteor-roles",
    "report": "nyc report -t .coverage",
    "lint": "standard ../",
    "lint:fix": "standard --fix ../"
  },
  "dependencies": {
    "@babel/runtime": "7.25.6",
    "meteor-node-stubs": "1.2.9",
    "yuidocjs": "0.10.2"
  },
  "devDependencies": {
    "babel-plugin-istanbul": "^6.1.1",
    "chai": "^4.5.0",
    "chai-as-promised": "^7.1.2",
    "nyc": "^15.1.0",
    "puppeteer": "^19.11.1",
    "standard": "^17.1.0"
  },
  "babel": {
    "env": {
      "COVERAGE": {
        "plugins": [
          "istanbul"
        ]
      }
    }
  },
  "standard": {
    "ignore": [
      "**/.meteor/",
      "**/examples/",
      "**/testapp2",
      "**/testapp3",
      "**/docs"
    ]
  }
}

Such an example project could include..

  • the latest puppeteer, chai, and sinon as headless test-stack (note that meteortesting:mocha would still be needed as package.js level dependency)
  • oxlint (since many seem to favor it over biome) with some good Meteor-specific defaults
  • a bunch of useful scripts to setup and run lint and tests in several modes
  • a useful README that explains the stack, setup, and usage
  • what else?

Is this a useful candidate for examples?

主要语言
JavaScript
星标
143
派生
59
平均合并
5 天 1 小时
30 天内合并 PR
4

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

meteor/examples 的其他 Issue

查看 meteor/examples 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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