From 7ba638ef8d7941abc5aaf4a79bea319dadf424c0 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Wed, 17 May 2023 14:39:28 -0400 Subject: [PATCH] [tests] delete stale .expect files --- Looks like we delete `.js` files but missed `.expect` files. Jest probably didn't catch this because the basename of the fixtures had duplicates (in rule-of-hooks) --- ....invalid-hook-after-early-return.expect.md | 21 --------------- .../compiler/error.invalid-hook-for.expect.md | 26 ------------------- .../error.invalid-hook-if-alternate.expect.md | 23 ---------------- ...error.invalid-hook-if-consequent.expect.md | 22 ---------------- 4 files changed, 92 deletions(-) delete mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-after-early-return.expect.md delete mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-for.expect.md delete mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-alternate.expect.md delete mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-consequent.expect.md diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-after-early-return.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-after-early-return.expect.md deleted file mode 100644 index f8146c8510..0000000000 --- a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-after-early-return.expect.md +++ /dev/null @@ -1,21 +0,0 @@ - -## Input - -```javascript -function Component(props) { - if (props.cond) { - return null; - } - return useHook(); -} - -``` - - -## Error - -``` -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5) -``` - - \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-for.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-for.expect.md deleted file mode 100644 index a9acc25430..0000000000 --- a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-for.expect.md +++ /dev/null @@ -1,26 +0,0 @@ - -## Input - -```javascript -function Component(props) { - let i = 0; - for (let x = 0; useHook(x) < 10; useHook(i), x++) { - i += useHook(x); - } - return i; -} - -``` - - -## Error - -``` -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3) - -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4) - -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (3:3) -``` - - \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-alternate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-alternate.expect.md deleted file mode 100644 index 51c2925634..0000000000 --- a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-alternate.expect.md +++ /dev/null @@ -1,23 +0,0 @@ - -## Input - -```javascript -function Component(props) { - let x = null; - if (props.cond) { - } else { - x = useHook(); - } - return x; -} - -``` - - -## Error - -``` -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (5:5) -``` - - \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-consequent.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-consequent.expect.md deleted file mode 100644 index d21db9859d..0000000000 --- a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-hook-if-consequent.expect.md +++ /dev/null @@ -1,22 +0,0 @@ - -## Input - -```javascript -function Component(props) { - let x = null; - if (props.cond) { - x = useHook(); - } - return x; -} - -``` - - -## Error - -``` -[ReactForget] InvalidInput: Hooks must always be called in a consistent order, and may not be called conditionally. See the Rules of Hooks (https://react.dev/warnings/invalid-hook-call-warning) (4:4) -``` - - \ No newline at end of file