Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda