MCPcopy Create free account
hub / github.com/angular/components / getMatchingWarning

Function getMatchingWarning

src/material/core/theming/tests/m3-theme.spec.ts:55–61  ·  view source on GitHub ↗

* Gets first instance of the given warning reported in Sass. Dart sass directly writes * to the `process.stderr` stream, so we spy on the `stderr.write` method. We * cannot expect a specific amount of writes as Sass calls `stderr.write` multiple * times for a warning (e.g. spacing and stack trace

(message: RegExp)

Source from the content-addressed store, hash-verified

53 * times for a warning (e.g. spacing and stack trace)
54 */
55function getMatchingWarning(message: RegExp) {
56 const writeSpy = process.stderr.write as jasmine.Spy;
57 return (writeSpy.calls?.all() ?? []).find(
58 (s: jasmine.CallInfo<typeof process.stderr.write>) =>
59 typeof s.args[0] === 'string' && message.test(s.args[0]),
60 );
61}
62
63describe('M3 theme', () => {
64 it('should emit all styles under the given selector', () => {

Callers 1

expectNoWarningFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected