1

I'm implementing unit tests within an ionic3 project based on the following sample project: https://github.com/ionic-team/ionic-unit-testing-example.

It works fine but I have some issues:

  • I can see compilation errors (for jasmine) whereas these ones don't prevent from running tests

    karma start ./test-config/karma.conf.js
    webpack: Compiled successfully.
    webpack: Compiling...
    
    17 03 2018 15:53:18.403:WARN [karma]: No captured browser, open http://localhost:9876/
    
    ERROR in ./src/pages/test/test.spec.ts
    [tsl] ERROR in /home/app-path/src/pages/test/test.spec.ts(11,1)
    TS2304: Cannot find name 'describe'.
    
    ERROR in ./src/pages/test/test.spec.ts
    [tsl] ERROR in /home/app-path/src/pages/test/test.spec.ts(17,3)
    TS2304: Cannot find name 'beforeEach'.
    
    ERROR in ./src/pages/test/test.spec.ts
    [tsl] ERROR in /home/app-path/src/pages/test/test.spec.ts(40,39)
    TS2304: Cannot find name 'expect'.
    
    ERROR in ./src/pages/test/test.spec.ts
    [tsl] ERROR in /home/app-path/src/pages/test/test.spec.ts(42,3)
    TS2304: Cannot find name 'it'.
    
    ...
    
    webpack: Failed to compile.
    17 03 2018 15:53:18.422:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
    17 03 2018 15:53:18.422:INFO [launcher]: Launching browser Chrome with unlimited concurrency
    17 03 2018 15:53:18.748:INFO [launcher]: Starting browser Chrome
    17 03 2018 15:53:20.153:INFO [Chrome 57.0.2987 (Linux 0.0.0)]: Connected on socket py7H3olXgBzYBE2DAAAA with id 24040166
    Chrome 57.0.2987 (Linux 0.0.0): Executed 8 of 8 SUCCESS (2.716 secs / 0 secs)
    
  • I can't display results in the browser launched by karma even if I have the kjhtml reporter configured. See https://github.com/ionic-team/ionic-unit-testing-example/blob/master/test-config/karma.conf.js#L52. Note I added the progress reporter and it works fine:

    reporters: ['progress', 'kjhtml'],
    

Thanks for your help!

Thierry Templier
  • 198,364
  • 44
  • 396
  • 360

0 Answers0