mkdir app02 cd app02 npm install karma --save-dev
mkdir js mkdir test
karma init
A fájlok listázása:
files: [ 'test/**/*.js', 'js/**/*.js' ],
describe('Második teszt', function() { it('eredmény 3 kell legyen', function() { expect(calc(3)).toBe(3); }); it('eredmény 6 kell legyen', function() { expect(calc(6)).toBe(6); }); })
var calc = (num) => { return num; }
karma start karma.conf.js
Lehetséges kimenet:
$ karma start karma.conf.js 01 09 2021 20:49:06.160:WARN [karma]: No captured browser, open http://localhost:9876/ 01 09 2021 20:49:06.204:INFO [karma-server]: Karma v6.3.4 server started at http://localhost:9876/ 01 09 2021 20:49:06.205:INFO [launcher]: Launching browsers Chrome with concurrency unlimited 01 09 2021 20:49:06.210:INFO [launcher]: Starting browser Chrome 01 09 2021 20:49:07.688:INFO [Chrome 92.0.4515.159 (Linux x86_64)]: Connected on socket JvxawnjOZvGWUB2MAAAB with id 62519543 Chrome 92.0.4515.159 (Linux x86_64): Executed 3 of 3 SUCCESS (0.034 secs / 0.005 secs) TOTAL: 2 SUCCESS