Skip to content

Commit

Permalink
Bugfixes and small enhancements (#11)
Browse files Browse the repository at this point in the history
Bugfixes for #7 #9 #10, and a couple of other small fixes and enhancements
  • Loading branch information
lucono authored Nov 7, 2021
1 parent f6d3884 commit 76a1e93
Show file tree
Hide file tree
Showing 44 changed files with 3,326 additions and 1,932 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: 'bug'
assignees: ''

---
Expand All @@ -22,9 +22,10 @@ assignees: ''

- A clear and concise description of what you expected to happen.

**Debug Logs**
**Provide Debug Logs**

- With the `karmaTestExplorer.logLevel` set to `debug`, please capture and attach the logs from the `Karma Test Explorer` Output panel.
- With the `karmaTestExplorer.logLevel` set to `debug`, please capture and attach the logs from the `Karma Test Explorer` Output chanel when the issue occurs.
- Please also capture and attach the logs from the `Karma Server` Output channel when the issue occurs.

**Screenshots**

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run check-format
- run: npm run lint
- run: npm run clean
- run: npm run build
- run: npm test
- run: npm run test
- run: npm run bundle
- run: npm run package

- uses: actions/upload-artifact@v2
with:
name: packaged-vsix
name: vsix-artifact-${{ matrix.os }}-node-${{ matrix.node-version }}
path: ./*.vsix
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,42 @@ The format of this changelog is loosely based on [Keep a Changelog](https://keep
<details>
<summary>Releases</summary>

- [0.3.0 - Nov 6, 2021](#030---nov-6-2021)
- [0.2.1 - Oct 24, 2021](#021---oct-24-2021)
- [0.2.0 - Oct 13, 2021](#020---oct-13-2021)
- [0.1.0 - Sep 28, 2021](#010---sep-28-2021)
</details>


---
## [0.3.0] - Nov 6, 2021

### Added

- New `karmaTestExplorer.nonHeadlessModeEnabled` extension setting for running tests in non-Headless mode
- New `karmaTestExplorer.karmaReporterLogLevel` extension setting for specifying the level of logging detail for Karma Test Explorer's Karma reporter plugin

### Changed

- Karma Test Explorer is now only activated for a workspace folder if it contains one or more Karma Test Explorer configuration settings, or a known standard config file for Karma or Angular projects exists somewhere under the project folder tree, with the exclusion of the `node_modules` folder

### Fixed

- Fixed an [issue](https://github.com/lucono/karma-test-explorer/issues/9) where the extension fails to start for Windows users if the user's profile path contains a space
- Fixed an [issue](https://github.com/lucono/karma-test-explorer/issues/10) where test discovery or execution sometimes fails on a Karma error indicating that some of the tests performed a full page reload
- Fixed an [issue](https://github.com/lucono/karma-test-explorer/issues/7) where some Karma reporters configured in the user's Karma config file would cause the extension to fail to start
- Fixed an issue which increases the number of test failure scenarios where the precise test expectation that failed can be highlighted. Previously, only the parent test containing the failed expectation was ever highlighted
- Fixed an issue where changes to test files, and changes to the Karma config and other watched files, were not always detected and reflected in the test view and did not always trigger the appropriate refresh behavior

---
## [0.2.1] - Oct 24, 2021

### Changed

- Test duplication is only now reported for tests but no longer reported for test suites because test suites are simply containers for tests, so that duplicated test suites are themselves not an indication that actual tests have also been duplicated
- Test duplication is no longer reported for test suites because test suites are simply containers for tests, so that duplicated test suites are themselves not an indication of actual test duplication

### Fixed

- Fixed an issue where test duplicate detection was producing false-positives on Windows (thanks [@nwash57](https://github.com/nwash57)!)
- Fixed an issue where some tests may not always be discovered on Windows

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Recommended Areas of Focus

Contributions to the Karma Test Explorer are welcome, particularly in the core areas of focus mentioned in the [Why this Extension](#why-this-extension) section. Other particular areas, among others, include:
Contributions to the Karma Test Explorer are welcome, particularly in the core areas of focus mentioned in the [Why this Extension](./README.md#why-this-extension) section. Other particular areas, among others, include:

- Migrating to the native VS Code test API
- Enhancing the level of Angular and Mocha support
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This extension lets you run your Karma or Angular tests in Visual Studio Code us
- Karma version 6 support
- Support for [Dev Containers](https://code.visualstudio.com/docs/remote/containers)
- Watch mode support with auto pass / fail test status update
- Non-Headless testing mode
- Group and run tests by folder or by test suite
- Duplicate test detection and reporting
- Specify or override environment variables for Karma
Expand Down Expand Up @@ -89,7 +90,14 @@ Special thanks to the [author](https://github.com/Raagh) and contributors of the

## Reporting Issues

If you encounter any problems using Karma Test Explorer, would like to request a feature, or have any questions, please open an issue [here](https://github.com/lucono/karma-test-explorer/issues/new).
If you encounter any problems using Karma Test Explorer, would like to request a feature, or have any questions, please open an issue [here](https://github.com/lucono/karma-test-explorer/issues/new/choose).

---
If you like the Karma Test Explorer extension, please consider rating it in the [marketplace](https://marketplace.visualstudio.com/items?itemName=lucono.karma-test-explorer), and starring the [GitHub repo](https://github.com/lucono/karma-test-explorer).

---

<a href="#contents"><img align="right" height="24" src="docs/img/back-to-top.png"></a>

## See Also

Expand Down
25 changes: 19 additions & 6 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Configuration](#configuration)
- [Specifying Test Files](#specifying-test-files)
- [Specifying a Test Framework](#specifying-a-test-framework)
- [Non-Headless Testing](#non-headless-testing)
- [Testing in a Development Container](#testing-in-a-development-container)
- [Output Panels](#output-panels)
- [Known Issues and Limitations](#known-issues-and-limitations)
Expand Down Expand Up @@ -50,13 +51,13 @@ Note that Karma Test Explorer will briefly display updates (using available spac

## Project Types

### Karma Projects
Projects without an `angular.json` or `.angular-cli.json` file in the project root are treated as plain Karma projects. Use the various [extension options](#configuration) where necessary to customize Karma Test Explorer's behavior to the specific needs of your project and team.

### Angular Projects

By default, any project with an `angular.json` or `.angular-cli.json` file in the project root is loaded as an Angular project. Use the `karmaTestExplorer.defaultAngularProjectName` setting to specify which configured Angular project should be loaded for testing. Otherwise, the project specified as default in the `angular.json` config will be chosen.

### Non-Angular Projects
Projects without an `angular.json` or `.angular-cli.json` file in the project root are treated as plain Karma projects. Use the various [extension options](#configuration) where necessary to customize Karma Test Explorer's behavior to the specific needs of your project and team.

<a href="#contents"><img align="right" height="24" src="img/back-to-top.png"></a>

---
Expand Down Expand Up @@ -97,12 +98,13 @@ Setting | Description
`karmaTestExplorer.customLauncher` | Specify the karma custom launcher configuration for launching the test browser, similar to a custom launcher entry in a karma config file
`karmaTestExplorer.autoWatchEnabled` | Enables automatic re-run of tests when the files change
`karmaTestExplorer.autoWatchBatchDelay` | The delay in milliseconds when autoWatch is enabled for batching multiple file changes into a single rerun. This is the same as Karma config's `autoWatchBatchDelay` option and overrides it when set
`karmaTestExplorer.nonHeadlessModeEnabled` | Enables non-headless testing so that the browser UI is displayed when running tests. Has no effect when running in a container, or when the default value of the `customLauncher` or `browser` config settings are overridden
`karmaTestExplorer.env` | Additional environment variables to be set when running the tests. These override the values of the same variables if also provided through the `envFile` setting
`karmaTestExplorer.envFile` | Path to a dotenv file containing environment variables to be set when running the tests
`karmaTestExplorer.karmaProcessCommand` | The command or path to an executable to use for launching Karma. This is useful for using a custom script or different command other than the default
`karmaTestExplorer.angularProcessCommand` | The command or path to an executable to use for launching or running Angular tests. This is useful for using a custom script or different command other than the default
`karmaTestExplorer.testTriggerMethod` | Experimental. Specifies how test runs are triggered by default, either through the Karma CLI or Http interface. You will usually not need to use this setting unless working around specific issues
`karmaTestExplorer.failOnStandardError` | Treats any errors written to stderr as a failure. This can sometimes be useful for uncovering testing issues
`karmaTestExplorer.failOnStandardError` | Treats any Karma, Angular, or other testing stderr output as a failure. This can sometimes be useful for uncovering testing issues
`karmaTestExplorer.testsBasePath` | The base folder containing the test files (relative to `projectRootPath`)
`karmaTestExplorer.testFiles` | The path glob patterns identifying the test files (relative to `projectRootPath`)
`karmaTestExplorer.excludeFiles` | The path glob patterns identifying files to be excluded from `testFiles` (relative to `projectRootPath`)
Expand All @@ -114,6 +116,7 @@ Setting | Description
`karmaTestExplorer.containerMode` | Enables additional support for easier testing when running in a container. Can be either `auto` (the default when not set), `enabled`, or `disabled`
`karmaTestExplorer.logLevel` | Sets the level of logging detail produced in the output panel of the extension. More detailed levels such as the `debug` level can be helpful when troubleshooting issues with running Karma or the extension
`karmaTestExplorer.karmaLogLevel` | Sets the level of logging detail for the Karma server in its output channel, which can be helpful when troubleshooting issues with running Karma or the extension
`karmaTestExplorer.karmaReporterLogLevel` | Sets the level of logging detail for the Karma Test Explorer reporter which logs additional details to the Karma server log related to the processing of test and browser events in Karma. This can be helpful when troubleshooting issues with how test and browser events are being processed in Karma and exchanged with the Karma Test Explorer. Set this to `disable` in order to not log any additional output from the reporter into the Karma server logs

<a href="#contents"><img align="right" height="24" src="img/back-to-top.png"></a>

Expand All @@ -138,7 +141,7 @@ For example, the following files would all be detected as test files by default,

### Customizing Test Discovery

However, you can change this to the specific name pattern and paths of your test files by using the `karmaTestExplorer.testFiles` extension setting, which accepts an array of file glob patterns that identify the locations of your test files.
You can change the default test discovery behavior by customizing test file detection to the specific name pattern and paths for your test files by using the `karmaTestExplorer.testFiles` extension setting, which accepts an array of file glob patterns that identify the locations of your test files.

For example:

Expand Down Expand Up @@ -170,6 +173,16 @@ Most times however, you will not need to set this config option at all as Karma

---

## Non-Headless Testing

Though by default Karma Test Explorer runs tests headlessly (using a headless instance of Chrome), it also has support for non-headless testing which can be enabled with the `karmaTestExplorer.nonHeadlessModeEnabled` setting. When this is enabled, the browser UI will be displayed when Karma Test Explorer is started, and you will be able to see your tests being executed in the browser.

Non-headless testing through the `nonHeadlessModeEnabled` setting is not supported in certain scenarios where non-headless usage would normaly not be possible, such as when running in a container. It is also not supported when the default value of the `customLauncher` or `browser` config settings have been overridden to use a non-Chrome browser, which is the default browser used by Karma Test Explorer. It is however supported in all other cases, including when running on WSLg (Windows Subsystem for Linux GUI) on Windows 11.

Also note that for regular headless testing, Karma Test Explorer supports any browser (Chrome or non-Chrome) with a Karma launcher implementation that is installed in the project, including Firefox, Edge, and others.

---

## Testing in a Development Container

With VS Code's Development Container feature, you can develop and run your project's Karma tests inside a container, using browsers installed in that container. However, launching Chrome and other Chromium browsers in a container environment often requires additional browser flags and other adjustments. Therefore, to fully support DevContainer-based setups and workflows, Karma Test Explorer provides a number of options to help make development and testing smoother and more seamless in those scenarios.
Expand Down Expand Up @@ -241,7 +254,7 @@ Karma Test Explorer adds the output channels described below to the Output panel
Name | Description
-----|-------------
Karma&nbsp;Test&nbsp;Explorer | This output panel shows the logs of the Karma Test Explorer extension. The `karmaTestExplorer.logLevel` setting can be used to set the desired level of extension logging detail, with `trace` having the most detailed and verbose logging.
Karma&nbsp;Server | This output panel shows the Karma server log. The `karmaTestExplorer.karmaLogLevel` can be used to set the level of logging detail desired from the Karma server.
Karma&nbsp;Server | This output panel shows the Karma server log. The `karmaTestExplorer.karmaLogLevel` setting can be used to specify the desired level of logging detail from the Karma server, while the `karmaTestExplorer.karmaReporterLogLevel` setting can be used to specify the desired level of logging detail from Karma Test Explorer's Karma reporter plugin, whose output also appears in the Karma server log.

<a href="#contents"><img align="right" height="24" src="img/back-to-top.png"></a>

Expand Down
Loading

0 comments on commit 76a1e93

Please sign in to comment.