{"id":15017418,"url":"https://github.com/tpaksu/karma-code-reporter","last_synced_at":"2026-01-05T13:04:08.880Z","repository":{"id":57288387,"uuid":"109021803","full_name":"tpaksu/karma-code-reporter","owner":"tpaksu","description":"Prepares a test report which each failed case has it's own report and inline test case.","archived":false,"fork":false,"pushed_at":"2020-07-15T21:56:49.000Z","size":197,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T16:57:32.378Z","etag":null,"topics":["grunt","html","jasmine","javascript","karma","karma-reporter","npm-module","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpaksu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-31T16:19:00.000Z","updated_at":"2023-03-08T02:43:32.000Z","dependencies_parsed_at":"2022-09-06T15:41:21.923Z","dependency_job_id":null,"html_url":"https://github.com/tpaksu/karma-code-reporter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaksu%2Fkarma-code-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaksu%2Fkarma-code-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaksu%2Fkarma-code-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaksu%2Fkarma-code-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpaksu","download_url":"https://codeload.github.com/tpaksu/karma-code-reporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245007240,"owners_count":20546144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grunt","html","jasmine","javascript","karma","karma-reporter","npm-module","testing"],"created_at":"2024-09-24T19:50:25.996Z","updated_at":"2026-01-05T13:04:08.794Z","avatar_url":"https://github.com/tpaksu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# karma-code-reporter\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nPrepares a test report which each failed case has it's own report and inline test case. I tested this with grunt + karma + jasmine configuration and I don't know it works on other test runners like mocha etc. It's open for collaboration.\n\n## Screenshots\n![Spec File Preview](/screenshots/screenshot-index.png?raw=true \"Index File Preview\")\nIndex File Preview\n\n![Spec File Preview](/screenshots/screenshot-spec.png?raw=true \"Spec File Preview\")\nSpec File Preview\n\n## Installation\n\nThere are two installation options:\n\n1. Install using [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install karma-code-reporter --save-dev\n```\n\n\n2. Add `karma-code-reporter` as a `devDependency` inside your `package.json` file\n\n```json\n{\n    \"devDependencies\": {\n        \"karma-code-reporter\": \"~0.1.0\"\n    }\n}\n```\n\n## Options\n_\\* required_\n\n### outputPath*\n`(string)` Defines the path that the output files will be created at. The folder will contain an `index.html` file which contains a list for each failed test, and the `spec*.html` files which contain the live versions of failed tests and the related code portion.\n\n   ```text\n    [output folder]\n    |--\u003e index.html\n    |--\u003e spec1.html\n    |--\u003e spec2.html\n    .\n   ```\n\n### testFiles*\n`(array)` The test files which will be ignored during html generation. This is needed because we don't want any other test cases to interfere with the failing spec.\n\n### cssFiles\n`(array)` The extra css files which you want to include in the failed spec HTML files.\n\n### jsFiles\n`(array)` The extra javascript files which you want to include int the failed spec HTML files.\n\n## Configuration\n\nIf you use a `karma.conf.js` file to define karma configuration, you can add this plugin's configuration like this:\n\n```js\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    reporters: ['code'],\n    codeReporter: {\n        outputPath: 'tests/output/code',\n        testFiles: ['tests/*.test.js'],\n        cssFiles: ['build/css/style.min.css'],\n        jsFiles: ['build/js/script.min.js']\n    }\n  });\n};\n```\n\nOr if you are using `Gruntfile.js` to configure karma, you can use it **like** this:\n\n```js\nmodule.exports = function (grunt) {\n    // Project configuration.\n    grunt.initConfig({\n        karma: {\n            dist: {\n                options: {\n                    files: [],\n                    basePath: '',\n                    frameworks: ['jasmine'],\n                    reporters: ['progress', 'code'],\n                    port: 9876,\n                    colors: true,\n                    browsers: ['PhantomJS'],\n                    singleRun: true,\n                    codeReporter: {\n                        outputPath: 'tests/output/code',\n                        testFiles: ['tests/*.test.js'],\n                        cssFiles: ['build/css/caleran.min.css']\n                    }\n                }\n            }\n        }\n    });\n```\n## Contributing\nIn lieu of a formal styleguide take care to maintain the existing coding style.\n\n## Release History\n\n* 0.0.1 initial release\n* 0.0.2  added screenshots to README, fixed wrong version number in Installation section\n* 0.0.3  fixed bound calculation, added report visibility hidden until tests are completed\n* 0.0.4  added responsive styles\n* 0.0.5  split regexes for correct quote type handling\n* 0.0.6  removed 'UserContext' from log.stack parsing regex\n* 0.0.7  improved case surroundings detection (describe, beforeEach, afterEach)\n* 0.0.8  fixed source filename and line number parsing from log reports, updated lodash\n* 0.0.9  lodash security fix reported by dependabot\n* 0.0.10 previous version bump fixes, not so important\n\n* 0.1.0  - added more source line definitions such as \"@file?id:line:pos\" and \" at Anonymous function (file?id:line:pos) for parsing,\n         - added folder separation by browser type,\n         - fixed some exceptions\n* 0.1.1  - fixed index file title and path mismatch\n\n## Author\n\n[Taha PAKSU](http://tahapaksu.com)\n\n## License\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/karma-code-reporter.svg\n[npm-url]: https://npmjs.org/package/karma-code-reporter\n[node-version-image]: https://img.shields.io/node/v/karma-code-reporter.svg\n[node-version-url]: https://nodejs.org/en/download/\n[travis-image]: https://img.shields.io/travis/tpaksu/karma-code-reporter/master.svg\n[travis-url]: https://travis-ci.org/tpaksu/karma-code-reporter\n[coveralls-image]: https://img.shields.io/coveralls/tpaksu/karma-code-reporter/master.svg\n[coveralls-url]: https://coveralls.io/r/tpaksu/karma-code-reporter?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/karma-code-reporter.svg\n[downloads-url]: https://npmjs.org/package/karma-code-reporter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpaksu%2Fkarma-code-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpaksu%2Fkarma-code-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpaksu%2Fkarma-code-reporter/lists"}