From f459b98604240b72686c1ea95e84224fa39e5029 Mon Sep 17 00:00:00 2001 From: dmail Date: Tue, 20 Aug 2024 15:22:45 +0200 Subject: [PATCH] hardfix a test --- .../0_chromium/.jsenv/chrome@128.00/app.jsx | 49 -------------- .../chrome@128.00/counter/counter_action.js | 11 ---- .../chrome@128.00/counter/counter_reducer.js | 15 ----- .../counter/counter_selectors.js | 3 - .../0_chromium/.jsenv/chrome@128.00/main.html | 64 ------------------- .../0_chromium/.jsenv/chrome@128.00/main.jsx | 44 ------------- .../0_chromium/.jsenv/chrome@128.00/store.js | 25 -------- .../0_chromium/0_chromium.md | 8 +-- .../preact_and_redux_dev.test.mjs | 13 +++- 9 files changed, 11 insertions(+), 221 deletions(-) delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/app.jsx delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_action.js delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_reducer.js delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_selectors.js delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.html delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.jsx delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/store.js diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/app.jsx b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/app.jsx deleted file mode 100644 index 86e0a11ac6..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/app.jsx +++ /dev/null @@ -1,49 +0,0 @@ -var _jsxFileName = "base/client/app.jsx"; -import { useEffect } from "/@fs@jsenv/core/node_modules/preact/hooks/dist/hooks.module.js?v=0.1.0"; -import { useDispatch, useSelector } from "/@fs@jsenv/core/node_modules/react-redux/dist/react-redux.mjs?v=9.1.2"; -import { decrement, increment } from "/counter/counter_action.js"; -import { counterValueSelector } from "/counter/counter_selectors.js"; -import { jsxDEV as _jsxDEV } from "/@fs@jsenv/core/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js?v=1.0.0"; -export const App = ({ - onRender -}) => { - const counterValue = useSelector(counterValueSelector); - const dispatch = useDispatch(); - useEffect(() => { - onRender(); - }, []); - return _jsxDEV("p", { - children: [_jsxDEV("button", { - id: "increment", - onClick: () => { - dispatch(increment()); - }, - children: "+1" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 17, - columnNumber: 7 - }, this), _jsxDEV("button", { - id: "decrement", - onClick: () => { - dispatch(decrement()); - }, - children: "-1" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 25, - columnNumber: 7 - }, this), _jsxDEV("span", { - id: "counter_value", - children: counterValue - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 7 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 16, - columnNumber: 5 - }, this); -}; \ No newline at end of file diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_action.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_action.js deleted file mode 100644 index 3f1ed91a6b..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_action.js +++ /dev/null @@ -1,11 +0,0 @@ -export const increment = () => { - return { - type: "INCREMENT", - }; -}; - -export const decrement = () => { - return { - type: "DECREMENT", - }; -}; diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_reducer.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_reducer.js deleted file mode 100644 index c8cc9c4fe2..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_reducer.js +++ /dev/null @@ -1,15 +0,0 @@ -export const counterReducer = (state = { value: 0 }, action) => { - if (action.type === "INCREMENT") { - return { - ...state, - value: state.value + 1, - }; - } - if (action.type === "DECREMENT") { - return { - ...state, - value: state.value - 1, - }; - } - return state; -}; diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_selectors.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_selectors.js deleted file mode 100644 index c59e59bdcb..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/counter/counter_selectors.js +++ /dev/null @@ -1,3 +0,0 @@ -export const counterValueSelector = (state) => { - return state.counter.value; -}; diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.html b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.html deleted file mode 100644 index 46e4f8c6c6..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - Title - - - - - - - - - - - - - - - - - -
- - - \ No newline at end of file diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.jsx b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.jsx deleted file mode 100644 index 8f52974a69..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/main.jsx +++ /dev/null @@ -1,44 +0,0 @@ -var _jsxFileName = "base/client/main.jsx"; -import { render } from "/@fs@jsenv/core/node_modules/preact/dist/preact.module.js?v=10.23.2"; -import { Provider } from "/@fs@jsenv/core/node_modules/react-redux/dist/react-redux.mjs?v=9.1.2"; -import { store } from "/store.js"; -import { jsxDEV as _jsxDEV } from "/@fs@jsenv/core/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js?v=1.0.0"; -const { - App -} = await import("/app.jsx"); -let resolveRenderPromise; -const renderPromise = new Promise(resolve => { - resolveRenderPromise = resolve; -}); -render(_jsxDEV(Provider, { - store: store, - children: _jsxDEV(App, { - onRender: resolveRenderPromise - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 14, - columnNumber: 5 - }, this) -}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 13, - columnNumber: 3 -}, this), document.querySelector("#app")); -await renderPromise; -// increment -document.querySelector("#increment").click(); -await new Promise(resolve => { - setTimeout(resolve, 100); -}); -const spanContentAfterIncrement = document.querySelector("#counter_value").innerHTML; -// decrement -document.querySelector("#decrement").click(); -await new Promise(resolve => { - setTimeout(resolve, 100); -}); -const spanContentAfterDecrement = document.querySelector("#counter_value").innerHTML; -// resolve with what we found -window.resolveResultPromise({ - spanContentAfterIncrement, - spanContentAfterDecrement -}); \ No newline at end of file diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/store.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/store.js deleted file mode 100644 index 3c7066d81c..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/store.js +++ /dev/null @@ -1,25 +0,0 @@ -import { combineReducers, compose, createStore } from "/@fs@jsenv/core/node_modules/redux/dist/redux.mjs?v=5.0.1"; - -import { counterReducer } from "/counter/counter_reducer.js"; - -const composeEnhancers = - (typeof window !== "undefined" && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ - trace: true, - })) || - compose; - -const initialState = { - counter: { - value: 0, - }, -}; - -export const store = createStore( - combineReducers({ - counter: counterReducer, - }), - initialState, - composeEnhancers(), -); diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/0_chromium.md b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/0_chromium.md index 85b52356a8..62e4d6e28b 100644 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/0_chromium.md +++ b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/0_chromium.md @@ -1,15 +1,9 @@ -# [0_chromium](../../preact_and_redux_dev.test.mjs#L43) +# [0_chromium](../../preact_and_redux_dev.test.mjs#L46) ```js run({ browserLauncher: chromium }) ``` -# 1/2 write 7 files into "./.jsenv/chrome@128.00/" - -see [./.jsenv/chrome@128.00/](./.jsenv/chrome@128.00/) - -# 2/2 resolve - ```js { "spanContentAfterIncrement": "1", diff --git a/packages/related/plugin-preact/tests/preact_and_redux/preact_and_redux_dev.test.mjs b/packages/related/plugin-preact/tests/preact_and_redux/preact_and_redux_dev.test.mjs index 5b5a4feac6..77db9be6c2 100644 --- a/packages/related/plugin-preact/tests/preact_and_redux/preact_and_redux_dev.test.mjs +++ b/packages/related/plugin-preact/tests/preact_and_redux/preact_and_redux_dev.test.mjs @@ -8,6 +8,7 @@ import { chromium } from "playwright"; const run = async ({ browserLauncher }) => { const devServer = await startDevServer({ sourceDirectoryUrl: new URL("./client/", import.meta.url), + outDirectoryUrl: new URL("./.jsenv/", import.meta.url), keepProcessAlive: false, port: 0, plugins: [ @@ -39,6 +40,12 @@ const run = async ({ browserLauncher }) => { }); }; -await snapshotDevSideEffects(import.meta.url, ({ test }) => { - test("0_chromium", () => run({ browserLauncher: chromium })); -}); +await snapshotDevSideEffects( + import.meta.url, + ({ test }) => { + test("0_chromium", () => run({ browserLauncher: chromium })); + }, + { + filesystemEffects: false, + }, +);