Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d7da52b

Browse files
pedrottimarktabrindle
authored andcommittedOct 2, 2017
Add missing escape sequences to ConvertAnsi plugin (jestjs#4544)
* Add missing escape sequences to ConvertAnsi plugin * Correct opening tags for gray and yellow
1 parent 3472c7c commit d7da52b

File tree

16 files changed

+803
-789
lines changed

16 files changed

+803
-789
lines changed
 

‎packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap

+480-480
Large diffs are not rendered by default.

‎packages/expect/src/__tests__/__snapshots__/spy_matchers.test.js.snap

+52-52
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`.toThrow() error class did not throw at all 1`] = `
4-
"<dim>expect(<red>function</><dim>).toThrow(<green>type</><dim>)
4+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>type</><dim>)</>
55
66
Expected the function to throw an error of type:
77
<green>\\"Err\\"</>
88
But it didn't throw anything."
99
`;
1010
1111
exports[`.toThrow() error class threw, but class did not match 1`] = `
12-
"<dim>expect(<red>function</><dim>).toThrow(<green>type</><dim>)
12+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>type</><dim>)</>
1313
1414
Expected the function to throw an error of type:
1515
<green>\\"Err2\\"</>
1616
Instead, it threw:
1717
<red> Error </>
18-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
18+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
1919
`;
2020
2121
exports[`.toThrow() error class threw, but should not have 1`] = `
22-
"<dim>expect(<red>function</><dim>).not.toThrow(<green>type</><dim>)
22+
"<dim>expect(</><red>function</><dim>).not.toThrow(</><green>type</><dim>)</>
2323
2424
Expected the function not to throw an error of type:
2525
<green>\\"Err\\"</>
2626
Instead, it threw:
2727
<red> Error </>
28-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
28+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
2929
`;
3030
3131
exports[`.toThrow() invalid actual 1`] = `
32-
"<dim>expect(<red>function</><dim>).toThrow(<green>undefined</><dim>)
32+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>undefined</><dim>)</>
3333
3434
Received value must be a function, but instead \\"string\\" was found"
3535
`;
3636
3737
exports[`.toThrow() invalid arguments 1`] = `
38-
"<dim>expect(<red>function</><dim>).not.toThrow(<green>number</><dim>)
38+
"<dim>expect(</><red>function</><dim>).not.toThrow(</><green>number</><dim>)</>
3939
4040
Unexpected argument passed.
4141
Expected: <green>\\"string\\"</>, <green>\\"Error (type)\\"</> or <green>\\"regexp\\"</>.
@@ -44,97 +44,97 @@ Got:
4444
`;
4545
4646
exports[`.toThrow() regexp did not throw at all 1`] = `
47-
"<dim>expect(<red>function</><dim>).toThrow(<green>regexp</><dim>)
47+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>regexp</><dim>)</>
4848
4949
Expected the function to throw an error matching:
5050
<green>/apple/</>
5151
But it didn't throw anything."
5252
`;
5353
5454
exports[`.toThrow() regexp threw, but message did not match 1`] = `
55-
"<dim>expect(<red>function</><dim>).toThrow(<green>regexp</><dim>)
55+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>regexp</><dim>)</>
5656
5757
Expected the function to throw an error matching:
5858
<green>/banana/</>
5959
Instead, it threw:
6060
<red> Error </>
61-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
61+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
6262
`;
6363
6464
exports[`.toThrow() regexp threw, but should not have 1`] = `
65-
"<dim>expect(<red>function</><dim>).not.toThrow(<green>regexp</><dim>)
65+
"<dim>expect(</><red>function</><dim>).not.toThrow(</><green>regexp</><dim>)</>
6666
6767
Expected the function not to throw an error matching:
6868
<green>/apple/</>
6969
Instead, it threw:
7070
<red> Error </>
71-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
71+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
7272
`;
7373
7474
exports[`.toThrow() strings did not throw at all 1`] = `
75-
"<dim>expect(<red>function</><dim>).toThrow(<green>string</><dim>)
75+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>string</><dim>)</>
7676
7777
Expected the function to throw an error matching:
7878
<green>\\"apple\\"</>
7979
But it didn't throw anything."
8080
`;
8181
8282
exports[`.toThrow() strings threw, but message did not match 1`] = `
83-
"<dim>expect(<red>function</><dim>).toThrow(<green>string</><dim>)
83+
"<dim>expect(</><red>function</><dim>).toThrow(</><green>string</><dim>)</>
8484
8585
Expected the function to throw an error matching:
8686
<green>\\"banana\\"</>
8787
Instead, it threw:
8888
<red> Error </>
89-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
89+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
9090
`;
9191
9292
exports[`.toThrow() strings threw, but should not have 1`] = `
93-
"<dim>expect(<red>function</><dim>).not.toThrow(<green>string</><dim>)
93+
"<dim>expect(</><red>function</><dim>).not.toThrow(</><green>string</><dim>)</>
9494
9595
Expected the function not to throw an error matching:
9696
<green>\\"apple\\"</>
9797
Instead, it threw:
9898
<red> Error </>
99-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
99+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
100100
`;
101101
102102
exports[`.toThrowError() error class did not throw at all 1`] = `
103-
"<dim>expect(<red>function</><dim>).toThrowError(<green>type</><dim>)
103+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>type</><dim>)</>
104104
105105
Expected the function to throw an error of type:
106106
<green>\\"Err\\"</>
107107
But it didn't throw anything."
108108
`;
109109
110110
exports[`.toThrowError() error class threw, but class did not match 1`] = `
111-
"<dim>expect(<red>function</><dim>).toThrowError(<green>type</><dim>)
111+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>type</><dim>)</>
112112
113113
Expected the function to throw an error of type:
114114
<green>\\"Err2\\"</>
115115
Instead, it threw:
116116
<red> Error </>
117-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
117+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
118118
`;
119119
120120
exports[`.toThrowError() error class threw, but should not have 1`] = `
121-
"<dim>expect(<red>function</><dim>).not.toThrowError(<green>type</><dim>)
121+
"<dim>expect(</><red>function</><dim>).not.toThrowError(</><green>type</><dim>)</>
122122
123123
Expected the function not to throw an error of type:
124124
<green>\\"Err\\"</>
125125
Instead, it threw:
126126
<red> Error </>
127-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
127+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
128128
`;
129129
130130
exports[`.toThrowError() invalid actual 1`] = `
131-
"<dim>expect(<red>function</><dim>).toThrowError(<green>undefined</><dim>)
131+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>undefined</><dim>)</>
132132
133133
Received value must be a function, but instead \\"string\\" was found"
134134
`;
135135
136136
exports[`.toThrowError() invalid arguments 1`] = `
137-
"<dim>expect(<red>function</><dim>).not.toThrowError(<green>number</><dim>)
137+
"<dim>expect(</><red>function</><dim>).not.toThrowError(</><green>number</><dim>)</>
138138
139139
Unexpected argument passed.
140140
Expected: <green>\\"string\\"</>, <green>\\"Error (type)\\"</> or <green>\\"regexp\\"</>.
@@ -143,57 +143,57 @@ Got:
143143
`;
144144
145145
exports[`.toThrowError() regexp did not throw at all 1`] = `
146-
"<dim>expect(<red>function</><dim>).toThrowError(<green>regexp</><dim>)
146+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>regexp</><dim>)</>
147147
148148
Expected the function to throw an error matching:
149149
<green>/apple/</>
150150
But it didn't throw anything."
151151
`;
152152
153153
exports[`.toThrowError() regexp threw, but message did not match 1`] = `
154-
"<dim>expect(<red>function</><dim>).toThrowError(<green>regexp</><dim>)
154+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>regexp</><dim>)</>
155155
156156
Expected the function to throw an error matching:
157157
<green>/banana/</>
158158
Instead, it threw:
159159
<red> Error </>
160-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
160+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
161161
`;
162162
163163
exports[`.toThrowError() regexp threw, but should not have 1`] = `
164-
"<dim>expect(<red>function</><dim>).not.toThrowError(<green>regexp</><dim>)
164+
"<dim>expect(</><red>function</><dim>).not.toThrowError(</><green>regexp</><dim>)</>
165165
166166
Expected the function not to throw an error matching:
167167
<green>/apple/</>
168168
Instead, it threw:
169169
<red> Error </>
170-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
170+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
171171
`;
172172
173173
exports[`.toThrowError() strings did not throw at all 1`] = `
174-
"<dim>expect(<red>function</><dim>).toThrowError(<green>string</><dim>)
174+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>string</><dim>)</>
175175
176176
Expected the function to throw an error matching:
177177
<green>\\"apple\\"</>
178178
But it didn't throw anything."
179179
`;
180180
181181
exports[`.toThrowError() strings threw, but message did not match 1`] = `
182-
"<dim>expect(<red>function</><dim>).toThrowError(<green>string</><dim>)
182+
"<dim>expect(</><red>function</><dim>).toThrowError(</><green>string</><dim>)</>
183183
184184
Expected the function to throw an error matching:
185185
<green>\\"banana\\"</>
186186
Instead, it threw:
187187
<red> Error </>
188-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
188+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
189189
`;
190190
191191
exports[`.toThrowError() strings threw, but should not have 1`] = `
192-
"<dim>expect(<red>function</><dim>).not.toThrowError(<green>string</><dim>)
192+
"<dim>expect(</><red>function</><dim>).not.toThrowError(</><green>string</><dim>)</>
193193
194194
Expected the function not to throw an error matching:
195195
<green>\\"apple\\"</>
196196
Instead, it threw:
197197
<red> Error </>
198-
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
198+
<red> <dim>at jestExpect (</>packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</></>"
199199
`;
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 1`] = `"<dim>should⏎ </>name</><dim> the ⏎function you at..."`;
3+
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 1`] = `"<dim>should⏎ </></>name</><dim> the ⏎function you at...</>"`;
44
5-
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 2`] = `"<dim>should⏎ </>name</><dim> the ⏎function you at..."`;
5+
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 2`] = `"<dim>should⏎ </></>name</><dim> the ⏎function you at...</>"`;
66
7-
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 3`] = `"<dim>should⏎ </>name</><dim> the ⏎function you at..."`;
7+
exports[`for multiline test name returns test name with highlighted pattern and replaced line breaks 3`] = `"<dim>should⏎ </></>name</><dim> the ⏎function you at...</>"`;
88
9-
exports[`for one line test name pattern in the middle test name with cutted tail and cutted highlighted pattern 1`] = `"<dim>should </>nam...</>"`;
9+
exports[`for one line test name pattern in the middle test name with cutted tail and cutted highlighted pattern 1`] = `"<dim>should </></>nam...</>"`;
1010
11-
exports[`for one line test name pattern in the middle test name with cutted tail and highlighted pattern 1`] = `"<dim>should </>name</><dim> the functi..."`;
11+
exports[`for one line test name pattern in the middle test name with cutted tail and highlighted pattern 1`] = `"<dim>should </></>name</><dim> the functi...</>"`;
1212
13-
exports[`for one line test name pattern in the middle test name with highlighted cutted 1`] = `"<dim>sho</>...</>"`;
13+
exports[`for one line test name pattern in the middle test name with highlighted cutted 1`] = `"<dim>sho</></>...</>"`;
1414
15-
exports[`for one line test name pattern in the middle test name with highlighted pattern returns 1`] = `"<dim>should </>name</><dim> the function you attach"`;
15+
exports[`for one line test name pattern in the middle test name with highlighted pattern returns 1`] = `"<dim>should </></>name</><dim> the function you attach</>"`;
1616
17-
exports[`for one line test name pattern in the tail returns test name with cutted tail and cutted highlighted pattern 1`] = `"<dim>should name the function you </>a...</>"`;
17+
exports[`for one line test name pattern in the tail returns test name with cutted tail and cutted highlighted pattern 1`] = `"<dim>should name the function you </></>a...</>"`;
1818
19-
exports[`for one line test name pattern in the tail returns test name with highlighted cutted 1`] = `"<dim>sho</>...</>"`;
19+
exports[`for one line test name pattern in the tail returns test name with highlighted cutted 1`] = `"<dim>sho</></>...</>"`;
2020
21-
exports[`for one line test name pattern in the tail returns test name with highlighted pattern 1`] = `"<dim>should name the function you </>attach</>"`;
21+
exports[`for one line test name pattern in the tail returns test name with highlighted pattern 1`] = `"<dim>should name the function you </></>attach</>"`;
2222
2323
exports[`for one line test name with pattern in the head returns test name with cutted tail and cutted highlighted pattern 1`] = `"</>shoul...</>"`;
2424
25-
exports[`for one line test name with pattern in the head returns test name with cutted tail and highlighted pattern 1`] = `"</>should</><dim> name the function yo..."`;
25+
exports[`for one line test name with pattern in the head returns test name with cutted tail and highlighted pattern 1`] = `"</>should</><dim> name the function yo...</>"`;
2626
27-
exports[`for one line test name with pattern in the head returns test name with highlighted pattern 1`] = `"</>should</><dim> name the function you attach"`;
27+
exports[`for one line test name with pattern in the head returns test name with highlighted pattern 1`] = `"</>should</><dim> name the function you attach</>"`;

‎packages/jest-cli/src/reporters/__tests__/__snapshots__/get_snapshot_status.test.js.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
exports[`Retrieves the snapshot status 1`] = `
44
Array [
5-
"<bold><green> › 1 snapshot</> written.",
6-
"<bold><green> › 1 snapshot</> updated.",
7-
"<bold><red> › 1 obsolete snapshot</> found.",
8-
"<bold><red> › 1 snapshot test</> failed.",
5+
"<bold><green> › 1 snapshot</></> written.",
6+
"<bold><green> › 1 snapshot</></> updated.",
7+
"<bold><red> › 1 obsolete snapshot</></> found.",
8+
"<bold><red> › 1 snapshot test</></> failed.",
99
]
1010
`;
1111
1212
exports[`Retrieves the snapshot status after a snapshot update 1`] = `
1313
Array [
14-
"<bold><green> › 2 snapshots</> written.",
15-
"<bold><green> › 2 snapshots</> updated.",
16-
"<bold><red> › 2 obsolete snapshots</> removed.",
17-
"<bold><red> › Obsolete snapshot file</> removed.",
18-
"<bold><red> › 2 snapshot tests</> failed.",
14+
"<bold><green> › 2 snapshots</></> written.",
15+
"<bold><green> › 2 snapshots</></> updated.",
16+
"<bold><red> › 2 obsolete snapshots</></> removed.",
17+
"<bold><red> › Obsolete snapshot file</></> removed.",
18+
"<bold><red> › 2 snapshot tests</></> failed.",
1919
]
2020
`;
2121

‎packages/jest-cli/src/reporters/__tests__/__snapshots__/get_snapshot_summary.test.js.snap

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22

33
exports[`creates a snapshot summary 1`] = `
44
Array [
5-
"<bold>Snapshot Summary",
6-
"<bold><green> › 1 snapshot</> written in 1 test suite.",
7-
"<bold><red> › 1 snapshot test</> failed in 1 test suite. <dim>Inspect your code changes or press --u to update them.",
8-
"<bold><green> › 1 snapshot</> updated in 1 test suite.",
9-
"<bold><red> › 1 obsolete snapshot file</> found, press --u to remove it.",
10-
"<bold><red> › 1 obsolete snapshot</> found, press --u to remove it.",
5+
"<bold>Snapshot Summary</>",
6+
"<bold><green> › 1 snapshot</></> written in 1 test suite.",
7+
"<bold><red> › 1 snapshot test</></> failed in 1 test suite. <dim>Inspect your code changes or press --u to update them.</>",
8+
"<bold><green> › 1 snapshot</></> updated in 1 test suite.",
9+
"<bold><red> › 1 obsolete snapshot file</></> found, press --u to remove it.",
10+
"<bold><red> › 1 obsolete snapshot</></> found, press --u to remove it.",
1111
]
1212
`;
1313
1414
exports[`creates a snapshot summary after an update 1`] = `
1515
Array [
16-
"<bold>Snapshot Summary",
17-
"<bold><green> › 1 snapshot</> written in 1 test suite.",
18-
"<bold><red> › 1 snapshot test</> failed in 1 test suite. <dim>Inspect your code changes or press --u to update them.",
19-
"<bold><green> › 1 snapshot</> updated in 1 test suite.",
20-
"<bold><red> › 1 obsolete snapshot file</> removed.",
21-
"<bold><red> › 1 obsolete snapshot</> removed.",
16+
"<bold>Snapshot Summary</>",
17+
"<bold><green> › 1 snapshot</></> written in 1 test suite.",
18+
"<bold><red> › 1 snapshot test</></> failed in 1 test suite. <dim>Inspect your code changes or press --u to update them.</>",
19+
"<bold><green> › 1 snapshot</></> updated in 1 test suite.",
20+
"<bold><red> › 1 obsolete snapshot file</></> removed.",
21+
"<bold><red> › 1 obsolete snapshot</></> removed.",
2222
]
2323
`;
2424
2525
exports[`creates a snapshot summary with multiple snapshot being written/updated 1`] = `
2626
Array [
27-
"<bold>Snapshot Summary",
28-
"<bold><green> › 2 snapshots</> written in 2 test suites.",
29-
"<bold><red> › 2 snapshot tests</> failed in 2 test suites. <dim>Inspect your code changes or press --u to update them.",
30-
"<bold><green> › 2 snapshots</> updated in 2 test suites.",
31-
"<bold><red> › 2 obsolete snapshot files</> found, press --u to remove them..",
32-
"<bold><red> › 2 obsolete snapshots</> found, press --u to remove them.",
27+
"<bold>Snapshot Summary</>",
28+
"<bold><green> › 2 snapshots</></> written in 2 test suites.",
29+
"<bold><red> › 2 snapshot tests</></> failed in 2 test suites. <dim>Inspect your code changes or press --u to update them.</>",
30+
"<bold><green> › 2 snapshots</></> updated in 2 test suites.",
31+
"<bold><red> › 2 obsolete snapshot files</></> found, press --u to remove them..",
32+
"<bold><red> › 2 obsolete snapshots</></> found, press --u to remove them.",
3333
]
3434
`;
3535
3636
exports[`returns nothing if there are no updates 1`] = `
3737
Array [
38-
"<bold>Snapshot Summary",
38+
"<bold>Snapshot Summary</>",
3939
]
4040
`;

0 commit comments

Comments
 (0)