web-dev-qa-db-fra.com

Angular 6 tests de karma d'IntelliJ

Je viens de mettre à niveau mon application angulaire de la version 5.2 à la version 6 . Tout fonctionne correctement, mais lorsque j'ai essayé d'exécuter un test à partir d'IntelliJ, l'erreur suivante est générée:

Erreur: Le plug-in karma '@ angular-devkit/build-angular/plugins/karma' est destiné à être utilisé à partir de la CLI Angular et ne fonctionnera pas correctement en dehors de celle-ci.

Dans la version précédente, je pouvais exécuter le même test d'IntelliJ. 

Dans tous les cas, je peux exécuter les tests à partir de la ligne de commande, mais je voudrais résoudre ce problème.

Ceci est mon package.json:

{ "name": "projectname", "version": "1.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod", "build-prod": "ng build --output-hashing all --extract-css true --named-chunks false --sourcemaps false --environment prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@agm/core": "^1.0.0-beta.2", "@angular/animations": "6.0.0", "@angular/cdk": "6.0.1", "@angular/common": "6.0.0", "@angular/compiler": "6.0.0", "@angular/core": "6.0.0", "@angular/forms": "6.0.0", "@angular/http": "6.0.0", "@angular/material": "6.0.1", "@angular/platform-browser": "6.0.0", "@angular/platform-browser-dynamic": "6.0.0", "@angular/router": "6.0.0", "@types/d3": "^5.0.0", "angular-oauth2-oidc": "3.1.4", "angular2-jwt": "0.2.3", "bootstrap": "^4.0.0-beta.3", "clean-css": "^4.1.11", "core-js": "^2.4.1", "d3": "^4.13.0", "font-awesome": "^4.7.0", "hammerjs": "2.0.8", "jquery": "^3.3.1", "moment": "2.20.1", "ngx-bootstrap": "^2.0.2", "npm": "^5.7.1", "popper.js": "^1.12.9", "rxjs": "^6.1.0", "rxjs-compat": "^6.1.0", "tether": "1.4.3", "zone.js": "~0.8.26" }, "devDependencies": { "@angular/cli": "6.0.0", "@angular/compiler-cli": "6.0.0", "@angular/language-service": "6.0.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-reporters": "~2.3.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "karma-junit-reporter": "^1.2.0", "protractor": "~5.1.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "TypeScript": "2.7.2", "@angular-devkit/build-angular": "~0.6.0" }}

3
Ismael

Problème connu, provoqué par les modifications récentes de la CLI Angular. Voici un problème à ce sujet dans le référentiel angular-cli: https://github.com/angular/angular-cli/issues/10703 . Ticket JetBrains associé: WEB-32653 . Veuillez le suivre pour les mises à jour

5
lena

Bien que ce problème ait été résolu dans la version 2018.3, il me fallait modifier certains paramètres.

J'ai fini par résoudre ce problème dans Web Storm d'IntelliJ:

Exécuter> Modifier les configurations> Configurations Exécuter/Déboguer> Panneau de gauche (Seleck Karma et ce test spécifique)> modifiez le package karma en ~\Desktop\IronMan\Jarvis\node_modules\@angular\cli

Puis lancez le test de débogage pour un test spécifique . Vérifiez ceci -> https://github.com/angular/angular-cli/issues/12108

0
user3444999