Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: karma-runner/karma
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.3.7
Choose a base ref
...
head repository: karma-runner/karma
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.3.8
Choose a head ref
  • 4 commits
  • 9 files changed
  • 3 contributors

Commits on Nov 1, 2021

  1. build: use matching commitlint config

    The commit conventions enforced by commitlint (conventional) were different than the conventions used by the semantic-release (angular). In practice, is was never a problem as they are pretty similar, but it's better to be consistent anyways. Update the commit conventions documentation according to the change and also extend it with the information about which kind of release is triggered by which commit type. Add explicit configuration for release rules for semantic-release to the configuration file - rules are the same as before, but now it is easier to see what they actually are.
    devoto13 committed Nov 1, 2021
    Copy the full SHA
    a2261bb View commit details

Commits on Nov 2, 2021

  1. build: remove husky and validation hooks

    Previously, we relied on husky package to set up the Git hooks to automatically lint code and check the commit message conventions. While it is a nice feature it causes extra delays on commit/push for more experienced contributors and we still get many PRs with incorrect commit messages from the first-time contributors. Given the above reasons remove the husky dependency, Git hooks and replace them with a script which can be used locally. Note that CI continues to validate the commit message conventions as before.
    devoto13 committed Nov 2, 2021
    Copy the full SHA
    4c6f681 View commit details

Commits on Nov 4, 2021

  1. fix(reporter): warning if stack trace contains generated code invocation

    For some projects, a preprocessor like TypeScript may run to downlevel
    certain features to a lower ECMAScript target. e.g. a project may
    consume Angular for example, which ships ES2020.
    
    If TypeScript, ESBuild, Babel etc. is used to do this, they may inject
    generated code which does not map to any original source. If any of
    these helpers (the generated code) is then part of a stack trace, Karma
    will incorrectly report an error for an unresolved source map position.
    
    Generated code is valid within source maps and can be denoted as
    mappings with a 1-variable-length mapping. See the source map spec:
    https://sourcemaps.info/spec.html.
    
    The warning for generated code is especially bad when the majority of
    file paths, and the actually relevant-portions in the stack are
    resolved properly. e.g.
    
    Errors initially look like this without the source mapping processing
    of Karma:
    
    (See PR description as commit lint does not allow for long stack
    traces..)
    
    A helper function shows up in the stacktrace but has no original mapping as it is
    purely generated by TypeScript/ESbuild etc. The following warning is
    printed and pollutes the test output while the remaining stack trace
    paths (as said before), have been remapped properly:
    
    ```
    SourceMap position not found for trace: http://localhost:9877/base/angular_material/
      src/material/select/testing/unit_tests_bundle_spec.js:26:26
    ```
    
    The resolved stacktrace looks like this after the transformation:
    
    (see PR description as commit lint does not allow for long stack traces
    here..)
    
    More details on the scenario here:
    https://gist.github.com/devversion/549d25915c2dc98a8896ba4408a1e27c.
    devversion authored and Jonathan Ginsburg committed Nov 4, 2021
    Copy the full SHA
    4f23b14 View commit details

Commits on Nov 7, 2021

  1. chore(release): 6.3.8 [skip ci]

    ## [6.3.8](v6.3.7...v6.3.8) (2021-11-07)
    
    ### Bug Fixes
    
    * **reporter:** warning if stack trace contains generated code invocation ([4f23b14](4f23b14))
    semantic-release-bot committed Nov 7, 2021
    Copy the full SHA
    8f798d5 View commit details
