@samitouri / QOS-React-2 / commits / 66748b00f2

[be][sprout] Snapshot files for sprout with shared utils

--- 16 out of ~150 recently added sprout fixtures have exceptions that reflect easy-to-miss mistakes in the fixture input, like forgetting to import `useState`. This PR adds snapshot files for sprout to prevent these mistakes (or catch them at diff review time). This describes what it implements, but happy to take other suggestions as well! 1. One sprout snapshot file for each input. This significantly increases the number of files we have, but makes it clear what the fixture is testing. I was hoping to expand on these snapshots to record the result of multiple re-renders, or mounts (with different parameters), but the tradeoff is that adding / changing fixtures will now require running `yarn sprout --mode update`. Some alternatives I've considered: - Only record snapshots for fixtures that error (`result.kind == "exception"`). This change would be pretty easy. This doesn't help sanity check sprout results for general mistakes though ("am I testing what I want to test?) - Warn loudly for fixtures that error -- seems like these are easy to ignore, but.. worth it for the convenience? - Some github action that runs and comments on your PR with sprout fixture changes; i.e. never manually update sprout files? 2. Sprout and snap share a common snapshot file, with some parsing hackery. Previously, the implementation added new files to a separate sprout snapshot directory, assuming that devs don't need to read these often. After feedback from @josephsavona, I updated to have snap and sprout write to the same file for ease of reviewing / debugging (to be able to see the input / output side by side). - `snap --mode update` will update snap's part of the file. - `sprout --mode update` will update sprout's part - `snap` and `sprout` will both compare oldSnapshot (read from the file) with `newSnapshot = merge(oldSnapshot, newData)` to determine if a test pass. 3. Some hacks 😅 Absolute paths to project directory (e.g. stack traces) are replaced with `<project_root>` in a mocked `console.log`

Mofei Zhang committed Nov 16, 2023 at 18:12 UTC 66748b00f25b2111731d65a8cde6c777c741bbe5
237 files changed +1202 -589
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md
+3 -1
@@ -55,4 +55,6 @@ export const FIXTURE_ENTRYPOINT = {
55 };
56
57 ```
58 -
\ No newline at end of file
58 +
59 +### Eval output
60 +(kind: ok) [[{"a":0,"b":"value1","c":true}],"[[ cyclic ref *2 ]]"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) {"y":{"z":[]}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md
+3 -1
@@ -69,4 +69,6 @@ export const FIXTURE_ENTRYPOINT = {
69 };
70
71 ```
72 -
\ No newline at end of file
72 +
73 +### Eval output
74 +(kind: ok) [[2],[[2],[],[3]]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md
+3 -1
@@ -41,4 +41,6 @@ export const FIXTURE_ENTRYPOINT = {
41 };
42
43 ```
44 -
\ No newline at end of file
44 +
45 +### Eval output
46 +(kind: ok) [0,1,2,3,null,4,5,6,"z"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-captures-receiver-noAlias.expect.md
+3 -1
@@ -45,4 +45,6 @@ export const FIXTURE_ENTRYPOINT = {
45 };
46
47 ```
48 -
\ No newline at end of file
48 +
49 +### Eval output
50 +(kind: ok) [{"a":{"id":42}}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-frozen-array-noAlias.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [[],[]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-frozen-array.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [[],[]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-mutable-array-mutating-lambda-noAlias.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) [[],[]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-mutable-array-mutating-lambda.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) [[],[]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-noAlias-escaping-function.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) [[{"id":1}],"[[ function params=1 ]]"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) [{"a":"val1"},{"b":"val2"}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md
+3 -1
@@ -55,4 +55,6 @@ export const FIXTURE_ENTRYPOINT = {
55 };
56
57 ```
58 -
\ No newline at end of file
58 +
59 +### Eval output
60 +(kind: ok) {"a":[[1,2],2,"hello"],"x":3,"y":"[[ function params=1 ]]","z":"[[ function params=1 ]]"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) {"a":[1,2,"hello",42],"x":4,"y":1}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md
+3 -1
@@ -45,4 +45,6 @@ export const FIXTURE_ENTRYPOINT = {
45 };
46
47 ```
48 -
\ No newline at end of file
48 +
49 +### Eval output
50 +(kind: ok) [7]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) {"b":{"c":6}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) {"y":{"z":4}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-variations.expect.md
+3 -1
@@ -35,4 +35,6 @@ export const FIXTURE_ENTRYPOINT = {
35 };
36
37 ```
38 -
\ No newline at end of file
38 +
39 +### Eval output
40 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md
+3 -1
@@ -49,4 +49,6 @@ export const FIXTURE_ENTRYPOINT = {
49 };
50
51 ```
52 -
\ No newline at end of file
52 +
53 +### Eval output
54 +(kind: ok) <div>0</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) {"foo":"foo"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) {"foo":"foo"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) {"bar":"bar","wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) {"bar":"bar","wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate-iife.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate-iife.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) {"x":{"a":"foo"},"wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) {"a":2}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.md
+3 -1
@@ -52,4 +52,6 @@ export const FIXTURE_ENTRYPOINT = {
52 };
53
54 ```
55 -
\ No newline at end of file
55 +
56 +### Eval output
57 +(kind: ok) {"a":"foo","wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) "val2"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) "val2"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) "val2"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) "val2"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) {"z":null}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-call-evaluation-order.expect.md
+4 -1
@@ -62,4 +62,7 @@ export const FIXTURE_ENTRYPOINT = {
62 };
63
64 ```
65 -
\ No newline at end of file
65 +
66 +### Eval output
67 +(kind: ok) {"f":"[[ function params=0 ]]"}
68 +logs: ['A','B','arg','original']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/console-readonly.expect.md
+4 -1
@@ -58,4 +58,7 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) {"a":1,"b":2}
64 +logs: [{ a: 1, b: 2 },{ a: 1, b: 2 },{ a: 1, b: 2 },{ a: 1, b: 2 },{ a: 1, b: 2 }]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/const-propagation-into-function-expression-primitive.expect.md
+4 -1
@@ -38,4 +38,7 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) 42
44 +logs: [42]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/const-propagation-phi-nodes.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) {"x":1,"y":1,"z":1}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis-constant.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) <div>global string 0</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) <div>global string 1</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagation-for.expect.md
+3 -1
@@ -36,4 +36,6 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok) 0
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagation-while.expect.md
+3 -1
@@ -37,4 +37,6 @@ export const FIXTURE_ENTRYPOINT = {
37 };
38
39 ```
40 -
\ No newline at end of file
40 +
41 +### Eval output
42 +(kind: ok) 0
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagation.expect.md
+4 -1
@@ -44,4 +44,7 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) -6
50 +logs: ['foo']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/controlled-input.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) <input value="0">
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/createElement-freeze.expect.md
+3 -1
@@ -63,4 +63,6 @@ export const FIXTURE_ENTRYPOINT = {
63 };
64
65 ```
66 -
\ No newline at end of file
66 +
67 +### Eval output
68 +(kind: ok) <div>hello world</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dce-loop.expect.md
+3 -1
@@ -38,4 +38,6 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) 10
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dce-unused-const.expect.md
+3 -1
@@ -27,4 +27,6 @@ export const FIXTURE_ENTRYPOINT = {
27 };
28
29 ```
30 -
\ No newline at end of file
30 +
31 +### Eval output
32 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dce-unused-postfix-update.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dce-unused-prefix-update.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-array-with-unary.expect.md
+3 -1
@@ -37,4 +37,6 @@ export const FIXTURE_ENTRYPOINT = {
37 };
38
39 ```
40 -
\ No newline at end of file
40 +
41 +### Eval output
42 +(kind: ok) [-1,1]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-calls-global-function.expect.md
+3 -1
@@ -41,4 +41,6 @@ export const FIXTURE_ENTRYPOINT = {
41 };
42
43 ```
44 -
\ No newline at end of file
44 +
45 +### Eval output
46 +(kind: ok) ["[[ function params=0 ]]",true,42,"hello"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-empty-callback.expect.md
+3 -1
@@ -37,4 +37,6 @@ export const FIXTURE_ENTRYPOINT = {
37 };
38
39 ```
40 -
\ No newline at end of file
40 +
41 +### Eval output
42 +(kind: ok) "[[ function params=0 ]]"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.expect.md
+3 -1
@@ -37,4 +37,6 @@ export const FIXTURE_ENTRYPOINT = {
37 };
38
39 ```
40 -
\ No newline at end of file
40 +
41 +### Eval output
42 +(kind: ok) "[[ function params=0 ]]"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) {"a":"value 1","someGlobal":{}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) [-1,1]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md
+3 -1
@@ -79,4 +79,6 @@ export const FIXTURE_ENTRYPOINT = {
79 };
80
81 ```
82 -
\ No newline at end of file
82 +
83 +### Eval output
84 +(kind: ok) {"x":"hello","y":"world","myList":[null]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-mixed-property-key-types.expect.md
+3 -1
@@ -50,4 +50,6 @@ export const FIXTURE_ENTRYPOINT = {
50 };
51
52 ```
53 -
\ No newline at end of file
53 +
54 +### Eval output
55 +(kind: ok) [1,2,3]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key-invalid-identifier.expect.md
+3 -1
@@ -29,4 +29,6 @@ export const FIXTURE_ENTRYPOINT = {
29 };
30
31 ```
32 -
\ No newline at end of file
32 +
33 +### Eval output
34 +(kind: ok) {}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.expect.md
+3 -1
@@ -29,4 +29,6 @@ export const FIXTURE_ENTRYPOINT = {
29 };
30
31 ```
32 -
\ No newline at end of file
32 +
33 +### Eval output
34 +(kind: ok) {}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-string-literal-invalid-identifier-property-key.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-string-literal-property-key.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-array-hole.expect.md
+3 -1
@@ -30,4 +30,6 @@ export const FIXTURE_ENTRYPOINT = {
30 };
31
32 ```
33 -
\ No newline at end of file
33 +
34 +### Eval output
35 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-null.expect.md
+3 -1
@@ -30,4 +30,6 @@ export const FIXTURE_ENTRYPOINT = {
30 };
31
32 ```
33 -
\ No newline at end of file
33 +
34 +### Eval output
35 +(kind: ok) null
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-undefined.expect.md
+3 -1
@@ -30,4 +30,6 @@ export const FIXTURE_ENTRYPOINT = {
30 };
31
32 ```
33 -
\ No newline at end of file
33 +
34 +### Eval output
35 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-past-end-of-array.expect.md
+3 -1
@@ -30,4 +30,6 @@ export const FIXTURE_ENTRYPOINT = {
30 };
31
32 ```
33 -
\ No newline at end of file
33 +
34 +### Eval output
35 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md
+3 -1
@@ -138,4 +138,6 @@ export const FIXTURE_ENTRYPOINT = {
138 };
139
140 ```
141 -
\ No newline at end of file
141 +
142 +### Eval output
143 +(kind: ok) <div>{"media":null,"allUrls":["url1","url2","url3"],"onClick":"[[ function params=1 ]]"}</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-pattern-within-rest.expect.md
+3 -1
@@ -50,4 +50,6 @@ export const FIXTURE_ENTRYPOINT = {
50 };
51
52 ```
53 -
\ No newline at end of file
53 +
54 +### Eval output
55 +(kind: ok) ["y",null]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-conditional-as-default-value.expect.md
+3 -1
@@ -29,4 +29,6 @@ export const FIXTURE_ENTRYPOINT = {
29 };
30
31 ```
32 -
\ No newline at end of file
32 +
33 +### Eval output
34 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-typecast-as-default-value.flow.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) []
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [1.5,1,0.5]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) [6,4,2]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dont-compile-functions-with-multiple-params.expect.md
+3 -1
@@ -30,4 +30,6 @@ export const FIXTURE_ENTRYPOINT = {
30 };
31
32 ```
33 -
\ No newline at end of file
33 +
34 +### Eval output
35 +(kind: ok) <div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usecallback.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) <div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usememo.expect.md
+3 -1
@@ -49,4 +49,6 @@ export const FIXTURE_ENTRYPOINT = {
49 };
50
51 ```
52 -
\ No newline at end of file
52 +
53 +### Eval output
54 +(kind: ok) [42]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/empty-catch-statement.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) 4
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/expression-with-assignment.expect.md
+3 -1
@@ -29,4 +29,6 @@ export const FIXTURE_ENTRYPOINT = {
29 };
30
31 ```
32 -
\ No newline at end of file
32 +
33 +### Eval output
34 +(kind: ok) 5
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-call-complex-param-value.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) <div>Hello, Sathya!</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-call.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) <div>2 items</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) Before texthello worldAfter text
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) Before text hello world
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) Before text hello world after text
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-template-string-same-scope.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) <div>{"children":"for 3 experiences"}</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) Before text hello world after text
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) Before text hello world after text more text and more and more and more and more and more and more and more and more and blah blah blah blah
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/flatten-scopes-with-methodcall-hook.expect.md
+9 -1
@@ -36,4 +36,12 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: exception) number 0 is not iterable (cannot read property Symbol(Symbol.iterator))
42 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
43 + '\n' +
44 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
45 + '\n' +
46 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
47 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement-body-always-returns.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok) "a"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement-break.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement-continue.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) "b!"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement-empty-body.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement-type-inference.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) "c"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-in-statement.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) <div><div>hello</div><div>world</div><div>!</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-loop-let-undefined-decl.expect.md
+9 -1
@@ -43,4 +43,12 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: exception) isSelected is not defined
49 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
50 + '\n' +
51 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
52 + '\n' +
53 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
54 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-break.expect.md
+3 -1
@@ -45,4 +45,6 @@ export const FIXTURE_ENTRYPOINT = {
45 };
46
47 ```
48 -
\ No newline at end of file
48 +
49 +### Eval output
50 +(kind: ok) []
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) []
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) [0.5,1,1.5]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) [0,2,4]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md
+3 -1
@@ -52,4 +52,6 @@ export const FIXTURE_ENTRYPOINT = {
52 };
53
54 ```
55 -
\ No newline at end of file
55 +
56 +### Eval output
57 +(kind: ok) <div><div><div></div></div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) [0,2,4]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md
+3 -1
@@ -45,4 +45,6 @@ export const FIXTURE_ENTRYPOINT = {
45 };
46
47 ```
48 -
\ No newline at end of file
48 +
49 +### Eval output
50 +(kind: ok) {}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) "[[ function params=0 ]]"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-access-function-name-in-component.expect.md
+3 -1
@@ -44,4 +44,6 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) <div>Component</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-computed-member-expression.expect.md
+9 -1
@@ -64,4 +64,12 @@ export const FIXTURE_ENTRYPOINT = {
64 };
65
66 ```
67 -
\ No newline at end of file
67 +
68 +### Eval output
69 +(kind: exception) Button is not defined
70 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
71 + '\n' +
72 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
73 + '\n' +
74 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
75 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-member-expression.expect.md
+9 -1
@@ -53,4 +53,12 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: exception) Button is not defined
59 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
60 + '\n' +
61 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
62 + '\n' +
63 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
64 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration-2.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) [true]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) 5
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-simple-const-declaration.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) 5
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-simple-function-expression.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/holey-array-expr.expect.md
+3 -1
@@ -44,4 +44,6 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) [null,"global string 0",{"a":1,"b":2}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-noAlias.expect.md
+3 -1
@@ -67,4 +67,6 @@ export const FIXTURE_ENTRYPOINT = {
67 };
68
69 ```
70 -
\ No newline at end of file
70 +
71 +### Eval output
72 +(kind: ok) [{},{"a":{"id":42}}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hooks-with-React-namespace.expect.md
+3 -1
@@ -28,4 +28,6 @@ export const FIXTURE_ENTRYPOINT = {
28 };
29
30 ```
31 -
\ No newline at end of file
31 +
32 +### Eval output
33 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/iife-return-modified-later-logical.expect.md
+9 -1
@@ -46,4 +46,12 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: exception) foo is not defined
52 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
53 + '\n' +
54 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
55 + '\n' +
56 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
57 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/iife-return-modified-later-phi.expect.md
+9 -1
@@ -53,4 +53,12 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: exception) Cannot read properties of null (reading 'push')
59 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
60 + '\n' +
61 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
62 + '\n' +
63 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
64 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/iife-return-modified-later.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) [{}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) {"primitiveVal1":2,"primitiveVal2":null,"primitiveVal3":null}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-phi-primitive.expect.md
+3 -1
@@ -44,4 +44,6 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-types-through-type-cast.flow.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) 4
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md
+3 -1
@@ -62,4 +62,6 @@ export const FIXTURE_ENTRYPOINT = {
62 };
63
64 ```
65 -
\ No newline at end of file
65 +
66 +### Eval output
67 +(kind: ok) [2]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-default-to-true.expect.md
+3 -1
@@ -40,4 +40,6 @@ export const FIXTURE_ENTRYPOINT = {
40 };
41
42 ```
43 -
\ No newline at end of file
43 +
44 +### Eval output
45 +(kind: ok) <div>{"truthyAttribute":true}</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md
+3 -1
@@ -107,4 +107,6 @@ export const FIXTURE_ENTRYPOINT = {
107 };
108
109 ```
110 -
\ No newline at end of file
110 +
111 +### Eval output
112 +(kind: ok) <div><div>One!</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.expect.md
+9 -1
@@ -75,4 +75,12 @@ export const FIXTURE_ENTRYPOINT = {
75 };
76
77 ```
78 -
\ No newline at end of file
78 +
79 +### Eval output
80 +(kind: exception) Bar is not defined
81 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
82 + '\n' +
83 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
84 + '\n' +
85 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
86 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-preserve-whitespace.expect.md
+3 -1
@@ -77,4 +77,6 @@ export const FIXTURE_ENTRYPOINT = {
77 };
78
79 ```
80 -
\ No newline at end of file
80 +
81 +### Eval output
82 +(kind: ok) <div>Before text<div>StaticText1</div>Middle text<div>StaticText1Inner before text<div>StaticText1</div>Inner middle text<div>StaticText1</div>Inner after text</div>After text</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-reactive-local-variable-member-expr.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) "[[ function params=0 ]]"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md
+3 -1
@@ -105,4 +105,6 @@ export const FIXTURE_ENTRYPOINT = {
105 };
106
107 ```
108 -
\ No newline at end of file
108 +
109 +### Eval output
110 +(kind: ok) <div>StaticText1<div>StaticText2</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md
+3 -1
@@ -62,4 +62,6 @@ export const FIXTURE_ENTRYPOINT = {
62 };
63
64 ```
65 -
\ No newline at end of file
65 +
66 +### Eval output
67 +(kind: ok) <div>StaticText1string value 1<div>StaticText2</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-ternary-local-variable.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) <div>HigherOrderComponent<div>StaticText2</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-captured.expect.md
+3 -1
@@ -49,4 +49,6 @@ export const FIXTURE_ENTRYPOINT = {
49 };
50
51 ```
52 -
\ No newline at end of file
52 +
53 +### Eval output
54 +(kind: ok) 0
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-param.expect.md
+3 -1
@@ -47,4 +47,6 @@ export const FIXTURE_ENTRYPOINT = {
47 };
48
49 ```
50 -
\ No newline at end of file
50 +
51 +### Eval output
52 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-reassign-primitive.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) 41
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-reassign-shadowed-primitive.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) {}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-return-expression.expect.md
+4 -1
@@ -36,4 +36,7 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok)
42 +logs: [{}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md
+3 -1
@@ -73,4 +73,6 @@ export const FIXTURE_ENTRYPOINT = {
73 };
74
75 ```
76 -
\ No newline at end of file
76 +
77 +### Eval output
78 +(kind: ok) <div>Hello</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/mege-consecutive-scopes-dont-merge-with-different-deps.expect.md
+3 -1
@@ -64,4 +64,6 @@ export const FIXTURE_ENTRYPOINT = {
64 };
65
66 ```
67 -
\ No newline at end of file
67 +
68 +### Eval output
69 +(kind: ok) {"a":4,"b":42,"c":["static"]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/memoization-comments.expect.md
+3 -1
@@ -73,4 +73,6 @@ function Component(props) {
73 export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{ a: 1, b: 10 }] };
74
75 ```
76 -
\ No newline at end of file
76 +
77 +### Eval output
78 +(kind: ok) [1,2,10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-nested-scopes.expect.md
+3 -1
@@ -49,4 +49,6 @@ export const FIXTURE_ENTRYPOINT = {
49 };
50
51 ```
52 -
\ No newline at end of file
52 +
53 +### Eval output
54 +(kind: ok) {"session_id":4}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-no-deps.expect.md
+3 -1
@@ -41,4 +41,6 @@ export const FIXTURE_ENTRYPOINT = {
41 };
42
43 ```
44 -
\ No newline at end of file
44 +
45 +### Eval output
46 +(kind: ok) {"session_id":4}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-objects.expect.md
+9 -1
@@ -100,4 +100,12 @@ export const FIXTURE_ENTRYPOINT = {
100 };
101
102 ```
103 -
\ No newline at end of file
103 +
104 +### Eval output
105 +(kind: exception) useState is not defined
106 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
107 + '\n' +
108 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
109 + '\n' +
110 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
111 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md
+9 -1
@@ -81,4 +81,12 @@ export const FIXTURE_ENTRYPOINT = {
81 };
82
83 ```
84 -
\ No newline at end of file
84 +
85 +### Eval output
86 +(kind: exception) useState is not defined
87 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
88 + '\n' +
89 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
90 + '\n' +
91 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
92 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-nested-scopes-with-same-inputs.expect.md
+9 -1
@@ -55,4 +55,12 @@ export const FIXTURE_ENTRYPOINT = {
55 };
56
57 ```
58 -
\ No newline at end of file
58 +
59 +### Eval output
60 +(kind: exception) mutate is not defined
61 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
62 + '\n' +
63 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
64 + '\n' +
65 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
66 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/method-call.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) 4
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/mutable-lifetime-loops.expect.md
+3 -1
@@ -119,4 +119,6 @@ export const FIXTURE_ENTRYPOINT = {
119 };
120
121 ```
122 -
\ No newline at end of file
122 +
123 +### Eval output
124 +(kind: ok) {"a":{"value":6},"b":{"value":5},"c":{"value":4},"d":{"value":6}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.expect.md
+3 -1
@@ -104,4 +104,6 @@ export const FIXTURE_ENTRYPOINT = {
104 };
105
106 ```
107 -
\ No newline at end of file
107 +
108 +### Eval output
109 +(kind: ok) {"b":[{}],"value":[{"c":{},"value":"[[ cyclic ref *0 ]]"},null]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/mutation-during-jsx-construction.expect.md
+3 -1
@@ -50,4 +50,6 @@ export const FIXTURE_ENTRYPOINT = {
50 };
51
52 ```
53 -
\ No newline at end of file
53 +
54 +### Eval output
55 +(kind: ok) <div>42</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/noAlias-filter-on-array-prop.expect.md
+3 -1
@@ -73,4 +73,6 @@ export const FIXTURE_ENTRYPOINT = {
73 };
74
75 ```
76 -
\ No newline at end of file
76 +
77 +### Eval output
78 +(kind: ok) [{"a":true},true,false,"string",3.14,[null]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-expression-computed-key-constant-number.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) {"42":["hello!"]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-expression-computed-key-constant-string.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok) {"KeyName":[42]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-expression-computed-key-non-reactive.expect.md
+3 -1
@@ -57,4 +57,6 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: ok) {"2":["Compiler"]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-expression-computed-key-object-mutated-later.expect.md
+3 -1
@@ -64,4 +64,6 @@ export const FIXTURE_ENTRYPOINT = {
64 };
65
66 ```
67 -
\ No newline at end of file
67 +
68 +### Eval output
69 +(kind: ok) {"[object Object]":[42]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-expression-computed-key.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) {"Sathya":["Compiler",2]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-3.expect.md
+3 -1
@@ -44,4 +44,6 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) {"a":{"x":1},"wat0":"joe"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-1.expect.md
+3 -1
@@ -60,4 +60,6 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) {"x":"[[ function params=0 ]]","y":"[[ function params=0 ]]"}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-2.expect.md
+3 -1
@@ -66,4 +66,6 @@ export const FIXTURE_ENTRYPOINT = {
66 };
67
68 ```
69 -
\ No newline at end of file
69 +
70 +### Eval output
71 +(kind: ok) {"x":[null],"y":"[[ function params=0 ]]","z":{}}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/option-enable-change-variable-codegen.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) [3.14,true]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) [{},[42,"[[ cyclic ref *1 ]]"]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md
+3 -1
@@ -72,4 +72,6 @@ export const FIXTURE_ENTRYPOINT = {
72 };
73
74 ```
75 -
\ No newline at end of file
75 +
76 +### Eval output
77 +(kind: ok) [{},{"a":"a!","x":"[[ cyclic ref *1 ]]"}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/preserve-jsxtext-stringliteral-distinction.expect.md
+3 -1
@@ -35,4 +35,6 @@ export const FIXTURE_ENTRYPOINT = {
35 };
36
37 ```
38 -
\ No newline at end of file
38 +
39 +### Eval output
40 +(kind: ok) <div> , </div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/property-call-evaluation-order.expect.md
+4 -1
@@ -60,4 +60,7 @@ export const FIXTURE_ENTRYPOINT = {
60 };
61
62 ```
63 -
\ No newline at end of file
63 +
64 +### Eval output
65 +(kind: ok) {"f":"[[ function params=0 ]]"}
66 +logs: ['A','arg','original']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/react-namespace.expect.md
+3 -1
@@ -65,4 +65,6 @@ export const FIXTURE_ENTRYPOINT = {
65 };
66
67 ```
68 -
\ No newline at end of file
68 +
69 +### Eval output
70 +(kind: ok) <div><div>Hello</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-do-while-indirect.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-do-while-test.expect.md
+3 -1
@@ -61,4 +61,6 @@ export const FIXTURE_ENTRYPOINT = {
61 };
62
63 ```
64 -
\ No newline at end of file
64 +
65 +### Eval output
66 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-for-init.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) [0]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-for-test.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-for-update.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [2]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-forin-collection.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-forof-collection.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-if.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) [1]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-reactive-after-fixpoint.expect.md
+3 -1
@@ -76,4 +76,6 @@ export const FIXTURE_ENTRYPOINT = {
76 };
77
78 ```
79 -
\ No newline at end of file
79 +
80 +### Eval output
81 +(kind: ok) [0]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-case-test.expect.md
+3 -1
@@ -67,4 +67,6 @@ export const FIXTURE_ENTRYPOINT = {
67 };
68
69 ```
70 -
\ No newline at end of file
70 +
71 +### Eval output
72 +(kind: ok) [1]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.expect.md
+3 -1
@@ -66,4 +66,6 @@ export const FIXTURE_ENTRYPOINT = {
66 };
67
68 ```
69 -
\ No newline at end of file
69 +
70 +### Eval output
71 +(kind: ok) [1]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-while-test.expect.md
+3 -1
@@ -61,4 +61,6 @@ export const FIXTURE_ENTRYPOINT = {
61 };
62
63 ```
64 -
\ No newline at end of file
64 +
65 +### Eval output
66 +(kind: ok) [10]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-dependency-fixpoint.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) [42]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-dependency-nonreactive-captured-with-reactive.expect.md
+3 -1
@@ -47,4 +47,6 @@ export const FIXTURE_ENTRYPOINT = {
47 };
48
49 ```
50 -
\ No newline at end of file
50 +
51 +### Eval output
52 +(kind: ok) [{},42]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-dependency-object-captured-with-reactive-mutated.expect.md
+3 -1
@@ -56,4 +56,6 @@ export const FIXTURE_ENTRYPOINT = {
56 };
57
58 ```
59 -
\ No newline at end of file
59 +
60 +### Eval output
61 +(kind: ok) [{}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md
+3 -1
@@ -47,4 +47,6 @@ export const FIXTURE_ENTRYPOINT = {
47 };
48
49 ```
50 -
\ No newline at end of file
50 +
51 +### Eval output
52 +(kind: ok) {"y":[{}]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-testifelse.expect.md
+3 -1
@@ -67,4 +67,6 @@ export const FIXTURE_ENTRYPOINT = {
67 };
68
69 ```
70 -
\ No newline at end of file
70 +
71 +### Eval output
72 +(kind: ok) {"wat0":2}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-import-specifier.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) {"x":0}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md
+9 -1
@@ -57,4 +57,12 @@ export const FIXTURE_ENTRYPOINT = {
57 };
58
59 ```
60 -
\ No newline at end of file
60 +
61 +### Eval output
62 +(kind: exception) Bar is not defined
63 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
64 + '\n' +
65 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
66 + '\n' +
67 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
68 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-type-import.expect.md
+3 -1
@@ -39,4 +39,6 @@ export const FIXTURE_ENTRYPOINT = {
39 };
40
41 ```
42 -
\ No newline at end of file
42 +
43 +### Eval output
44 +(kind: ok) <div>hello world</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-hoisting-variable-collision.expect.md
+3 -1
@@ -54,4 +54,6 @@ export const FIXTURE_ENTRYPOINT = {
54 };
55
56 ```
57 -
\ No newline at end of file
57 +
58 +### Eval output
59 +(kind: ok) [42,[0,42,null,null,{"object":true}]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md
+3 -1
@@ -38,4 +38,6 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) ["foo",["bar","baz"]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md
+3 -1
@@ -38,4 +38,6 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) ["foo",["bar","baz"]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md
+3 -1
@@ -38,4 +38,6 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) ["foo",null]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/sequentially-constant-progagatable-if-test-conditions.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) "ok"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md
+3 -1
@@ -36,4 +36,6 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok) null
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md
+3 -1
@@ -34,4 +34,6 @@ export const FIXTURE_ENTRYPOINT = {
34 };
35
36 ```
37 -
\ No newline at end of file
37 +
38 +### Eval output
39 +(kind: ok) <div>wat</div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) "[[ function params=1 ]]"
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/skip-useMemoCache.expect.md
+9 -1
@@ -42,4 +42,12 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: exception) useMemoCache is not defined
48 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
49 + '\n' +
50 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
51 + '\n' +
52 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
53 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-complex-multiple-if.expect.md
+3 -1
@@ -35,4 +35,6 @@ export const FIXTURE_ENTRYPOINT = {
35 };
36
37 ```
38 -
\ No newline at end of file
38 +
39 +### Eval output
40 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-complex-single-if.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-for.expect.md
+3 -1
@@ -36,4 +36,6 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok) 11
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-if-else.expect.md
+3 -1
@@ -33,4 +33,6 @@ export const FIXTURE_ENTRYPOINT = {
33 };
34
35 ```
36 -
\ No newline at end of file
36 +
37 +### Eval output
38 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) {"x":1,"y":3}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) {"x":[[]]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-property.expect.md
+3 -1
@@ -49,4 +49,6 @@ export const FIXTURE_ENTRYPOINT = {
49 };
50
51 ```
52 -
\ No newline at end of file
52 +
53 +### Eval output
54 +(kind: ok) {"x":[]}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-return.expect.md
+3 -1
@@ -33,4 +33,6 @@ export const FIXTURE_ENTRYPOINT = {
33 };
34
35 ```
36 -
\ No newline at end of file
36 +
37 +### Eval output
38 +(kind: ok) 2
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-simple-phi.expect.md
+3 -1
@@ -34,4 +34,6 @@ export const FIXTURE_ENTRYPOINT = {
34 };
35
36 ```
37 -
\ No newline at end of file
37 +
38 +### Eval output
39 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-simple.expect.md
+3 -1
@@ -27,4 +27,6 @@ export const FIXTURE_ENTRYPOINT = {
27 };
28
29 ```
30 -
\ No newline at end of file
30 +
31 +### Eval output
32 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-single-if.expect.md
+3 -1
@@ -31,4 +31,6 @@ export const FIXTURE_ENTRYPOINT = {
31 };
32
33 ```
34 -
\ No newline at end of file
34 +
35 +### Eval output
36 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-switch.expect.md
+3 -1
@@ -53,4 +53,6 @@ export const FIXTURE_ENTRYPOINT = {
53 };
54
55 ```
56 -
\ No newline at end of file
56 +
57 +### Eval output
58 +(kind: ok)
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-throw.expect.md
+9 -1
@@ -32,4 +32,12 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: exception) undefined
38 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
39 + '\n' +
40 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
41 + '\n' +
42 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
43 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ssa-while.expect.md
+3 -1
@@ -37,4 +37,6 @@ export const FIXTURE_ENTRYPOINT = {
37 };
38
39 ```
40 -
\ No newline at end of file
40 +
41 +### Eval output
42 +(kind: ok) 10
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/todo-validate-identifiers-object-key.expect.md
+3 -1
@@ -43,4 +43,6 @@ export const FIXTURE_ENTRYPOINT = {
43 };
44
45 ```
46 -
\ No newline at end of file
46 +
47 +### Eval output
48 +(kind: ok) {"a.b":1,"a\b":2,"a/b":3,"a+b":4,"a b":5}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/transitive-freeze-array.expect.md
+3 -1
@@ -52,4 +52,6 @@ export const FIXTURE_ENTRYPOINT = {
52 };
53
54 ```
55 -
\ No newline at end of file
55 +
56 +### Eval output
57 +(kind: ok) [{},{"wat0":"joe"},["[[ cyclic ref *1 ]]"]]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-alias-try-values.expect.md
+3 -1
@@ -59,4 +59,6 @@ export const FIXTURE_ENTRYPOINT = {
59 };
60
61 ```
62 -
\ No newline at end of file
62 +
63 +### Eval output
64 +(kind: ok) [null]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-empty-try.expect.md
+3 -1
@@ -32,4 +32,6 @@ export const FIXTURE_ENTRYPOINT = {
32 };
33
34 ```
35 -
\ No newline at end of file
35 +
36 +### Eval output
37 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-mutate-outer-value.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) [{"a":1}]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-returns.expect.md
+3 -1
@@ -36,4 +36,6 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-throws-after-constant-propagation.expect.md
+3 -1
@@ -36,4 +36,6 @@ export const FIXTURE_ENTRYPOINT = {
36 };
37
38 ```
39 -
\ No newline at end of file
39 +
40 +### Eval output
41 +(kind: ok) 42
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md
+3 -1
@@ -58,4 +58,6 @@ export const FIXTURE_ENTRYPOINT = {
58 };
59
60 ```
61 -
\ No newline at end of file
61 +
62 +### Eval output
63 +(kind: ok) ["foo","bar"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md
+3 -1
@@ -47,4 +47,6 @@ export const FIXTURE_ENTRYPOINT = {
47 };
48
49 ```
50 -
\ No newline at end of file
50 +
51 +### Eval output
52 +(kind: ok) ["foo","bar"]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md
+3 -1
@@ -48,4 +48,6 @@ export const FIXTURE_ENTRYPOINT = {
48 };
49
50 ```
51 -
\ No newline at end of file
51 +
52 +### Eval output
53 +(kind: ok) [null]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md
+3 -1
@@ -61,4 +61,6 @@ export const FIXTURE_ENTRYPOINT = {
61 };
62
63 ```
64 -
\ No newline at end of file
64 +
65 +### Eval output
66 +(kind: ok) null
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-within-mutable-range.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) [{},null]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch.expect.md
+3 -1
@@ -51,4 +51,6 @@ export const FIXTURE_ENTRYPOINT = {
51 };
52
53 ```
54 -
\ No newline at end of file
54 +
55 +### Eval output
56 +(kind: ok) null
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/type-field-load.expect.md
+3 -1
@@ -41,4 +41,6 @@ export const FIXTURE_ENTRYPOINT = {
41 };
42
43 ```
44 -
\ No newline at end of file
44 +
45 +### Eval output
46 +(kind: ok) 1
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md
+3 -1
@@ -44,4 +44,6 @@ export const FIXTURE_ENTRYPOINT = {
44 };
45
46 ```
47 -
\ No newline at end of file
47 +
48 +### Eval output
49 +(kind: ok) {}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/type-test-primitive.expect.md
+3 -1
@@ -31,4 +31,6 @@ export const FIXTURE_ENTRYPOINT = {
31 };
32
33 ```
34 -
\ No newline at end of file
34 +
35 +### Eval output
36 +(kind: ok) 2
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-constant-propagation.expect.md
+3 -1
@@ -42,4 +42,6 @@ export const FIXTURE_ENTRYPOINT = {
42 };
43
44 ```
45 -
\ No newline at end of file
45 +
46 +### Eval output
47 +(kind: ok) {"a":0,"b":0,"c":2,"d":2,"e":0}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-in-sequence.expect.md
+3 -1
@@ -55,4 +55,6 @@ export const FIXTURE_ENTRYPOINT = {
55 };
56
57 ```
58 -
\ No newline at end of file
58 +
59 +### Eval output
60 +(kind: ok) [4,2,3,4]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter.expect.md
+3 -1
@@ -71,4 +71,6 @@ export const FIXTURE_ENTRYPOINT = {
71 };
72
73 ```
74 -
\ No newline at end of file
74 +
75 +### Eval output
76 +(kind: ok) [4,1,4,2,4,3,1,4,4]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression.expect.md
+3 -1
@@ -46,4 +46,6 @@ export const FIXTURE_ENTRYPOINT = {
46 };
47
48 ```
49 -
\ No newline at end of file
49 +
50 +### Eval output
51 +(kind: ok) {"x":1,"y":1,"z":2}
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useContext-maybe-mutate-context-in-callback.expect.md
+3 -1
@@ -68,4 +68,6 @@ export const FIXTURE_ENTRYPOINT = {
68 };
69
70 ```
71 -
\ No newline at end of file
71 +
72 +### Eval output
73 +(kind: ok) <div><div>Hello</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useContext-read-context-in-callback-if-condition.expect.md
+9 -1
@@ -83,4 +83,12 @@ export const FIXTURE_ENTRYPOINT = {
83 };
84
85 ```
86 -
\ No newline at end of file
86 +
87 +### Eval output
88 +(kind: exception) Child is not defined
89 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
90 + '\n' +
91 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
92 + '\n' +
93 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
94 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useContext-read-context-in-callback.expect.md
+3 -1
@@ -65,4 +65,6 @@ export const FIXTURE_ENTRYPOINT = {
65 };
66
67 ```
68 -
\ No newline at end of file
68 +
69 +### Eval output
70 +(kind: ok) <div><div>Hello</div></div>
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md
+3 -1
@@ -66,4 +66,6 @@ export const FIXTURE_ENTRYPOINT = {
66 };
67
68 ```
69 -
\ No newline at end of file
69 +
70 +### Eval output
71 +(kind: ok) [2]
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/validate-no-set-state-in-render-unconditional-lambda-which-conditionally-sets-state-ok.expect.md
+9 -1
@@ -72,4 +72,12 @@ export const FIXTURE_ENTRYPOINT = {
72 };
73
74 ```
75 -
\ No newline at end of file
75 +
76 +### Eval output
77 +(kind: exception) useState is not defined
78 +logs: ['The above error occurred in the <WrapperTestComponent> component:\n' +
79 + '\n' +
80 + ' at WrapperTestComponent (<project_root>/packages/sprout/dist/runner-evaluator.js:50:26)\n' +
81 + '\n' +
82 + 'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
83 + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.']
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/while-with-assignment-in-test.expect.md
+3 -1
@@ -38,4 +38,6 @@ export const FIXTURE_ENTRYPOINT = {
38 };
39
40 ```
41 -
\ No newline at end of file
41 +
42 +### Eval output
43 +(kind: ok) 6
\ No newline at end of file
compiler/packages/fixture-test-utils/src/constants.ts
+4
@@ -8,6 +8,9 @@
8 import path from "path";
9
10 // We assume this is run from `babel-plugin-react-forget`
11 +export const PROJECT_ROOT = path.normalize(
12 + path.join(process.cwd(), "..", "..")
13 +);
14 export const COMPILER_PATH = path.join(
15 process.cwd(),
16 "dist",
@@ -33,5 +36,6 @@ export const FIXTURES_PATH = path.join(
36 "fixtures",
37 "compiler"
38 );
39 +export const SNAPSHOT_EXTENSION = ".expect.md";
40 export const FILTER_FILENAME = "testfilter.txt";
41 export const FILTER_PATH = path.join(process.cwd(), FILTER_FILENAME);
compiler/packages/fixture-test-utils/src/fixture-utils.ts
+83 -85
@@ -7,11 +7,12 @@
7
8 import fs from "fs/promises";
9 import glob from "glob";
10 -import invariant from "invariant";
10 import path from "path";
12 -import { FILTER_PATH, FIXTURES_PATH } from "./constants";
11 +import { FILTER_PATH, FIXTURES_PATH, SNAPSHOT_EXTENSION } from "./constants";
12
13 const KIND_DEFAULT = "only";
14 +const INPUT_EXTENSIONS = [".js", ".ts", ".jsx", ".tsx"];
15 +
16 export type TestFilter =
17 | {
18 kind: "only";
@@ -93,113 +94,110 @@ export async function readTestFilter(): Promise<TestFilter | null> {
94 };
95 }
96
96 -export type TestFixture = {
97 - basename: string;
98 - inputPath: string | null;
99 - outputPath: string;
100 - outputExists: boolean;
101 -};
97 +export function getBasename(fixture: TestFixture): string {
98 + return stripExtension(path.basename(fixture.inputPath), INPUT_EXTENSIONS);
99 +}
100 +export function isExpectError(fixture: TestFixture): boolean {
101 + const basename = getBasename(fixture);
102 + return basename.startsWith("error.") || basename.startsWith("todo.error");
103 +}
104
103 -const INPUT_EXTENSIONS = [".js", ".ts", ".jsx", ".tsx"];
104 -const OUTPUT_EXTENSION = ".expect.md";
105 -export function getFixtures(
105 +export type TestFixture =
106 + | {
107 + input: string | null;
108 + inputPath: string;
109 + snapshot: string | null;
110 + snapshotPath: string;
111 + }
112 + | {
113 + input: null;
114 + inputPath: string;
115 + snapshot: string;
116 + snapshotPath: string;
117 + };
118 +
119 +async function readInputFixtures(
120 + rootDir: string,
121 filter: TestFilter | null
107 -): Map<string, TestFixture> {
108 - // search for fixtures within nested directories
122 +): Promise<Map<string, { value: string; filepath: string }>> {
123 const inputFiles = glob.sync(`**/*{${INPUT_EXTENSIONS.join(",")}}`, {
110 - cwd: FIXTURES_PATH,
124 + cwd: rootDir,
125 });
112 - const fixtures: Map<string, TestFixture> = new Map();
126 + const inputs: Array<Promise<[string, { value: string; filepath: string }]>> =
127 + [];
128 for (const filePath of inputFiles) {
129 // Do not include extensions in unique identifier for fixture
130 const partialPath = stripExtension(filePath, INPUT_EXTENSIONS);
131 if (shouldSkip(filter, partialPath)) {
132 continue;
133 }
119 -
120 - const fixtureInfo = fixtures.get(partialPath);
121 - if (fixtureInfo === undefined) {
122 - fixtures.set(partialPath, {
123 - basename: path.basename(partialPath),
124 - inputPath: path.join(FIXTURES_PATH, filePath),
125 - outputPath: path.join(FIXTURES_PATH, partialPath) + OUTPUT_EXTENSION,
126 - outputExists: false,
127 - });
128 - } else {
129 - console.warn(
130 - "Found duplicate fixture files: ",
131 - fixtureInfo.inputPath,
132 - filePath
133 - );
134 - }
134 + inputs.push(
135 + fs.readFile(path.join(rootDir, filePath), "utf8").then((input) => {
136 + return [
137 + partialPath,
138 + {
139 + value: input,
140 + filepath: filePath,
141 + },
142 + ];
143 + })
144 + );
145 }
136 -
137 - const outputFiles = glob.sync(`**/*${OUTPUT_EXTENSION}`, {
138 - cwd: FIXTURES_PATH,
146 + return new Map(await Promise.all(inputs));
147 +}
148 +async function readOutputFixtures(
149 + rootDir: string,
150 + filter: TestFilter | null
151 +): Promise<Map<string, string>> {
152 + const outputFiles = glob.sync(`**/*${SNAPSHOT_EXTENSION}`, {
153 + cwd: rootDir,
154 });
155 + const outputs: Array<Promise<[string, string]>> = [];
156 for (const filePath of outputFiles) {
157 // Do not include extensions in unique identifier for fixture
142 - const partialPath = stripExtension(filePath, [OUTPUT_EXTENSION]);
158 + const partialPath = stripExtension(filePath, [SNAPSHOT_EXTENSION]);
159 if (shouldSkip(filter, partialPath)) {
160 continue;
161 }
162
147 - const fixtureInfo = fixtures.get(partialPath);
148 - if (fixtureInfo === undefined) {
149 - fixtures.set(partialPath, {
150 - basename: path.basename(partialPath),
151 - inputPath: null,
152 - outputPath: path.join(FIXTURES_PATH, filePath),
153 - outputExists: true,
163 + const outputPath = path.join(rootDir, filePath);
164 + const output: Promise<[string, string]> = fs
165 + .readFile(outputPath, "utf8")
166 + .then((output) => {
167 + return [partialPath, output];
168 });
155 - } else {
156 - invariant(
157 - fixtureInfo.outputPath === path.join(FIXTURES_PATH, filePath),
158 - "Unexpected output filepath"
159 - );
160 - fixtureInfo.outputExists = true;
161 - }
169 + outputs.push(output);
170 }
163 -
164 - return fixtures;
171 + return new Map(await Promise.all(outputs));
172 }
173
167 -function wrapWithTripleBackticks(s: string, ext: string | null = null): string {
168 - return `\`\`\`${ext ?? ""}
169 -${s}
170 -\`\`\``;
171 -}
174 +export async function getFixtures(
175 + filter: TestFilter | null
176 +): Promise<Map<string, TestFixture>> {
177 + const inputs = await readInputFixtures(FIXTURES_PATH, filter);
178 + const outputs = await readOutputFixtures(FIXTURES_PATH, filter);
179
173 -export function writeOutputToString(
174 - input: string,
175 - output: string | null,
176 - error: Error | null
177 -) {
178 - // leading newline intentional
179 - let result = `
180 -## Input
181 -
182 -${wrapWithTripleBackticks(input, "javascript")}
183 -`; // trailing newline + space internional
184 -
185 - if (output != null) {
186 - result += `
187 -## Code
188 -
189 -${output == null ? "[ none ]" : wrapWithTripleBackticks(output, "javascript")}
190 -`;
191 - } else {
192 - result += "\n";
180 + const fixtures: Map<string, TestFixture> = new Map();
181 + for (const [partialPath, { value, filepath }] of inputs) {
182 + const output = outputs.get(partialPath) ?? null;
183 + fixtures.set(partialPath, {
184 + input: value,
185 + inputPath: filepath,
186 + snapshot: output,
187 + snapshotPath: path.join(FIXTURES_PATH, partialPath) + SNAPSHOT_EXTENSION,
188 + });
189 }
190
195 - if (error != null) {
196 - const errorMessage = error.message.replace(/^\/.*?:\s/, "");
197 -
198 - result += `
199 -## Error
200 -
201 -${wrapWithTripleBackticks(errorMessage)}
202 - \n`;
191 + for (const [partialPath, output] of outputs) {
192 + if (!fixtures.has(partialPath)) {
193 + fixtures.set(partialPath, {
194 + input: null,
195 + inputPath: "none",
196 + snapshot: output,
197 + snapshotPath:
198 + path.join(FIXTURES_PATH, partialPath) + SNAPSHOT_EXTENSION,
199 + });
200 + }
201 }
204 - return result + ` `;
202 + return fixtures;
203 }
compiler/packages/fixture-test-utils/src/index.ts
+1
@@ -8,3 +8,4 @@
8 export * from "./constants";
9 export * from "./fixture-utils";
10 export * from "./compiler-utils";
11 +export * from "./output-utils";
compiler/packages/fixture-test-utils/src/output-utils.ts new
+200
@@ -0,0 +1,200 @@
1 +/**
2 + * Copyright (c) Meta Platforms, Inc. and affiliates.
3 + *
4 + * This source code is licensed under the MIT license found in the
5 + * LICENSE file in the root directory of this source tree.
6 + */
7 +
8 +import chalk from "chalk";
9 +import fs from "fs";
10 +import invariant from "invariant";
11 +import { diff } from "jest-diff";
12 +import path from "path";
13 +
14 +function wrapWithTripleBackticks(s: string, ext: string | null = null): string {
15 + return `\`\`\`${ext ?? ""}
16 +${s}
17 +\`\`\``;
18 +}
19 +
20 +export function writeOutputToString(
21 + input: string,
22 + output: string | null,
23 + error: Error | null
24 +) {
25 + // leading newline intentional
26 + let result = `
27 +## Input
28 +
29 +${wrapWithTripleBackticks(input, "javascript")}
30 +`; // trailing newline + space internional
31 +
32 + if (output != null) {
33 + result += `
34 +## Code
35 +
36 +${output == null ? "[ none ]" : wrapWithTripleBackticks(output, "javascript")}
37 +`;
38 + } else {
39 + result += "\n";
40 + }
41 +
42 + if (error != null) {
43 + const errorMessage = error.message.replace(/^\/.*?:\s/, "");
44 +
45 + result += `
46 +## Error
47 +
48 +${wrapWithTripleBackticks(errorMessage)}
49 + \n`;
50 + }
51 + return result + ` `;
52 +}
53 +
54 +export type TestResult = {
55 + actual: string | null; // null == input did not exist
56 + expected: string | null; // null == output did not exist
57 + outputPath: string;
58 + unexpectedError: string | null;
59 +};
60 +export type TestResults = Map<string, TestResult>;
61 +export enum UpdateSnapshotKind {
62 + Snap,
63 + Sprout,
64 +}
65 +const SPROUT_SEPARATOR = "\n### Eval output\n";
66 +export function getUpdatedSnapshot(
67 + currentSnapshot: string | null,
68 + data: string,
69 + kind: UpdateSnapshotKind
70 +): string {
71 + let currentData = currentSnapshot?.split(SPROUT_SEPARATOR) ?? [];
72 + invariant(
73 + currentData.length <= 2,
74 + "Found duplicate sprout snapshots in fixture!"
75 + );
76 + if (kind === UpdateSnapshotKind.Snap) {
77 + const sproutData = currentData[1] ?? null;
78 + const sproutSnapshot =
79 + sproutData != null ? SPROUT_SEPARATOR + sproutData : "";
80 + return data + sproutSnapshot;
81 + } else {
82 + const snapSnapshot = currentData[0] ?? "";
83 + return snapSnapshot + SPROUT_SEPARATOR + data;
84 + }
85 +}
86 +/**
87 + * Update the fixtures directory given the compilation results
88 + */
89 +export async function update(results: TestResults): Promise<void> {
90 + let deleted = 0;
91 + let updated = 0;
92 + let created = 0;
93 + const failed = [];
94 + for (const [basename, result] of results) {
95 + if (result.unexpectedError != null) {
96 + console.log(
97 + chalk.red.inverse.bold(" FAILED ") + " " + chalk.dim(basename)
98 + );
99 + failed.push([basename, result.unexpectedError]);
100 + } else if (result.actual == null) {
101 + // Input was deleted but the expect file still existed, remove it
102 + console.log(
103 + chalk.red.inverse.bold(" REMOVE ") + " " + chalk.dim(basename)
104 + );
105 + try {
106 + fs.unlinkSync(result.outputPath);
107 + console.log(" remove " + result.outputPath);
108 + deleted++;
109 + } catch (e) {
110 + console.error(
111 + "[Snap tester error]: failed to remove " + result.outputPath
112 + );
113 + failed.push([basename, result.unexpectedError]);
114 + }
115 + } else if (result.actual !== result.expected) {
116 + // Expected output has changed
117 + console.log(
118 + chalk.blue.inverse.bold(" UPDATE ") + " " + chalk.dim(basename)
119 + );
120 + try {
121 + fs.writeFileSync(result.outputPath, result.actual, "utf8");
122 + } catch (e) {
123 + if (e?.code === "ENOENT") {
124 + // May have failed to create nested dir, so make a directory and retry
125 + fs.mkdirSync(path.dirname(result.outputPath), { recursive: true });
126 + fs.writeFileSync(result.outputPath, result.actual, "utf8");
127 + }
128 + }
129 + if (result.expected == null) {
130 + created++;
131 + } else {
132 + updated++;
133 + }
134 + } else {
135 + // Expected output is current
136 + console.log(
137 + chalk.green.inverse.bold(" OKAY ") + " " + chalk.dim(basename)
138 + );
139 + }
140 + }
141 + console.log(
142 + `${deleted} Deleted, ${created} Created, ${updated} Updated, ${failed.length} Failed`
143 + );
144 + for (const [basename, errorMsg] of failed) {
145 + console.log(`${chalk.red.bold("Fail:")} ${basename}\n${errorMsg}`);
146 + }
147 +}
148 +
149 +/**
150 + * Report test results to the user
151 + * @returns boolean indicatig whether all tests passed
152 + */
153 +export function report(results: TestResults): boolean {
154 + const failures: Array<[string, TestResult]> = [];
155 + for (const [basename, result] of results) {
156 + if (result.actual === result.expected && result.unexpectedError == null) {
157 + console.log(
158 + chalk.green.inverse.bold(" PASS ") + " " + chalk.dim(basename)
159 + );
160 + } else {
161 + console.log(chalk.red.inverse.bold(" FAIL ") + " " + chalk.dim(basename));
162 + failures.push([basename, result]);
163 + }
164 + }
165 +
166 + if (failures.length !== 0) {
167 + console.log("\n" + chalk.red.bold("Failures:") + "\n");
168 +
169 + for (const [basename, result] of failures) {
170 + console.log(chalk.red.bold("FAIL:") + " " + basename);
171 + if (result.unexpectedError != null) {
172 + console.log(
173 + ` >> Unexpected error during test: \n${result.unexpectedError}`
174 + );
175 + } else {
176 + if (result.expected == null) {
177 + invariant(result.actual != null, "[Tester] Internal failure.");
178 + console.log(
179 + chalk.red("[ expected fixture output is absent ]") + "\n"
180 + );
181 + } else if (result.actual == null) {
182 + invariant(result.expected != null, "[Tester] Internal failure.");
183 + console.log(
184 + chalk.red(`[ fixture input for ${result.outputPath} is absent ]`) +
185 + "\n"
186 + );
187 + } else {
188 + console.log(diff(result.expected, result.actual) + "\n");
189 + }
190 + }
191 + }
192 + }
193 +
194 + console.log(
195 + `${results.size} Tests, ${results.size - failures.length} Passed, ${
196 + failures.length
197 + } Failed`
198 + );
199 + return failures.length === 0;
200 +}
compiler/packages/snap/src/compiler-worker.ts
+10 -17
@@ -9,10 +9,14 @@ import type { runReactForgetBabelPlugin as RunReactForgetBabelPlugin } from "bab
9 import type { parseConfigPragma as ParseConfigPragma } from "babel-plugin-react-forget/src/HIR/Environment";
10 import {
11 TestFixture,
12 + TestResult,
13 + UpdateSnapshotKind,
14 + getBasename,
15 + getUpdatedSnapshot,
16 + isExpectError,
17 transformFixtureInput,
18 writeOutputToString,
19 } from "fixture-test-utils";
15 -import fs from "fs/promises";
20
21 const originalConsoleError = console.error;
22
@@ -29,13 +33,6 @@ export function clearRequireCache() {
33 });
34 }
35
32 -export type TestResult = {
33 - outputPath: string;
34 - actual: string | null; // null == input did not exist
35 - expected: string | null; // null == output did not exist
36 - unexpectedError: string | null;
37 -};
38 -
36 export async function compile(
37 compilerPath: string,
38 loggerPath: string,
@@ -53,9 +50,8 @@ export async function compile(
50 clearRequireCache();
51 }
52 version = compilerVersion;
56 - const { inputPath, outputPath, outputExists, basename } = fixture;
57 - const input = inputPath != null ? await fs.readFile(inputPath, "utf8") : null;
58 - const expected = outputExists ? await fs.readFile(outputPath, "utf8") : null;
53 + const { input, snapshot: expected, snapshotPath: outputPath } = fixture;
54 + const basename = getBasename(fixture);
55
56 // Input will be null if the input file did not exist, in which case the output file
57 // is stale
@@ -107,11 +103,8 @@ export async function compile(
103 }
104 }
105
110 - const output = writeOutputToString(input, code, error);
111 - const expectError =
112 - basename.startsWith("error.") || basename.startsWith("todo.error");
106 let unexpectedError: string | null = null;
114 - if (expectError) {
107 + if (isExpectError(fixture)) {
108 if (error === null) {
109 unexpectedError = `Expected an error to be thrown for fixture: '${basename}', remove the 'error.' prefix if an error is not expected.`;
110 }
@@ -124,10 +117,10 @@ export async function compile(
117 }
118
119 console.error = originalConsoleError;
127 -
120 + const output = writeOutputToString(input, code, error);
121 return {
122 outputPath,
130 - actual: output,
123 + actual: getUpdatedSnapshot(expected, output, UpdateSnapshotKind.Snap),
124 expected,
125 unexpectedError,
126 };
compiler/packages/snap/src/runner.ts
+6 -115
@@ -6,7 +6,6 @@
6 */
7
8 import watcher from "@parcel/watcher";
9 -import chalk from "chalk";
9 import {
10 COMPILER_PATH,
11 FILTER_FILENAME,
@@ -15,12 +14,13 @@ import {
14 LOGGER_PATH,
15 PARSE_CONFIG_PRAGMA_PATH,
16 TestFilter,
17 + TestResult,
18 + TestResults,
19 getFixtures,
20 readTestFilter,
21 + report,
22 + update,
23 } from "fixture-test-utils";
21 -import fs from "fs";
22 -import invariant from "invariant";
23 -import { diff } from "jest-diff";
24 import { Worker } from "jest-worker";
25 import path from "path";
26 import process from "process";
@@ -29,7 +29,6 @@ import ts from "typescript";
29 import yargs from "yargs";
30 import { hideBin } from "yargs/helpers";
31 import * as compiler from "./compiler-worker";
32 -import { TestResult } from "./compiler-worker";
32
33 const WORKER_PATH = require.resolve("./compiler-worker.js");
34
@@ -49,7 +48,6 @@ process.on("SIGTERM", function () {
48 cleanup(-1);
49 });
50
52 -type Results = Map<string, TestResult>;
51 type RunnerOptions = {
52 sync: boolean;
53 workerThreads: boolean;
@@ -110,11 +108,11 @@ async function run(
108 opts: RunnerOptions,
109 filter: TestFilter | null,
110 compilerVersion: number
113 -): Promise<Results> {
111 +): Promise<TestResults> {
112 // We could in theory be fancy about tracking the contents of the fixtures
113 // directory via our file subscription, but it's simpler to just re-read
114 // the directory each time.
117 - const fixtures = getFixtures(filter);
115 + const fixtures = await getFixtures(filter);
116 const isOnlyFixture = filter !== null && fixtures.size === 1;
117
118 let entries: Array<[string, TestResult]>;
@@ -157,113 +155,6 @@ async function run(
155 return new Map(entries);
156 }
157
160 -/**
161 - * Report test results to the user
162 - * @returns boolean indicatig whether all tests passed
163 - */
164 -function report(results: Results): boolean {
165 - const failures: Array<[string, TestResult]> = [];
166 - for (const [basename, result] of results) {
167 - if (result.actual === result.expected && result.unexpectedError == null) {
168 - console.log(
169 - chalk.green.inverse.bold(" PASS ") + " " + chalk.dim(basename)
170 - );
171 - } else {
172 - console.log(chalk.red.inverse.bold(" FAIL ") + " " + chalk.dim(basename));
173 - failures.push([basename, result]);
174 - }
175 - }
176 -
177 - if (failures.length !== 0) {
178 - console.log("\n" + chalk.red.bold("Failures:") + "\n");
179 -
180 - for (const [basename, result] of failures) {
181 - console.log(chalk.red.bold("FAIL:") + " " + basename);
182 - if (result.unexpectedError != null) {
183 - console.log(
184 - ` >> Unexpected error during test: \n${result.unexpectedError}`
185 - );
186 - } else {
187 - if (result.expected == null) {
188 - invariant(result.actual != null, "[Snap tester] Internal failure.");
189 - console.log(
190 - chalk.red("[ expected fixture output is absent ]") + "\n"
191 - );
192 - } else if (result.actual == null) {
193 - invariant(result.expected != null, "[Snap tester] Internal failure.");
194 - console.log(
195 - chalk.red("[ fixture input (test.js) is absent ]") + "\n"
196 - );
197 - } else {
198 - console.log(diff(result.expected, result.actual) + "\n");
199 - }
200 - }
201 - }
202 - }
203 -
204 - console.log(
205 - `${results.size} Tests, ${results.size - failures.length} Passed, ${
206 - failures.length
207 - } Failed`
208 - );
209 - return failures.length === 0;
210 -}
211 -
212 -/**
213 - * Update the fixtures directory given the compilation results
214 - */
215 -async function update(results: Results): Promise<void> {
216 - let deleted = 0;
217 - let updated = 0;
218 - let created = 0;
219 - const failed = [];
220 - for (const [basename, result] of results) {
221 - if (result.unexpectedError != null) {
222 - console.log(
223 - chalk.red.inverse.bold(" FAILED ") + " " + chalk.dim(basename)
224 - );
225 - failed.push([basename, result.unexpectedError]);
226 - } else if (result.actual == null) {
227 - // Input was deleted but the expect file still existed, remove it
228 - console.log(
229 - chalk.red.inverse.bold(" REMOVE ") + " " + chalk.dim(basename)
230 - );
231 - try {
232 - fs.unlinkSync(result.outputPath);
233 - console.log(" remove " + result.outputPath);
234 - deleted++;
235 - } catch (e) {
236 - console.error(
237 - "[Snap tester error]: failed to remove " + result.outputPath
238 - );
239 - failed.push([basename, result.unexpectedError]);
240 - }
241 - } else if (result.actual !== result.expected) {
242 - // Expected output has changed
243 - console.log(
244 - chalk.blue.inverse.bold(" UPDATE ") + " " + chalk.dim(basename)
245 - );
246 - fs.writeFileSync(result.outputPath, result.actual, "utf8");
247 - if (result.expected == null) {
248 - created++;
249 - } else {
250 - updated++;
251 - }
252 - } else {
253 - // Expected output is current
254 - console.log(
255 - chalk.green.inverse.bold(" OKAY ") + " " + chalk.dim(basename)
256 - );
257 - }
258 - }
259 - console.log(
260 - `${deleted} Deleted, ${created} Created, ${updated} Updated, ${failed.length} Failed`
261 - );
262 - for (const [basename, errorMsg] of failed) {
263 - console.log(`${chalk.red.bold("Fail:")} ${basename}\n${errorMsg}`);
264 - }
265 -}
266 -
158 function watchSrc(
159 onStart: () => void,
160 onComplete: (isSuccess: boolean) => void
compiler/packages/sprout/README.md
+2 -2
@@ -106,5 +106,5 @@ function customHelper(val1, val2) {
106 - [✅] Enable Sprout by default and run it in the Github Actions pipeline.
107 - [🚧] Make all existing test fixtures Sprout compatible (see `SproutTodoFilter.ts`). This involves each fixture being annotated with `FIXTURE_ENTRYPOINT` and using shared functions and/or defining its own helpers.
108 - 77 done, ~410 to go
109 -- [ ] *(optional)* Store Sprout output as snapshot files. i.e. each fixture could have a `fixture.js`, `fixture.snap.md`, and `fixture.sprout.md`.
110 -- [ ] Add support for `fbt`.
109 +- [✅] *(optional)* Store Sprout output as snapshot files. i.e. each fixture could have a `fixture.js`, `fixture.snap.md`, and `fixture.sprout.md`.
110 +- [✅] Add support for `fbt`.
compiler/packages/sprout/src/SproutTodoFilter.ts
+3
@@ -516,6 +516,9 @@ const skipFilter = new Set([
516 "capture-indirect-mutate-alias-iife",
517 "capturing-function-alias-computed-load-3-iife",
518 "capturing-function-alias-computed-load-iife",
519 + "repro-undefined-expression-of-jsxexpressioncontainer",
520 + "repro-hoisting",
521 + "hoisting-nested-block-statements"
522 ]);
523
524 export default skipFilter;
compiler/packages/sprout/src/runner-evaluator.ts
+8 -1
@@ -6,6 +6,7 @@
6 */
7
8 import { render } from "@testing-library/react";
9 +import { PROJECT_ROOT } from "fixture-test-utils";
10 import { JSDOM } from "jsdom";
11 import util from "util";
12 import { z } from "zod";
@@ -105,7 +106,13 @@ export function doEval(source: string): EvaluatorResult {
106 const originalConsole = globalThis.console;
107 const logs: Array<string> = [];
108 const mockedLog = (...args: Array<any>) => {
108 - logs.push(`${args.map((arg) => util.inspect(arg))}`);
109 + // Some hackery: React will use the JS engine to log source location,
110 + // which doesn't play well with snapshot files.
111 + logs.push(
112 + `${args.map((arg) =>
113 + util.inspect(arg).replaceAll(PROJECT_ROOT, "<project_root>")
114 + )}`
115 + );
116 };
117
118 (globalThis.console as any) = {
compiler/packages/sprout/src/runner-worker.ts
+20 -11
@@ -17,9 +17,8 @@ import {
17 parseLanguage,
18 transformFixtureInput,
19 } from "fixture-test-utils";
20 -import fs from "fs/promises";
21 -import path from "path";
20 import { EvaluatorResult, doEval } from "./runner-evaluator";
21 +import path from "path";
22
23 const { runReactForgetBabelPlugin } = require(COMPILER_PATH) as {
24 runReactForgetBabelPlugin: typeof RunReactForgetBabelPlugin;
@@ -29,17 +28,20 @@ const { parseConfigPragma } = require(PARSE_CONFIG_PRAGMA_PATH) as {
28 parseConfigPragma: typeof ParseConfigPragma;
29 };
30
32 -// TODO: save output in .sprout.md files
33 -export type TestResult =
31 +export type SproutFixtureResult =
32 | {
33 nonForgetResult: EvaluatorResult;
34 forgetResult: EvaluatorResult;
35 unexpectedError: null;
36 + snapshot: string | null;
37 + snapshotPath: string;
38 }
39 | {
40 nonForgetResult: null;
41 forgetResult: null;
42 unexpectedError: string;
43 + snapshot: string | null;
44 + snapshotPath: string;
45 };
46
47 type TransformResult =
@@ -206,30 +208,33 @@ function transformFixtureNoForget(
208 }
209 }
210
209 -export async function run(fixture: TestFixture): Promise<TestResult> {
211 +export async function run(fixture: TestFixture): Promise<SproutFixtureResult> {
212 const seenConsoleErrors: Array<string> = [];
213 console.error = (...messages: Array<string>) => {
214 seenConsoleErrors.push(...messages);
215 };
214 - const { inputPath } = fixture;
215 - if (inputPath == null) {
216 + const { input, inputPath, snapshot, snapshotPath } = fixture;
217 + if (input == null) {
218 return {
219 nonForgetResult: null,
220 forgetResult: null,
219 - unexpectedError: "No input for fixture " + fixture.outputPath,
221 + unexpectedError: "No input for fixture " + fixture.snapshotPath,
222 + snapshot,
223 + snapshotPath,
224 };
225 }
222 - const inputRaw = await fs.readFile(inputPath, "utf8");
226 // We need to include the file extension as it determines typescript
227 // babel plugin's mode (e.g. stripping types, parsing rules for brackets)
228 const filename = path.basename(inputPath);
226 - const forgetCode = transformFixtureForget(inputRaw, filename);
227 - const noForgetCode = transformFixtureNoForget(inputRaw, filename);
229 + const forgetCode = transformFixtureForget(input, filename);
230 + const noForgetCode = transformFixtureNoForget(input, filename);
231 if (forgetCode.type === "UnexpectedError") {
232 return {
233 nonForgetResult: null,
234 forgetResult: null,
235 unexpectedError: forgetCode.value,
236 + snapshot,
237 + snapshotPath,
238 };
239 }
240 if (noForgetCode.type === "UnexpectedError") {
@@ -237,6 +242,8 @@ export async function run(fixture: TestFixture): Promise<TestResult> {
242 nonForgetResult: null,
243 forgetResult: null,
244 unexpectedError: noForgetCode.value,
245 + snapshot,
246 + snapshotPath,
247 };
248 }
249 const nonForgetResult = doEval(noForgetCode.value);
@@ -245,5 +252,7 @@ export async function run(fixture: TestFixture): Promise<TestResult> {
252 nonForgetResult,
253 forgetResult,
254 unexpectedError: null,
255 + snapshot,
256 + snapshotPath,
257 };
258 }
compiler/packages/sprout/src/runner.ts
+91 -132
@@ -5,12 +5,16 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -import chalk from "chalk";
8 import {
9 FILTER_FILENAME,
11 - TestFixture,
10 + TestResult,
11 + UpdateSnapshotKind,
12 getFixtures,
13 + getUpdatedSnapshot,
14 + isExpectError,
15 readTestFilter,
16 + report,
17 + update,
18 } from "fixture-test-utils";
19 import { Worker } from "jest-worker";
20 import process from "process";
@@ -18,6 +22,8 @@ import * as readline from "readline";
22 import yargs from "yargs";
23 import { hideBin } from "yargs/helpers";
24 import SproutTodoFilter from "./SproutTodoFilter";
25 +import { EvaluatorResult } from "./runner-evaluator";
26 +import type { SproutFixtureResult } from "./runner-worker";
27 import * as RunnerWorker from "./runner-worker";
28
29 const WORKER_PATH = require.resolve("./runner-worker");
@@ -38,9 +44,8 @@ process.on("SIGTERM", function () {
44 });
45
46 type RunnerOptions = {
41 - filter: boolean;
47 sync: boolean;
43 - verbose: boolean;
48 + mode: "update" | "filter" | undefined;
49 };
50
51 const opts: RunnerOptions = yargs
@@ -50,15 +55,16 @@ const opts: RunnerOptions = yargs
55 "Run compiler in main thread (instead of using worker threads)."
56 )
57 .default("sync", false)
53 - .boolean("filter")
54 - .describe(
55 - "filter",
56 - `Evaluate fixtures in filter mode ("${FILTER_FILENAME}")\n`
57 - )
58 - .default("filter", false)
59 - .boolean("verbose")
60 - .describe("verbose", "Print all fixture outputs and logs.")
61 - .default("verbose", false)
58 + .option("mode", {
59 + type: "string",
60 + desc:
61 + "Sprout tester modes:\n" +
62 + " [default] - test all test fixtures\n" +
63 + ` filter - test filtered fixtures ("${FILTER_FILENAME}")\n` +
64 + " update - update all test fixtures)\n",
65 + choices: ["update", "filter", undefined],
66 + default: undefined,
67 + })
68 .help("help")
69 .strict()
70 .parseSync(hideBin(process.argv));
@@ -69,103 +75,57 @@ function logsEqual(a: Array<string>, b: Array<string>) {
75 }
76 return a.every((val, idx) => val === b[idx]);
77 }
78 +function stringify(result: EvaluatorResult): string {
79 + return `(kind: ${result.kind}) ${result.value}${
80 + result.logs.length > 0 ? `\nlogs: [${result.logs.toString()}]` : ""
81 + }`;
82 +}
83
73 -function reportResults(
74 - results: Array<[string, RunnerWorker.TestResult]>,
75 - verbose: boolean
76 -): boolean {
77 - const failures: Array<[string, RunnerWorker.TestResult]> = [];
78 -
79 - for (const [fixtureName, result] of results) {
80 - if (result.unexpectedError !== null) {
81 - console.log(
82 - chalk.red.inverse.bold(" FAIL ") + " " + chalk.dim(fixtureName)
83 - );
84 - failures.push([fixtureName, result]);
85 - continue;
86 - }
87 - const { forgetResult, nonForgetResult } = result;
88 - if (
89 - forgetResult.kind === "UnexpectedError" ||
90 - nonForgetResult.kind === "UnexpectedError" ||
91 - forgetResult.kind !== nonForgetResult.kind ||
92 - forgetResult.value !== nonForgetResult.value ||
93 - !logsEqual(forgetResult.logs, nonForgetResult.logs)
94 - ) {
95 - console.log(
96 - chalk.red.inverse.bold(" FAIL ") + " " + chalk.dim(fixtureName)
97 - );
98 - failures.push([fixtureName, result]);
99 - } else {
100 - console.log(
101 - chalk.green.inverse.bold(" PASS ") + " " + chalk.dim(fixtureName)
102 - );
103 - if (verbose) {
104 - console.log(
105 - ` ${forgetResult.kind} ${forgetResult.value} ${
106 - forgetResult.logs.length > 0
107 - ? JSON.stringify(forgetResult.logs, undefined, 2)
108 - : ""
109 - }`
110 - );
111 - }
112 - }
84 +function transformResult(result: SproutFixtureResult): TestResult {
85 + function makeError(description: string, value: string) {
86 + return {
87 + outputPath: result.snapshotPath,
88 + actual: null,
89 + expected: null,
90 + unexpectedError: `${description}\n${value}`,
91 + };
92 }
114 -
115 - if (failures.length !== 0) {
116 - console.log("\n" + chalk.red.bold("Failures:") + "\n");
117 -
118 - for (const [fixtureName, result] of failures) {
119 - console.log(chalk.red.bold("FAIL:") + " " + fixtureName);
120 -
121 - if (result.unexpectedError !== null) {
122 - console.log(
123 - chalk.red("Unexpected error when building fixture:") +
124 - ` ${result.unexpectedError}`
125 - );
126 - continue;
127 - }
128 - const { forgetResult, nonForgetResult } = result;
129 - if (forgetResult.kind === "UnexpectedError") {
130 - console.log(
131 - chalk.red(
132 - "Unexpected error when evaluating Forget-transformed fixture:"
133 - ) + ` ${forgetResult.value}`
134 - );
135 - }
136 - if (nonForgetResult.kind === "UnexpectedError") {
137 - console.log(
138 - chalk.red("Unexpected error when evaluating original fixture:") +
139 - ` ${nonForgetResult.value}`
140 - );
141 - }
142 - const hasUnexpectedError =
143 - forgetResult.kind === "UnexpectedError" ||
144 - nonForgetResult.kind === "UnexpectedError";
145 - if (
146 - !hasUnexpectedError &&
147 - (forgetResult.kind !== nonForgetResult.kind ||
148 - forgetResult.value !== nonForgetResult.value ||
149 - !logsEqual(forgetResult.logs, nonForgetResult.logs))
150 - ) {
151 - console.log(
152 - chalk.red("Difference in forget and non-forget results.") +
153 - `\nExpected result: ${JSON.stringify(
154 - nonForgetResult,
155 - undefined,
156 - 2
157 - )}\nFound: ${JSON.stringify(forgetResult, undefined, 2)}`
158 - );
159 - }
160 - }
93 + if (result.unexpectedError !== null) {
94 + return makeError("UnexpectedError in runner", result.unexpectedError);
95 + }
96 + const { forgetResult, nonForgetResult } = result;
97 + if (forgetResult.kind === "UnexpectedError") {
98 + return makeError("UnexpectedError in Forget runner", forgetResult.value);
99 + } else if (nonForgetResult.kind === "UnexpectedError") {
100 + return makeError(
101 + "UnexpectedError in non-forget runner",
102 + nonForgetResult.value
103 + );
104 + } else if (
105 + forgetResult.kind !== nonForgetResult.kind ||
106 + forgetResult.value !== nonForgetResult.value ||
107 + !logsEqual(forgetResult.logs, nonForgetResult.logs)
108 + ) {
109 + return makeError(
110 + "Found differences in evaluator results",
111 + `Non-forget (expected):
112 +${stringify(nonForgetResult)}
113 +Forget:
114 +${stringify(forgetResult)}
115 +`
116 + );
117 + } else {
118 + return {
119 + outputPath: result.snapshotPath,
120 + expected: result.snapshot,
121 + actual: getUpdatedSnapshot(
122 + result.snapshot,
123 + stringify(forgetResult),
124 + UpdateSnapshotKind.Sprout
125 + ),
126 + unexpectedError: null,
127 + };
128 }
162 -
163 - console.log(
164 - `${results.length} Tests, ${results.length - failures.length} Passed, ${
165 - failures.length
166 - } Failed`
167 - );
168 - return failures.length === 0;
129 }
130
131 /**
@@ -178,44 +138,43 @@ export async function main(opts: RunnerOptions): Promise<void> {
138 worker.getStderr().pipe(process.stderr);
139 worker.getStdout().pipe(process.stdout);
140
181 - const testFilter = opts.filter ? await readTestFilter() : null;
182 - let allFixtures: Map<string, TestFixture> = getFixtures(testFilter);
141 + const testFilter = opts.mode === "filter" ? await readTestFilter() : null;
142 + const allFixtures = await getFixtures(testFilter);
143
184 - allFixtures = new Map(
185 - Array.from(allFixtures.entries()).filter(
186 - ([filename, _]) => !SproutTodoFilter.has(filename)
187 - )
144 + const validFixtures = new Map(
145 + Array.from(allFixtures.entries()).filter(([fixtureName, fixture]) => {
146 + return !SproutTodoFilter.has(fixtureName) && !isExpectError(fixture);
147 + })
148 );
189 -
190 - const validFixtures = new Map();
191 - for (const [name, fixture] of allFixtures) {
192 - if (
193 - fixture.basename.startsWith("error.") ||
194 - fixture.basename.startsWith("todo.error.")
195 - ) {
196 - // skip
197 - continue;
198 - }
199 - validFixtures.set(name, fixture);
200 - }
201 -
202 - const results: Array<[string, RunnerWorker.TestResult]> = [];
149 + const sproutResults: Array<[string, SproutFixtureResult]> = [];
150 if (!opts.sync) {
204 - const work: Array<Promise<[string, RunnerWorker.TestResult]>> = [];
151 + const work: Array<Promise<[string, SproutFixtureResult]>> = [];
152 for (const [fixtureName, fixture] of validFixtures) {
153 work.push(worker.run(fixture).then((result) => [fixtureName, result]));
154 }
208 - results.push(...(await Promise.all(work)));
155 + sproutResults.push(...(await Promise.all(work)));
156 } else {
157 for (const [fixtureName, fixture] of validFixtures) {
211 - const result: [string, RunnerWorker.TestResult] = await RunnerWorker.run(
158 + const result: [string, SproutFixtureResult] = await RunnerWorker.run(
159 fixture
160 ).then((result) => [fixtureName, result]);
214 - results.push(result);
161 + sproutResults.push(result);
162 }
163 }
164
218 - const isSuccess = reportResults(results, opts.verbose);
165 + const results = new Map(
166 + sproutResults.map(([fixtureName, result]) => [
167 + fixtureName,
168 + transformResult(result),
169 + ])
170 + );
171 + let isSuccess;
172 + if (opts.mode === "update") {
173 + isSuccess = true;
174 + update(results);
175 + } else {
176 + isSuccess = report(results);
177 + }
178 /**
179 * This is important, as we're using jsdom (which seems to be attaching some
180 * tasks that require force exiting. If we do not await workers terminating,