<commit_before># karma-stacktrace
[![npm](https://img.shields.io/npm/v/karma-stacktrace.svg?style=flat-square)]()
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/sergei-startsev/karma-stacktrace/master/LICENSE)

## What
Provides readable mapped stacktrace for failed tests to debug the them in your browser.

## Motivation
Test frameworks like [QUnit](https://qunitjs.com/) and [Jasmine](http://jasmine.github.io/) use [non-standard](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) `stack` property of `Error` object to output a stacktrace for failed unit tests. Modern browsers do not apply sourcemaps to `Error.prototype.stack` and unmapped stacktrace looks useless.

An example of an unmapped stacktrace:

![Original stacktrace](./stacktrace-original.png "Original stacktrace")

The framework catches failed tests and reports mapped stacktrace by using [stacktrace-js](https://www.stacktracejs.com/) library:
<commit_msg>docs: add github actions status<commit_after># karma-stacktrace
![actions](https://github.com/sergei-startsev/karma-stacktrace/workflows/Node%20CI/badge.svg)
![npm](https://img.shields.io/npm/v/karma-stacktrace)
![GitHub](https://img.shields.io/github/license/sergei-startsev/karma-stacktrace)

## What
Provides readable mapped stacktrace for failed tests to debug the them in your browser.

## Motivation
Test frameworks like [QUnit](https://qunitjs.com/) and [Jasmine](http://jasmine.github.io/) use [non-standard](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) `stack` property of `Error` object to output a stacktrace for failed unit tests. Modern browsers do not apply sourcemaps to `Error.prototype.stack` and unmapped stacktrace looks useless.

An example of an unmapped stacktrace:

![Original stacktrace](./stacktrace-original.png "Original stacktrace")

The framework catches failed tests and reports mapped stacktrace by using [stacktrace-js](https://www.stacktracejs.com/) library:

{'fraction_non_alphanumeric': 0.12847555129434324, 'fraction_numerical': 0.0009587727708533077, 'mean_word_length': 5.689102564102564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1930389', 'n_tokens_mistral': 646, 'n_tokens_neox': 613, 'n_words': 160}