* 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)
| 53 | * times for a warning (e.g. spacing and stack trace) |
| 54 | */ |
| 55 | function 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 | |
| 63 | describe('M3 theme', () => { |
| 64 | it('should emit all styles under the given selector', () => { |