From d76f76eec79655781bb5034bc405af1547ee4ca7 Mon Sep 17 00:00:00 2001
From: JerryWu <409187100@qq.com>
Date: Sat, 21 Dec 2024 13:16:11 +0800
Subject: [PATCH 1/3] bug: add a test for a bug
---
package.json | 2 +-
.../qwik/src/core/tests/use-task.spec.tsx | 52 ++++++++++++++++++-
2 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 4e73df42aa1..3693932ce61 100644
--- a/package.json
+++ b/package.json
@@ -235,7 +235,7 @@
"tsc.trace": "tsc -p tsconfig.json --traceResolution > tsc.log",
"tsc.watch": "tsc --noEmit --watch --preserveWatchOutput",
"update.qwik.builds": "tsx --require ./scripts/runBefore.ts scripts/update-qwik-builds.ts packages/docs && tsx scripts/update-qwik-builds.ts packages/insights; pnpm install",
- "vitest": "vitest"
+ "vitest": "vitest run use-task.spec.tsx"
},
"simple-git-hooks": {
"pre-commit": "pnpm pretty-quick --staged"
diff --git a/packages/qwik/src/core/tests/use-task.spec.tsx b/packages/qwik/src/core/tests/use-task.spec.tsx
index 891f06f8f93..f5625b01a2e 100644
--- a/packages/qwik/src/core/tests/use-task.spec.tsx
+++ b/packages/qwik/src/core/tests/use-task.spec.tsx
@@ -14,11 +14,11 @@ import { ErrorProvider } from '../../testing/rendering.unit-util';
import { delay } from '../shared/utils/promises';
import { WrappedSignal } from '../signal/signal';
-const debug = false; //true;
+const debug = true; //true;
Error.stackTraceLimit = 100;
describe.each([
- { render: ssrRenderToDom }, //
+ // { render: ssrRenderToDom }, //
{ render: domRender }, //
])('$render.name: useTask', ({ render }) => {
it('should execute task', async () => {
@@ -771,5 +771,53 @@ describe.each([
);
});
+
+ it.only('#7134', async () => {
+ const Input = component$<{ error: string }>((props) => {
+ const count = useSignal(0);
+ useTask$(({ track }) => {
+ track(() => props.error);
+ count.value++;
+ });
+ return <>{count.value}>;
+ });
+
+ const Parent = component$(() => {
+ const [store] = [useStore<{ errors: { test?: string } }>({ errors: {} })];
+ return (
+
+
+
+
+ );
+ });
+ const { vNode, document } = await render(, { debug });
+ await trigger(document.body, 'button', 'click');
+ await trigger(document.body, 'button', 'click');
+ expect(vNode).toMatchVDOM(
+
+
+
+
+
+
+ 2
+
+
+
+
+
+ );
+ });
});
});
From 9f764c063da465aa591f65b320e18ba9dd9c71b4 Mon Sep 17 00:00:00 2001
From: JerryWu <409187100@qq.com>
Date: Sat, 21 Dec 2024 13:17:47 +0800
Subject: [PATCH 2/3] fix
---
package.json | 2 +-
packages/qwik/src/core/tests/use-task.spec.tsx | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 3693932ce61..4e73df42aa1 100644
--- a/package.json
+++ b/package.json
@@ -235,7 +235,7 @@
"tsc.trace": "tsc -p tsconfig.json --traceResolution > tsc.log",
"tsc.watch": "tsc --noEmit --watch --preserveWatchOutput",
"update.qwik.builds": "tsx --require ./scripts/runBefore.ts scripts/update-qwik-builds.ts packages/docs && tsx scripts/update-qwik-builds.ts packages/insights; pnpm install",
- "vitest": "vitest run use-task.spec.tsx"
+ "vitest": "vitest"
},
"simple-git-hooks": {
"pre-commit": "pnpm pretty-quick --staged"
diff --git a/packages/qwik/src/core/tests/use-task.spec.tsx b/packages/qwik/src/core/tests/use-task.spec.tsx
index f5625b01a2e..3430546dec3 100644
--- a/packages/qwik/src/core/tests/use-task.spec.tsx
+++ b/packages/qwik/src/core/tests/use-task.spec.tsx
@@ -14,11 +14,11 @@ import { ErrorProvider } from '../../testing/rendering.unit-util';
import { delay } from '../shared/utils/promises';
import { WrappedSignal } from '../signal/signal';
-const debug = true; //true;
+const debug = false; //true;
Error.stackTraceLimit = 100;
describe.each([
- // { render: ssrRenderToDom }, //
+ { render: ssrRenderToDom }, //
{ render: domRender }, //
])('$render.name: useTask', ({ render }) => {
it('should execute task', async () => {
From 0342980928069c95369f356585528ff92aa4f90c Mon Sep 17 00:00:00 2001
From: JerryWu <409187100@qq.com>
Date: Sat, 21 Dec 2024 13:18:19 +0800
Subject: [PATCH 3/3] fix
---
packages/qwik/src/core/tests/use-task.spec.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/qwik/src/core/tests/use-task.spec.tsx b/packages/qwik/src/core/tests/use-task.spec.tsx
index 3430546dec3..16e11226526 100644
--- a/packages/qwik/src/core/tests/use-task.spec.tsx
+++ b/packages/qwik/src/core/tests/use-task.spec.tsx
@@ -772,7 +772,7 @@ describe.each([
);
});
- it.only('#7134', async () => {
+ it.skip('#7134', async () => {
const Input = component$<{ error: string }>((props) => {
const count = useSignal(0);
useTask$(({ track }) => {