|
2 | 2 |
|
3 | 3 | exports[`error transform handles escaped backticks in template string 1`] = `
|
4 | 4 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
5 |
| -Error(__DEV__ ? \\"Expected \`\\" + listener + \\"\` listener to be a function, instead got a value of \`\\" + type + \\"\` type.\\" : _formatProdErrorMessage(231, listener, type));" |
| 5 | +Error(_formatProdErrorMessage(231, listener, type));" |
6 | 6 | `;
|
7 | 7 |
|
8 |
| -exports[`error transform should correctly transform invariants that are not in the error codes map 1`] = ` |
9 |
| -"import invariant from 'shared/invariant'; |
10 |
| -
|
11 |
| -/*FIXME (minify-errors-in-prod): Unminified error message in production build!*/ |
12 |
| -if (!condition) { |
13 |
| - throw Error(\\"This is not a real error message.\\"); |
14 |
| -}" |
| 8 | +exports[`error transform should not touch other calls or new expressions 1`] = ` |
| 9 | +"new NotAnError(); |
| 10 | +NotAnError();" |
15 | 11 | `;
|
16 | 12 |
|
17 |
| -exports[`error transform should handle escaped characters 1`] = ` |
18 |
| -"import invariant from 'shared/invariant'; |
| 13 | +exports[`error transform should output FIXME for errors that don't have a matching error code 1`] = ` |
| 14 | +"/*! FIXME (minify-errors-in-prod): Unminified error message in production build!*/ |
19 | 15 |
|
20 |
| -/*FIXME (minify-errors-in-prod): Unminified error message in production build!*/ |
21 |
| -if (!condition) { |
22 |
| - throw Error(\\"What's up?\\"); |
23 |
| -}" |
| 16 | +/*! <expected-error-format>\\"This is not a real error message.\\"</expected-error-format>*/ |
| 17 | +Error('This is not a real error message.');" |
24 | 18 | `;
|
25 | 19 |
|
26 |
| -exports[`error transform should not touch other calls or new expressions 1`] = ` |
27 |
| -"new NotAnError(); |
28 |
| -NotAnError();" |
| 20 | +exports[`error transform should output FIXME for errors that don't have a matching error code, unless opted out with a comment 1`] = ` |
| 21 | +"// eslint-disable-next-line react-internal/prod-error-codes |
| 22 | +Error('This is not a real error message.');" |
29 | 23 | `;
|
30 | 24 |
|
31 | 25 | exports[`error transform should replace error constructors (no new) 1`] = `
|
32 | 26 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
33 |
| -Error(__DEV__ ? 'Do not override existing functions.' : _formatProdErrorMessage(16));" |
| 27 | +Error(_formatProdErrorMessage(16));" |
34 | 28 | `;
|
35 | 29 |
|
36 | 30 | exports[`error transform should replace error constructors 1`] = `
|
37 | 31 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
38 |
| -Error(__DEV__ ? 'Do not override existing functions.' : _formatProdErrorMessage(16));" |
39 |
| -`; |
40 |
| - |
41 |
| -exports[`error transform should replace simple invariant calls 1`] = ` |
42 |
| -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; |
43 |
| -import invariant from 'shared/invariant'; |
44 |
| -
|
45 |
| -if (!condition) { |
46 |
| - { |
47 |
| - throw Error(__DEV__ ? \\"Do not override existing functions.\\" : _formatProdErrorMessage(16)); |
48 |
| - } |
49 |
| -}" |
| 32 | +Error(_formatProdErrorMessage(16));" |
50 | 33 | `;
|
51 | 34 |
|
52 | 35 | exports[`error transform should support error constructors with concatenated messages 1`] = `
|
53 | 36 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
54 |
| -Error(__DEV__ ? \\"Expected \\" + foo + \\" target to \\" + (\\"be an array; got \\" + bar) : _formatProdErrorMessage(7, foo, bar));" |
| 37 | +Error(_formatProdErrorMessage(7, foo, bar));" |
55 | 38 | `;
|
56 | 39 |
|
57 | 40 | exports[`error transform should support interpolating arguments with concatenation 1`] = `
|
58 | 41 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
59 |
| -Error(__DEV__ ? 'Expected ' + foo + ' target to be an array; got ' + bar : _formatProdErrorMessage(7, foo, bar));" |
| 42 | +Error(_formatProdErrorMessage(7, foo, bar));" |
60 | 43 | `;
|
61 | 44 |
|
62 | 45 | exports[`error transform should support interpolating arguments with template strings 1`] = `
|
63 | 46 | "import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\";
|
64 |
| -Error(__DEV__ ? \\"Expected \\" + foo + \\" target to be an array; got \\" + bar : _formatProdErrorMessage(7, foo, bar));" |
65 |
| -`; |
66 |
| - |
67 |
| -exports[`error transform should support invariant calls with a concatenated template string and args 1`] = ` |
68 |
| -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; |
69 |
| -import invariant from 'shared/invariant'; |
70 |
| -
|
71 |
| -if (!condition) { |
72 |
| - { |
73 |
| - throw Error(__DEV__ ? \\"Expected a component class, got \\" + Foo + \\".\\" + Bar : _formatProdErrorMessage(18, Foo, Bar)); |
74 |
| - } |
75 |
| -}" |
76 |
| -`; |
77 |
| - |
78 |
| -exports[`error transform should support invariant calls with args 1`] = ` |
79 |
| -"import _formatProdErrorMessage from \\"shared/formatProdErrorMessage\\"; |
80 |
| -import invariant from 'shared/invariant'; |
81 |
| -
|
82 |
| -if (!condition) { |
83 |
| - { |
84 |
| - throw Error(__DEV__ ? \\"Expected \\" + foo + \\" target to be an array; got \\" + bar : _formatProdErrorMessage(7, foo, bar)); |
85 |
| - } |
86 |
| -}" |
87 |
| -`; |
88 |
| - |
89 |
| -exports[`error transform should support noMinify option 1`] = ` |
90 |
| -"import invariant from 'shared/invariant'; |
91 |
| -
|
92 |
| -if (!condition) { |
93 |
| - throw Error(\\"Do not override existing functions.\\"); |
94 |
| -}" |
| 47 | +Error(_formatProdErrorMessage(7, foo, bar));" |
95 | 48 | `;
|
0 commit comments