NativeScript / NativeScript/nativescript-cli

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

Open
#5,472 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the listed ns create, ns test init --framework mocha, and ns test android commands. Review the karma-webpack 3.0.5 and @nativescript/webpack 4.0.0 requirements; done means the sample test runs without the webpack preprocessing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.