NativeScript / NativeScript/nativescript-cli

Testing broken: webpack 4 vs webpack 3 requirement by karma-webpack 3.0.5

未关闭
#5,472 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

描述

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

✔ Component nativescript has 7.1.2 version and is up to date.
✔ Component @nativescript/core has 7.1.2 version and is up to date.
✖ Component @nativescript/ios is not installed.
✔ Component @nativescript/android has 7.0.1 version and is up to date

Describe the bug

ns test android fails with this karma error:
ERROR [preprocess]: Can not load "webpack"!
Because webpack 3 can't be installed side by side with webpack 4 (afaik?!). npm install correctly states that the peer dependency for webpack 3 (required by karma-webpack@3.0.5) needs to be installed manually.

  "dependencies": {
    "@nativescript/core": "~7.1.0",
    "@nativescript/theme": "~2.3.0",
    "@nativescript/unit-test-runner": "^1.0.2"
  },
  "devDependencies": {
    "@nativescript/android": "7.0.1",
    "@nativescript/webpack": "~4.0.0",
    "@types/karma-chai": "0.1.2",
    "@types/mocha": "8.2.0",
    "chai": "4.2.0",
    "karma": "6.0.0",
    "karma-chai": "0.1.0",
    "karma-mocha": "2.0.1",
    "karma-nativescript-launcher": "0.4.0",
    "karma-webpack": "3.0.5",
    "mocha": "8.2.1",
    "typescript": "~3.9.0"
  },

To Reproduce

ns create karmaissue --template @nativescript/template-blank-ts@7.0.4
cd karmaissue
ns test init --framework mocha
ns test android

Expected behavior
Sample test runs (karma doesn't throw an error)

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,使用列出的 ns createns test init --framework mochans test android 命令复现该问题。检查 karma-webpack 3.0.5 和 @nativescript/webpack 4.0.0 的要求;示例测试能够在没有 webpack 预处理错误的情况下运行即表示完成。

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

评估

技术栈
javascript, webpack
领域
cli, testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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