-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add option to start karma without browser (#17912)
Adds a way to start Karma without a browser. Similar to `yarn gulp test:static`. The targets can be run the following way and work with `ibazel` watch mode. `yarn ibazel run src/cdk/a11y:unit_tests_local`.
- Loading branch information
1 parent
26e73ac
commit 993a027
Showing
3 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Karma configuration that is used by Bazel karma_web_test targets which do not | ||
* want to launch any browser and just enable manual browser debugging. | ||
*/ | ||
|
||
module.exports = config => { | ||
const overwrites = {}; | ||
|
||
// By default "@bazel/karma" configures Chrome as browser. Since we don't want | ||
// to launch any browser at all, we overwrite the "browsers" option. Since the | ||
// default config tries to extend the browsers array with "Chrome", we need to | ||
// always return a new empty array. | ||
Object.defineProperty(overwrites, 'browsers', { | ||
get: () => [], | ||
set: () => {}, | ||
enumerable: true | ||
}); | ||
|
||
// Ensures that tests start executing once browsers have been manually connected. We need | ||
// to use "defineProperty" because the default "@bazel/karma" config overwrites the option. | ||
Object.defineProperty(overwrites, 'autoWatch', { | ||
value: true, | ||
writable: false, | ||
}); | ||
|
||
config.set(overwrites); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters