Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
Angular4 junit test with karma : does not load javascript

I've converted my project to angular 4 / angular-cli 1.0.0 And since then, I have a strange behavior when I want to run the tests

my config :

 @angular/cli: 1.0.1 
 node: 7.8.0
 os: win32 x64
 @angular/common: 4.0.3
 @angular/compiler: 4.0.3
 @angular/core: 4.0.3
 @angular/forms: 4.0.3
 @angular/http: 4.0.3
 @angular/platform-browser: 4.0.3
 @angular/platform-browser-dynamic: 4.0.3
 @angular/router: 4.0.3
 @angular/cli: 1.0.1
 @angular/compiler-cli: 4.0.3

my karma.config.js

 module.exports = function (config) {
   config.set({
   basePath: '',
   frameworks: ['jasmine', '@angular/cli'],
   plugins: [
    require('karma-jasmine'),
    require('karma-phantomjs-launcher'),
    require('karma-firefox-launcher'),
    require('karma-chrome-launcher'),
    require('@angular/cli/plugins/karma'),
    require('karma-jasmine-html-reporter'),
    require('karma-coverage-istanbul-reporter')
    ],
   client:{
       clearContext: false // leave Jasmine Spec Runner output visible in 
        browser
   },
   files: [
      { pattern: './src/test.ts', watched: false }
   ],
   preprocessors: {
      './src/test.ts': ['@angular/cli']
   },
   mime: {
     'text/x-typescript': ['ts','tsx']
   },   
   coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ]
   },
   reporters: config.angularCli && config.angularCli.codeCoverage
          ? ['progress', 'coverage-istanbul']
          : ['progress'],
   port: 9876,
   colors: true,
   logLevel: config.LOG_INFO,
   autoWatch: true,
   browsers: ['PhantomJS','Firefox','Chrome'],
   singleRun: false
  });
 };

when i launch test with ng test --browsers Chrome No test run (nut there is no errors),it seems that he does not find any test enter image description here

indeed , in browser , i don't see my javascripts

enter image description here

BUT when i modify one of junit test (xxx.psec.ts with an editor) (by adding a space line), the javascripts are loaded in browser enter image description here

and my tests are running enter image description here

why are not my tests running at first time?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda