1
- import chalk from "chalk "
1
+ import { gray , green , red } from "colorette "
2
2
import assert from "node:assert/strict"
3
3
import { suite , test } from "node:test"
4
4
import stripAnsi from "strip-ansi"
5
5
import * as assertNoDiff from "../src/index"
6
6
7
- suite ( "assertNoDiff.trimmedLines" , function ( ) {
8
- test ( "matching data" , function ( ) {
7
+ suite ( "assertNoDiff.trimmedLines" , function ( ) {
8
+ test ( "matching data" , function ( ) {
9
9
const data = "Jean-Luc Picard"
10
10
assertNoDiff . trimmedLines ( data , data )
11
11
} )
12
12
13
- test ( "matching data with surrounding whitespace" , function ( ) {
13
+ test ( "matching data with surrounding whitespace" , function ( ) {
14
14
const obj1 = "foo"
15
15
const obj2 = " foo "
16
16
assertNoDiff . trimmedLines (
@@ -20,33 +20,33 @@ suite("assertNoDiff.trimmedLines", function() {
20
20
)
21
21
} )
22
22
23
- test ( "mismatching data" , function ( ) {
23
+ test ( "mismatching data" , function ( ) {
24
24
const obj1 = "Jean-Luc\nPicard"
25
25
const obj2 = "Captain\nPicard"
26
26
27
- const expected = chalk `mismatching lines:
27
+ const expected = `mismatching lines:
28
28
29
- {red Jean-Luc\n} {green Captain\n}{grey Picard}`
30
- assert . throws ( function ( ) {
29
+ $ {red ( " Jean-Luc\n" ) } $ {green ( " Captain\n" ) } ${ gray ( " Picard" ) } `
30
+ assert . throws ( function ( ) {
31
31
assertNoDiff . trimmedLines ( obj2 , obj1 )
32
32
} , new Error ( expected ) )
33
33
} )
34
34
35
- test ( "no expected value" , function ( ) {
36
- assert . throws ( function ( ) {
35
+ test ( "no expected value" , function ( ) {
36
+ assert . throws ( function ( ) {
37
37
// @ts -ignore
38
38
assertNoDiff . trimmedLines ( "foo" )
39
39
} , new Error ( "AssertNoDiff: expected value not provided" ) )
40
40
} )
41
41
42
- test ( "no actual value" , function ( ) {
43
- assert . throws ( function ( ) {
42
+ test ( "no actual value" , function ( ) {
43
+ assert . throws ( function ( ) {
44
44
// @ts -ignore
45
45
assertNoDiff . trimmedLines ( )
46
46
} , new Error ( "AssertNoDiff: actual value not provided" ) )
47
47
} )
48
48
49
- test ( "custom error message" , function ( ) {
49
+ test ( "custom error message" , function ( ) {
50
50
try {
51
51
assertNoDiff . trimmedLines ( "one" , "two" , "custom message" )
52
52
} catch ( e ) {
@@ -57,7 +57,7 @@ suite("assertNoDiff.trimmedLines", function() {
57
57
throw new Error ( "assertNoDiff.trimmedLines didn't throw" )
58
58
} )
59
59
60
- test ( "diffing empty strings" , function ( ) {
60
+ test ( "diffing empty strings" , function ( ) {
61
61
assertNoDiff . trimmedLines ( "" , "" , "should allow diffing empty strings" )
62
62
} )
63
63
} )
0 commit comments