mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[tests] bug repros
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
import { invoke } from "shared-runtime";
|
||||
|
||||
function useFoo() {
|
||||
const x = {};
|
||||
const result = invoke(() => x);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: useFoo,
|
||||
params: [],
|
||||
isComponent: false,
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] Invariant: Expected value for identifier `16` to be initialized. (5:5)
|
||||
```
|
||||
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { invoke } from "shared-runtime";
|
||||
|
||||
function useFoo() {
|
||||
const x = {};
|
||||
const result = invoke(() => x);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: useFoo,
|
||||
params: [],
|
||||
isComponent: false,
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Foo() {
|
||||
return {
|
||||
"a.b": 1,
|
||||
"a\b": 2,
|
||||
"a/b": 3,
|
||||
"a+b": 4,
|
||||
"a b": 5,
|
||||
};
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [],
|
||||
isComponent: false,
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
Unexpected token, expected "," (2:13)
|
||||
1 | import { unstable_useMemoCache as useMemoCache } from "react";function Foo() {const $ = useMemoCache(1);let t0;if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
> 2 | t0 = { a.b: 1, a: 2, a/b: 3, a+b: 4, a b: 5 };$[0] = t0;} else {t0 = $[0];}return t0;}
|
||||
| ^
|
||||
3 |
|
||||
4 |
|
||||
5 |
|
||||
```
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
function Foo() {
|
||||
return {
|
||||
"a.b": 1,
|
||||
"a\b": 2,
|
||||
"a/b": 3,
|
||||
"a+b": 4,
|
||||
"a b": 5,
|
||||
};
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [],
|
||||
isComponent: false,
|
||||
};
|
||||
@@ -88,6 +88,7 @@ export async function compile(
|
||||
runReactForgetBabelPlugin
|
||||
).code;
|
||||
} catch (e) {
|
||||
e.message = e.message.replace(/\u001b[^m]*m/g, '');
|
||||
error = e;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user