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 摘要。