WebdriverIO:我们可以推送仅安装了依赖项的代码吗?

WebdriverIO : Can we push code with dependencies only installed?

我正在使用 webdriverIO v6

我只安装了这两个包:npm install @wdio/cli 和 webdriverio

我在本地的测试很顺利。

可以推送到 git 中的代码库吗,这在 Jenkis 或 Azure devops 中有效吗?

或者是否也需要安装 --save-dev 才能在 CI 工具中工作?

{
  "name": "test-package",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "wdio": "./node_modules/.bin/wdio wdio.conf.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@wdio/allure-reporter": "^6.1.23",
    "@wdio/cli": "^6.1.25",
    "@wdio/local-runner": "^6.1.25",
    "@wdio/mocha-framework": "^6.1.19",
    "@wdio/spec-reporter": "^6.1.23",
    "@wdio/sync": "^6.1.14",
    "chromedriver": "^83.0.1",
    "wdio-chromedriver-service": "^6.0.3",
    "webdriverio": "^6.1.25"
  },
  "dependencies": {}
}

这不是 wdio 特有的。这是一个已经在 nodejs 上下文中多次讨论的问题。

许多开发人员建议不要将 node_modules 包含在 repo 中,因为各种合乎逻辑的原因。那么有一些理由可能会迫使你这样做。如果您这样做只是为了减少构建时间,请为其他影响做好准备。以下是可能对您有帮助的链接。

https://flaviocopes.com/should-commit-node-modules-git/

Should "node_modules" folder be included in the git repository