494
);
495
expect(mockLog.mock.calls[0]).toHaveLength(1);
496
expect(mockLog.mock.calls[0][0]).toBe('log');
497
- expect(mockLog.mock.calls[1]).toHaveLength(2);
498
- expect(mockLog.mock.calls[1][0]).toBe('%clog');
497
+ expect(mockLog.mock.calls[1]).toEqual([
498
+ '%c%s',
499
+ `color: ${process.env.DARK_MODE_DIMMED_LOG_COLOR}`,
500
+ 'log',
501
+ ]);
502
503
expect(mockWarn).toHaveBeenCalledTimes(2);
504
expect(mockWarn.mock.calls[0]).toHaveLength(1);
505
expect(mockWarn.mock.calls[0][0]).toBe('warn');
503
- expect(mockWarn.mock.calls[1]).toHaveLength(2);
504
- expect(mockWarn.mock.calls[1][0]).toBe('%cwarn');
506
+ expect(mockWarn.mock.calls[1]).toHaveLength(3);
507
+ expect(mockWarn.mock.calls[1]).toEqual([
508
+ '%c%s',
509
+ `color: ${process.env.DARK_MODE_DIMMED_WARNING_COLOR}`,
510
+ 'warn',
511
+ ]);
512
513
expect(mockError).toHaveBeenCalledTimes(2);
514
expect(mockError.mock.calls[0]).toHaveLength(1);
515
expect(mockError.mock.calls[0][0]).toBe('error');
509
- expect(mockError.mock.calls[1]).toHaveLength(2);
510
- expect(mockError.mock.calls[1][0]).toBe('%cerror');
516
+ expect(mockError.mock.calls[1]).toHaveLength(3);
517
+ expect(mockError.mock.calls[1]).toEqual([
518
+ '%c%s',
519
+ `color: ${process.env.DARK_MODE_DIMMED_ERROR_COLOR}`,
520
+ 'error',
521
+ ]);
522
});
523
524
it('should not double log if hideConsoleLogsInStrictMode is enabled in Strict mode', () => {
588
expect(mockLog).toHaveBeenCalledTimes(2);
589
expect(mockLog.mock.calls[0]).toHaveLength(1);
590
expect(mockLog.mock.calls[0][0]).toBe('log');
580
- expect(mockLog.mock.calls[1]).toHaveLength(2);
581
- expect(mockLog.mock.calls[1][0]).toBe('%clog');
591
+ expect(mockLog.mock.calls[1]).toHaveLength(3);
592
+ expect(mockLog.mock.calls[1]).toEqual([
593
+ '%c%s',
594
+ `color: ${process.env.DARK_MODE_DIMMED_LOG_COLOR}`,
595
+ 'log',
596
+ ]);
597
598
expect(mockWarn).toHaveBeenCalledTimes(2);
599
expect(mockWarn.mock.calls[0]).toHaveLength(1);
600
expect(mockWarn.mock.calls[0][0]).toBe('warn');
586
- expect(mockWarn.mock.calls[1]).toHaveLength(2);
587
- expect(mockWarn.mock.calls[1][0]).toBe('%cwarn');
601
+ expect(mockWarn.mock.calls[1]).toHaveLength(3);
602
+ expect(mockWarn.mock.calls[1]).toEqual([
603
+ '%c%s',
604
+ `color: ${process.env.DARK_MODE_DIMMED_WARNING_COLOR}`,
605
+ 'warn',
606
+ ]);
607
608
expect(mockError).toHaveBeenCalledTimes(2);
609
expect(mockError.mock.calls[0]).toHaveLength(1);
610
expect(mockError.mock.calls[0][0]).toBe('error');
592
- expect(mockError.mock.calls[1]).toHaveLength(2);
593
- expect(mockError.mock.calls[1][0]).toBe('%cerror');
611
+ expect(mockError.mock.calls[1]).toHaveLength(3);
612
+ expect(mockError.mock.calls[1]).toEqual([
613
+ '%c%s',
614
+ `color: ${process.env.DARK_MODE_DIMMED_ERROR_COLOR}`,
615
+ 'error',
616
+ ]);
617
});
618
619
it('should not double log in Strict mode initial render for extension', () => {
689
expect(normalizeCodeLocInfo(mockWarn.mock.calls[0][1])).toEqual(
690
'\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
691
);
669
- expect(mockWarn.mock.calls[1]).toHaveLength(2);
670
- expect(normalizeCodeLocInfo(mockWarn.mock.calls[1][0])).toEqual(
671
- '%cwarn \n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
672
- );
692
+ expect(mockWarn.mock.calls[1]).toHaveLength(4);
693
+ expect(mockWarn.mock.calls[1][0]).toEqual('%c%s %s');
694
expect(mockWarn.mock.calls[1][1]).toMatch('color: rgba(');
695
+ expect(mockWarn.mock.calls[1][2]).toEqual('warn');
696
+ expect(normalizeCodeLocInfo(mockWarn.mock.calls[1][3]).trim()).toEqual(
697
+ 'in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
698
+ );
699
700
expect(mockError).toHaveBeenCalledTimes(2);
701
expect(mockError.mock.calls[0]).toHaveLength(2);
702
expect(normalizeCodeLocInfo(mockError.mock.calls[0][1])).toEqual(
703
'\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
704
);
680
- expect(mockError.mock.calls[1]).toHaveLength(2);
681
- expect(normalizeCodeLocInfo(mockError.mock.calls[1][0])).toEqual(
682
- '%cerror \n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
683
- );
705
+ expect(mockError.mock.calls[1]).toHaveLength(4);
706
+ expect(mockError.mock.calls[1][0]).toEqual('%c%s %s');
707
expect(mockError.mock.calls[1][1]).toMatch('color: rgba(');
708
+ expect(mockError.mock.calls[1][2]).toEqual('error');
709
+ expect(normalizeCodeLocInfo(mockError.mock.calls[1][3]).trim()).toEqual(
710
+ 'in Child (at **)\n in Intermediate (at **)\n in Parent (at **)',
711
+ );
712
});
713
});
714