Add test for bailouts skipping compilation
Sathya Gunasekaran committed
Nov 9, 2023 at 12:00 UTC
bd3661020e325378efd0bd2fe3e391ded9923ce0
4 files changed
+101
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.expect.md
new
+39
@@ -0,0 +1,39 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+// @gating @panicThreshold(NONE) @compilationMode(annotation)
6
+let someGlobal = "joe";
7
+
8
+function Component() {
9
+ "use forget";
10
+ someGlobal = "wat";
11
+ return null;
12
+}
13
+
14
+export const FIXTURE_ENTRYPOINT = {
15
+ fn: Component,
16
+ params: [],
17
+};
18
+
19
+```
20
+
21
+## Code
22
+
23
+```javascript
24
+// @gating @panicThreshold(NONE) @compilationMode(annotation)
25
+let someGlobal = "joe";
26
+
27
+function Component() {
28
+ "use forget";
29
+ someGlobal = "wat";
30
+ return null;
31
+}
32
+
33
+export const FIXTURE_ENTRYPOINT = {
34
+ fn: Component,
35
+ params: [],
36
+};
37
+
38
+```
39
+
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-annotation-mode.js
new
+13
@@ -0,0 +1,13 @@
1
+// @gating @panicThreshold(NONE) @compilationMode(annotation)
2
+let someGlobal = "joe";
3
+
4
+function Component() {
5
+ "use forget";
6
+ someGlobal = "wat";
7
+ return null;
8
+}
9
+
10
+export const FIXTURE_ENTRYPOINT = {
11
+ fn: Component,
12
+ params: [],
13
+};
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.expect.md
new
+37
@@ -0,0 +1,37 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+// @gating @panicThreshold(NONE) @compilationMode(infer)
6
+let someGlobal = "joe";
7
+
8
+function Component() {
9
+ someGlobal = "wat";
10
+ return <div>{someGlobal}</div>;
11
+}
12
+
13
+export const FIXTURE_ENTRYPOINT = {
14
+ fn: Component,
15
+ params: [],
16
+};
17
+
18
+```
19
+
20
+## Code
21
+
22
+```javascript
23
+// @gating @panicThreshold(NONE) @compilationMode(infer)
24
+let someGlobal = "joe";
25
+
26
+function Component() {
27
+ someGlobal = "wat";
28
+ return <div>{someGlobal}</div>;
29
+}
30
+
31
+export const FIXTURE_ENTRYPOINT = {
32
+ fn: Component,
33
+ params: [],
34
+};
35
+
36
+```
37
+
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/should-bailout-without-compilation-infer-mode.js
new
+12
@@ -0,0 +1,12 @@
1
+// @gating @panicThreshold(NONE) @compilationMode(infer)
2
+let someGlobal = "joe";
3
+
4
+function Component() {
5
+ someGlobal = "wat";
6
+ return <div>{someGlobal}</div>;
7
+}
8
+
9
+export const FIXTURE_ENTRYPOINT = {
10
+ fn: Component,
11
+ params: [],
12
+};