From b9a607e8e17087d8dee3456e25b7be48c7b78196 Mon Sep 17 00:00:00 2001 From: dmail Date: Tue, 20 Aug 2024 15:08:05 +0200 Subject: [PATCH] update test side effects --- .../cjs_to_esm/__compile_context__.json | 3 - .../0_chromium/0_chromium.md | 4 +- ...xternal-store-with-selector.development.js | 164 ------------------ .../use-sync-external-store/with-selector.js | 7 - .../src/execution/reporters/reporter_list.js | 46 +++-- .../timings/timings_browsers.test.mjs | 6 +- .../_fragment.test.mjs/23/output/2_3.svg | 3 +- 7 files changed, 35 insertions(+), 198 deletions(-) delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/cjs_to_esm/__compile_context__.json delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js delete mode 100644 packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/with-selector.js diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/cjs_to_esm/__compile_context__.json b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/cjs_to_esm/__compile_context__.json deleted file mode 100644 index 358606d778..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/.jsenv/chrome@128.00/cjs_to_esm/__compile_context__.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "2.8.17" -} \ 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/0_chromium.md b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/0_chromium.md index 15ccd30bbe..85b52356a8 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 @@ -4,9 +4,9 @@ run({ browserLauncher: chromium }) ``` -# 1/2 write 10 files into "../../../../../" +# 1/2 write 7 files into "./.jsenv/chrome@128.00/" -see [./@jsenv/core/](./@jsenv/core/) +see [./.jsenv/chrome@128.00/](./.jsenv/chrome@128.00/) # 2/2 resolve diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js deleted file mode 100644 index eacc4beed4..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +++ /dev/null @@ -1,164 +0,0 @@ -/** - * @license React - * use-sync-external-store-with-selector.development.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { - - 'use strict'; - -/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ -if ( - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === - 'function' -) { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); -} - var React = require('react'); - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; -} - -var objectIs = typeof Object.is === 'function' ? Object.is : is; - -var useSyncExternalStore = React.useSyncExternalStore; - -// for CommonJS interop. - -var useRef = React.useRef, - useEffect = React.useEffect, - useMemo = React.useMemo, - useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments. - -function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { - // Use this to track the rendered snapshot. - var instRef = useRef(null); - var inst; - - if (instRef.current === null) { - inst = { - hasValue: false, - value: null - }; - instRef.current = inst; - } else { - inst = instRef.current; - } - - var _useMemo = useMemo(function () { - // Track the memoized state using closure variables that are local to this - // memoized instance of a getSnapshot function. Intentionally not using a - // useRef hook, because that state would be shared across all concurrent - // copies of the hook/component. - var hasMemo = false; - var memoizedSnapshot; - var memoizedSelection; - - var memoizedSelector = function (nextSnapshot) { - if (!hasMemo) { - // The first time the hook is called, there is no memoized result. - hasMemo = true; - memoizedSnapshot = nextSnapshot; - - var _nextSelection = selector(nextSnapshot); - - if (isEqual !== undefined) { - // Even if the selector has changed, the currently rendered selection - // may be equal to the new selection. We should attempt to reuse the - // current value if possible, to preserve downstream memoizations. - if (inst.hasValue) { - var currentSelection = inst.value; - - if (isEqual(currentSelection, _nextSelection)) { - memoizedSelection = currentSelection; - return currentSelection; - } - } - } - - memoizedSelection = _nextSelection; - return _nextSelection; - } // We may be able to reuse the previous invocation's result. - - - // We may be able to reuse the previous invocation's result. - var prevSnapshot = memoizedSnapshot; - var prevSelection = memoizedSelection; - - if (objectIs(prevSnapshot, nextSnapshot)) { - // The snapshot is the same as last time. Reuse the previous selection. - return prevSelection; - } // The snapshot has changed, so we need to compute a new selection. - - - // The snapshot has changed, so we need to compute a new selection. - var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data - // has changed. If it hasn't, return the previous selection. That signals - // to React that the selections are conceptually equal, and we can bail - // out of rendering. - - // If a custom isEqual function is provided, use that to check if the data - // has changed. If it hasn't, return the previous selection. That signals - // to React that the selections are conceptually equal, and we can bail - // out of rendering. - if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) { - return prevSelection; - } - - memoizedSnapshot = nextSnapshot; - memoizedSelection = nextSelection; - return nextSelection; - }; // Assigning this to a constant so that Flow knows it can't change. - - - // Assigning this to a constant so that Flow knows it can't change. - var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot; - - var getSnapshotWithSelector = function () { - return memoizedSelector(getSnapshot()); - }; - - var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () { - return memoizedSelector(maybeGetServerSnapshot()); - }; - return [getSnapshotWithSelector, getServerSnapshotWithSelector]; - }, [getSnapshot, getServerSnapshot, selector, isEqual]), - getSelection = _useMemo[0], - getServerSelection = _useMemo[1]; - - var value = useSyncExternalStore(subscribe, getSelection, getServerSelection); - useEffect(function () { - inst.hasValue = true; - inst.value = value; - }, [value]); - useDebugValue(value); - return value; -} - -exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; - /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ -if ( - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === - 'function' -) { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); -} - - })(); -} diff --git a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/with-selector.js b/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/with-selector.js deleted file mode 100644 index 9163b3e7e1..0000000000 --- a/packages/related/plugin-preact/tests/preact_and_redux/_preact_and_redux_dev.test.mjs/0_chromium/@jsenv/core/node_modules/use-sync-external-store/with-selector.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/use-sync-external-store-with-selector.production.min.js'); -} else { - module.exports = require('./cjs/use-sync-external-store-with-selector.development.js'); -} diff --git a/packages/related/test/src/execution/reporters/reporter_list.js b/packages/related/test/src/execution/reporters/reporter_list.js index 7691772187..9f72308866 100644 --- a/packages/related/test/src/execution/reporters/reporter_list.js +++ b/packages/related/test/src/execution/reporters/reporter_list.js @@ -263,9 +263,20 @@ const createApplyColorOnFileRelativeUrl = (rootDirectoryUrl) => { // all the things before in grey // all the things after in the color const before = parts.slice(0, i).join("/"); - const after = parts.slice(i).join("/"); - let pathColored = ANSI.color(`${before}/`, ANSI.GREY); - pathColored += ANSI.color(`${after}/${filename}`, color); + const packageDirectory = parts[i]; + const packageDirectoryStylized = ANSI.color( + ANSI.effect(packageDirectory, ANSI.UNDERLINE), + color, + ); + let pathColored = ANSI.color(`${before}/`, color); + if (i === parts.length - 1) { + pathColored += packageDirectoryStylized; + pathColored += ANSI.color(`/${filename}`, color); + return pathColored; + } + const after = parts.slice(i + 1).join("/"); + pathColored += packageDirectoryStylized; + pathColored += ANSI.color(`/${after}/${filename}`, color); return pathColored; } i++; @@ -491,9 +502,12 @@ const descriptionFormatters = { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); let skipped = ANSI.color( - `${UNICODE.CIRCLE_DOTTED_RAW} ${number}/${total} skipped`, + `${UNICODE.CIRCLE_DOTTED_RAW} ${number}`, COLOR_SKIPPED, ); + skipped += ANSI.color(`/${total}`, COLOR_SKIPPED); + skipped += " "; + skipped += ANSI.color("skipped", COLOR_SKIPPED); skipped += " "; skipped += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_SKIPPED); if (skipReason) { @@ -508,10 +522,8 @@ const descriptionFormatters = { ) => { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); - let aborted = ANSI.color( - `${UNICODE.FAILURE_RAW} ${number}/${total}`, - COLOR_ABORTED, - ); + let aborted = ANSI.color(`${UNICODE.FAILURE_RAW} ${number}`, COLOR_ABORTED); + aborted += ANSI.color(`/${total}`, COLOR_ABORTED); aborted += " "; aborted += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_ABORTED); return aborted; @@ -523,9 +535,10 @@ const descriptionFormatters = { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); let cancelled = ANSI.color( - `${UNICODE.FAILURE_RAW} ${number}/${total}`, + `${UNICODE.FAILURE_RAW} ${number}`, COLOR_CANCELLED, ); + cancelled += ANSI.color(`/${total}`, COLOR_CANCELLED); cancelled += " "; cancelled += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_CANCELLED); return cancelled; @@ -537,9 +550,10 @@ const descriptionFormatters = { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); let timedout = ANSI.color( - `${UNICODE.FAILURE_RAW} ${number}/${total}`, + `${UNICODE.FAILURE_RAW} ${number}`, COLOR_TIMEOUT, ); + timedout += ANSI.color(`/${total}`, COLOR_TIMEOUT); timedout += " "; timedout += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_TIMEOUT); timedout += " "; @@ -555,10 +569,8 @@ const descriptionFormatters = { ) => { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); - let failed = ANSI.color( - `${UNICODE.FAILURE_RAW} ${number}/${total}`, - COLOR_FAILED, - ); + let failed = ANSI.color(`${UNICODE.FAILURE_RAW} ${number}`, COLOR_FAILED); + failed += ANSI.color(`/${total}`, COLOR_FAILED); failed += " "; failed += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_FAILED); return failed; @@ -569,10 +581,8 @@ const descriptionFormatters = { ) => { const total = countersInOrder.planified; const number = fillLeft(index + 1, total, "0"); - let completed = ANSI.color( - `${UNICODE.OK_RAW} ${number}/${total}`, - COLOR_COMPLETED, - ); + let completed = ANSI.color(`${UNICODE.OK_RAW} ${number}`, COLOR_COMPLETED); + completed += ANSI.color(`/${total}`, COLOR_COMPLETED); completed += " "; completed += applyColorOnFileRelativeUrl(fileRelativeUrl, COLOR_COMPLETED); return completed; diff --git a/packages/related/test/tests/execution/timings/timings_browsers.test.mjs b/packages/related/test/tests/execution/timings/timings_browsers.test.mjs index 100623ee8e..dab6d9c069 100644 --- a/packages/related/test/tests/execution/timings/timings_browsers.test.mjs +++ b/packages/related/test/tests/execution/timings/timings_browsers.test.mjs @@ -48,9 +48,9 @@ const test = async (params) => { const expect = { // execution must take around 2s (due to the timeout) executionDuration: assert.between(2_000, 6_000), - // the overall run duration and runtime alive duration is between 2/20s - runDuration: assert.between(2_000, 20_000), - runtimeDuration: assert.between(2_000, 20_000), + // the overall run duration and runtime alive duration is between 2/30s + runDuration: assert.between(2_000, 30_000), + runtimeDuration: assert.between(2_000, 30_000), // it does not take more than 2s to start the file timeBetweenRuntimeStartAndExecutionStart: assert.between(0, 2_000), }; diff --git a/packages/related/test/tests/test_plan_execution/fragment/_fragment.test.mjs/23/output/2_3.svg b/packages/related/test/tests/test_plan_execution/fragment/_fragment.test.mjs/23/output/2_3.svg index 8b978d4f17..667de98e21 100644 --- a/packages/related/test/tests/test_plan_execution/fragment/_fragment.test.mjs/23/output/2_3.svg +++ b/packages/related/test/tests/test_plan_execution/fragment/_fragment.test.mjs/23/output/2_3.svg @@ -38,7 +38,8 @@ , 2 skipped ) - ◌ 5/5 skipped + ◌ 5/5 + skipped e.spec.js (2 completed