Showing with 156 additions and 297 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −1 commitlint.config.js
  3. +6 −3 docs/dev/02-making-changes.md
  4. +20 −23 docs/dev/06-git-commit-msg.md
  5. +11 −2 lib/reporter.js
  6. +11 −257 package-lock.json
  7. +4 −10 package.json
  8. +21 −1 release.config.js
  9. +75 −0 test/unit/reporter.spec.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [6.3.8](https://github.com/karma-runner/karma/compare/v6.3.7...v6.3.8) (2021-11-07)


### Bug Fixes

* **reporter:** warning if stack trace contains generated code invocation ([4f23b14](https://github.com/karma-runner/karma/commit/4f23b14d3e774c0401f2c9eecb188b37aed020eb))

## [6.3.7](https://github.com/karma-runner/karma/compare/v6.3.6...v6.3.7) (2021-11-01)


2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
module.exports = { extends: ['@commitlint/config-angular'] }
9 changes: 6 additions & 3 deletions docs/dev/02-making-changes.md
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ TODO:

If you are thinking about making Karma better, or you just want to hack on it, that’s great!
Here are some tips on how to set up a Karma workspace and how to send a good pull request.
**Please note we enforce [commit message conventions].**

## Setting up the Workspace

@@ -66,11 +65,15 @@ change the code, run the tests, etc.

## Sending a Pull Request

- Commit your changes (**please follow our [commit message conventions]**):
- Commit your changes (please follow [commit message conventions]):
```bash
$ git commit -m "..."
```
- Push to your github repo:
- Verify that the last commit follows the conventions:
```bash
$ npm run commit:check
```
- Push to your GitHub repo:
```bash
$ git push origin <branch_name>
```
43 changes: 20 additions & 23 deletions docs/dev/06-git-commit-msg.md
Original file line number Diff line number Diff line change
@@ -2,16 +2,18 @@
showInMenu: false
---

In the repository we use and enforce the commit message conventions. The conventions are verified using [commitlint] with [Angular config](https://www.npmjs.com/package/@commitlint/config-angular).

## The reasons for these conventions:
- automatic generating of the changelog
- simple navigation through git history (e.g. ignoring style changes)

## Format of the commit message:
```bash
<type>(<scope>): <subject>

<BLANK LINE>
<body>

<BLANK LINE>
<footer>
```

@@ -27,19 +29,18 @@ Fixes #2310
```

## Message subject (first line)
The first line cannot be longer than 70 characters, the second line is always blank and
other lines should be wrapped at 80 characters. The type and scope should
always be lowercase as shown below.
The first line cannot be longer than 72 characters and should be followed by a blank line. The type and scope should always be lowercase as shown below.

### Allowed `<type>` values:

* **feat** (new feature for the user, not a new feature for build script)
* **fix** (bug fix for the user, not a fix to a build script)
* **docs** (changes to the documentation)
* **style** (formatting, missing semi colons, etc; no production code change)
* **refactor** (refactoring production code, eg. renaming a variable)
* **test** (adding missing tests, refactoring tests; no production code change)
* **chore** (updating grunt tasks etc; no production code change)
* **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version.
* **fix** for a bug fix for the user, not a fix to a build script. Such commit will trigger a release bumping a PATCH version.
* **perf** for performance improvements. Such commit will trigger a release bumping a PATCH version.
* **docs** for changes to the documentation.
* **style** for formatting changes, missing semicolons, etc.
* **refactor** for refactoring production code, e.g. renaming a variable.
* **test** for adding missing tests, refactoring tests; no production code change.
* **build** for updating build configuration, development tools or other changes irrelevant to the user.

### Example `<scope>` values:

@@ -55,16 +56,9 @@ The `<scope>` can be empty (e.g. if the change is a global or difficult
to assign to a single component), in which case the parentheses are
omitted. In smaller projects such as Karma plugins, the `<scope>` is empty.


## Message body
* uses the imperative, present tense: “change” not “changed” nor “changes”
* includes motivation for the change and contrasts with previous behavior

For more info about message body, see:

* https://365git.tumblr.com/post/3308646748/writing-git-commit-messages
* https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Just as in the `<subject>`, use the imperative, present tense: "change" not "changed" nor "changes". Message body should include motivation for the change and contrasts with previous behavior.

## Message footer

@@ -91,10 +85,13 @@ To migrate your project, change all the commands, where you use `--port-runner`
to `--runner-port`.
```

Any commit with the breaking change section will trigger a MAJOR release and appear on the changelog independently of the commit type.

---

This document is based on [AngularJS Git Commit Msg Convention]. See the
[commit history] for examples of properly-formatted commit messages.
This document is based on [Angular Commit Message Format]. See the [commit history] for examples of properly-formatted commit messages.

[AngularJS Git Commit Msg Convention]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[commitlint]: https://conventional-changelog.github.io/commitlint/
[Angular config]: https://www.npmjs.com/package/@commitlint/config-angular
[Angular Commit Message Format]: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
[commit history]: https://github.com/karma-runner/karma/commits/master
13 changes: 11 additions & 2 deletions lib/reporter.js
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ function createErrorFormatter (config, emitter, SourceMapConsumer) {
input = JSON.stringify(input, null, indentation)
}

let msg = input.replace(URL_REGEXP, function (_, prefix, path, __, ___, line, ____, column) {
let msg = input.replace(URL_REGEXP, function (stackTracePath, prefix, path, __, ___, line, ____, column) {
const normalizedPath = prefix === 'base/' ? `${basePath}/${path}` : path
const file = lastServedFiles.find((file) => file.path === normalizedPath)

@@ -64,12 +64,21 @@ function createErrorFormatter (config, emitter, SourceMapConsumer) {
const zeroBasedColumn = Math.max(0, (column || 1) - 1)
const original = getSourceMapConsumer(file.sourceMap).originalPositionFor({ line, column: zeroBasedColumn, bias })

// If there is no original position/source for the current stack trace path, then
// we return early with the formatted generated position. This handles the case of
// generated code which does not map to anything, see Case 1 of the source-map spec.
// https://sourcemaps.info/spec.html.
if (original.source === null) {
return PathUtils.formatPathMapping(path, line, column)
}

// Source maps often only have a local file name, resolve to turn into a full path if
// the path is not absolute yet.
const oneBasedOriginalColumn = original.column == null ? original.column : original.column + 1
return `${PathUtils.formatPathMapping(resolve(path, original.source), original.line, oneBasedOriginalColumn)} <- ${PathUtils.formatPathMapping(path, line, column)}`
} catch (e) {
log.warn(`SourceMap position not found for trace: ${input}`)
log.warn(`An unexpected error occurred while resolving the original position for: ${stackTracePath}`)
log.warn(e)
}
}

Loading