Page MenuHomePhabricator

[Cashtab] Finalize webpack upgrade
ClosedPublic

Authored by bytesofman on Mar 28 2022, 21:21.

Details

Reviewers
kieran709
Group Reviewers
Restricted Project
Commits
rABCd2cc398537a8: [Cashtab] Finalize webpack upgrade
Summary

T1682

Diff seems enormous with a lot of changes. However, here is what's going on.

  • Deleted web/cashtab
  • Renamed web/cashtab-v2 to web/cashtab
  • Replaced all instances of cashtab-v2 with cashtab
  • Updated CONTRIBUTING.md to reflect latest dependencies for working on the cashtab repo
Test Plan
  1. Confirm no missed strings of cashtab-v2
cd web/cashtab
rm -rf node_modules
npm ci
grep -r 'cashtab-v2' .

Should see no output

  1. Confirm no broken features

npm start and test all Cashtab features

Diff Detail

Repository
rABC Bitcoin ABC
Branch
webpack-migration-final
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18663
Build 37117: Build Diffcashtab-tests
Build 37116: arc lint + arc unit

Event Timeline

Tail of the build log:

Failed to parse source map from '/work/web/cashtab/node_modules/etoken-list/dist/index.js.map' file: Error: ENOENT: no such file or directory, open '/work/web/cashtab/node_modules/etoken-list/dist/index.js.map'

Failed to parse source map from '/work/web/cashtab/node_modules/etoken-list/dist/list.js.map' file: Error: ENOENT: no such file or directory, open '/work/web/cashtab/node_modules/etoken-list/dist/list.js.map'

Failed to parse source map from '/work/web/cashtab/node_modules/etoken-list/dist/nft1.js.map' file: Error: ENOENT: no such file or directory, open '/work/web/cashtab/node_modules/etoken-list/dist/nft1.js.map'

Failed to parse source map from '/work/web/cashtab/node_modules/etoken-list/dist/utils.js.map' file: Error: ENOENT: no such file or directory, open '/work/web/cashtab/node_modules/etoken-list/dist/utils.js.map'

Failed to parse source map from '/work/web/cashtab/node_modules/react-image/umd/index.js.map' file: Error: ENOENT: no such file or directory, open '/work/web/cashtab/node_modules/react-image/umd/index.js.map'

Failed to parse source map: 'webpack://antd/./components/config-provider/style/index.less' URL is not supported

Failed to parse source map: 'webpack://antd/./components/icon/style/index.less' URL is not supported

Failed to parse source map: 'webpack://antd/./components/locale-provider/style/index.less' URL is not supported

Failed to parse source map: 'webpack://antd/./components/time-picker/style/index.less' URL is not supported

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

File sizes after gzip:

  949.48 kB  build/static/js/main.7c582504.js
  67.2 kB    build/static/css/main.7fa8dcbb.css

The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

  https://cra.link/deployment


> cashtab@1.0.0 test
> node scripts/test.js "--reporters=default" "--reporters=jest-junit" "--coverageReporters=text" "--coverageReporters=lcov" "--coverageReporters=teamcity"

Error: Could not resolve a module for a custom reporter.
  Module name: jest-junit
    at /work/web/cashtab/node_modules/jest-config/build/normalize.js:558:15
    at Array.map (<anonymous>)
    at normalizeReporters (/work/web/cashtab/node_modules/jest-config/build/normalize.js:540:33)
    at normalize (/work/web/cashtab/node_modules/jest-config/build/normalize.js:699:5)
    at readConfig (/work/web/cashtab/node_modules/jest-config/build/index.js:236:74)
    at async readConfigs (/work/web/cashtab/node_modules/jest-config/build/index.js:420:26)
    at async runCLI (/work/web/cashtab/node_modules/@jest/core/build/cli/index.js:132:59)
    at async Object.run (/work/web/cashtab/node_modules/jest-cli/build/cli/index.js:155:37)
mv: cannot stat 'test': No such file or directory
Build cashtab-tests failed with exit code 1

Adding jest-junit dependency

Tail of the build log:

      83 |         console.log(`Setting Api Index to ${currentApiIndex}`);
      84 |         setApiIndex(currentApiIndex);
    > 85 |         return setBCH(getBCH(currentApiIndex));
         |                ^
      86 |         // If you have more than one, use the next one
      87 |         // If you are at the "end" of the array, use the first one
      88 |     };

      at console.error (node_modules/@testing-library/react-hooks/lib/core/console.js:19:7)
      at printWarning (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:68:30)
      at error (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:44:5)
      at warnIfNotCurrentlyActingUpdatesInDEV (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:15034:9)
      at setBCH (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7129:9)
      at tryNextAPI (src/hooks/useWallet.js:85:16)
      at update (src/hooks/useWallet.js:372:13)
      at Object.current (src/hooks/useWallet.js:1115:9)

    console.error
      Warning: An update to TestComponent inside a test was not wrapped in act(...).
      
      When testing, code that causes React state updates should be wrapped into act(...):
      
      act(() => {
        /* fire events that update state */
      });
      /* assert on the output */
      
      This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
          at TestComponent (/work/web/cashtab/node_modules/@testing-library/react-hooks/lib/helpers/createTestHarness.js:22:5)
          at Suspense
          at ErrorBoundary (/work/web/cashtab/node_modules/react-error-boundary/dist/react-error-boundary.cjs.js:59:35)

      1116 |             wallet,
      1117 |         }).finally(() => {
    > 1118 |             setLoading(false);
           |             ^
      1119 |             if (!hasUpdated) {
      1120 |                 setHasUpdated(true);
      1121 |             }

      at console.error (node_modules/@testing-library/react-hooks/lib/core/console.js:19:7)
      at printWarning (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:68:30)
      at error (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:44:5)
      at warnIfNotCurrentlyActingUpdatesInDEV (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:15034:9)
      at setLoading (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7129:9)
      at src/hooks/useWallet.js:1118:13

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.

Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        10.385 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Adding act to correct console.error msgs

Tail of the build log:

    console.error
      Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
          at TestComponent (/work/web/cashtab/node_modules/@testing-library/react-hooks/lib/helpers/createTestHarness.js:22:5)
          at Suspense
          at ErrorBoundary (/work/web/cashtab/node_modules/react-error-boundary/dist/react-error-boundary.cjs.js:59:35)

      366 |             console.log(error);
      367 |             // Set this in state so that transactions are disabled until the issue is resolved
    > 368 |             setApiError(true);
          |             ^
      369 |             //console.timeEnd("update");
      370 |             // Try another endpoint
      371 |             console.log(`Trying next API...`);

      at console.error (node_modules/@testing-library/react-hooks/lib/core/console.js:19:7)
      at printWarning (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:68:30)
      at error (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:44:5)
      at warnAboutUpdateOnUnmountedFiberInDEV (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14931:9)
      at scheduleUpdateOnFiber (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12951:5)
      at setApiError (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7133:5)
      at update (src/hooks/useWallet.js:368:13)
      at Object.current (src/hooks/useWallet.js:1115:9)

    console.log
      Trying next API...

      at update (src/hooks/useWallet.js:371:21)

    console.log
      You have 4 APIs to choose from

      at tryNextAPI (src/hooks/useWallet.js:64:17)

    console.log
      Current selection: 0

      at tryNextAPI (src/hooks/useWallet.js:65:17)

    console.log
      Incrementing API index from 0 to 1

      at tryNextAPI (src/hooks/useWallet.js:74:21)

    console.log
      Setting Api Index to 1

      at tryNextAPI (src/hooks/useWallet.js:83:17)


Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        9.76 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Mock console.errors for migration; errors are not related to migration and should be addressed in separate diffs

Tail of the build log:

    console.log
      Incrementing API index from 0 to 1

      at tryNextAPI (src/hooks/useWallet.js:74:21)

    console.log
      Setting Api Index to 1

      at tryNextAPI (src/hooks/useWallet.js:83:17)

    console.log
      Error in update({wallet})

      at update (src/hooks/useWallet.js:365:21)

    console.log
      TypeError: getUtxos is not a function
          at update (/work/web/cashtab/src/hooks/useWallet.js:216:33)
          at Object.current (/work/web/cashtab/src/hooks/useWallet.js:1115:9)

      at update (src/hooks/useWallet.js:366:21)

    console.log
      Trying next API...

      at update (src/hooks/useWallet.js:371:21)

    console.log
      You have 4 APIs to choose from

      at tryNextAPI (src/hooks/useWallet.js:64:17)

    console.log
      Current selection: 0

      at tryNextAPI (src/hooks/useWallet.js:65:17)

    console.log
      Incrementing API index from 0 to 1

      at tryNextAPI (src/hooks/useWallet.js:74:21)

    console.log
      Setting Api Index to 1

      at tryNextAPI (src/hooks/useWallet.js:83:17)


Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        9.866 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Mock console.log for jest error not related to migration

Tail of the build log:

          at processTicksAndRejections (node:internal/process/task_queues:94:5)

      at sendXec (src/hooks/useBCH.js:1639:21)

    console.log
      error:  Error: too-long-mempool-chain, too many unconfirmed ancestors [limit: 25] (code 64)
          at RawTransactions.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:383:29)
          at /work/web/cashtab/node_modules/jest-mock/build/index.js:449:39
          at RawTransactions.<anonymous> (/work/web/cashtab/node_modules/jest-mock/build/index.js:457:13)
          at RawTransactions.sendRawTransaction (/work/web/cashtab/node_modules/jest-mock/build/index.js:170:19)
          at sendXec (/work/web/cashtab/src/hooks/useBCH.js:1612:55)
          at Object.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:389:41)
          at processTicksAndRejections (node:internal/process/task_queues:94:5)

      at sendXec (src/hooks/useBCH.js:1639:21)

    console.log
      XEC txid 5

      at createToken (src/hooks/useBCH.js:937:25)

    console.log
      error:  Error: Invalid wallet
          at createToken (/work/web/cashtab/src/hooks/useBCH.js:850:37)
          at Object.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:429:44)
          at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
          at new Promise (<anonymous>)
          at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
          at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
          at processTicksAndRejections (node:internal/process/task_queues:94:5)
          at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
          at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
          at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:60:9)
          at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
          at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
          at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
          at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
          at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
          at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

      at createToken (src/hooks/useBCH.js:962:21)

    console.log
      Error in BCH.RawTransactions.getRawTransaction(d3e1b8a65f9d50363cad9a496f7cecab59c9415dd9bcfd6f56c0c5dd4dffa7af, true)

      at parseTxData (src/hooks/useBCH.js:317:29)

PASS src/hooks/__tests__/useWallet.test.js (7.968 s)

Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        10.097 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Mocking console.log to suppress expected error msgs from useBCH.js

Tail of the build log:

      at updateSavedWallets (src/components/Configure/Configure.js:321:25)

    console.log
      TypeError: getSavedWallets is not a function
          at updateSavedWallets (/work/web/cashtab/src/components/Configure/Configure.js:318:38)
          at /work/web/cashtab/src/components/Configure/Configure.js:331:9
          at invokePassiveEffectCreate (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14504:20)
          at HTMLUnknownElement.callCallback (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:11391:14)
          at HTMLUnknownElement.callTheUserObjectsOperation (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30)
          at innerInvokeEventListeners (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
          at invokeEventListeners (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
          at HTMLUnknownElementImpl._dispatch (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
          at HTMLUnknownElementImpl.dispatchEvent (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)
          at HTMLUnknownElement.dispatchEvent (/work/web/cashtab/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)
          at Object.invokeGuardedCallbackDev (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:11440:16)
          at invokeGuardedCallback (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:11499:31)
          at flushPassiveEffectsImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14591:9)
          at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
          at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
          at flushPassiveEffects (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14464:14)
          at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13380:3)
          at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
          at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
          at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
          at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
          at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
          at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
          at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
          at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
          at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:21:32)
          at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
          at new Promise (<anonymous>)
          at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
          at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
          at processTicksAndRejections (node:internal/process/task_queues:94:5)
          at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
          at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
          at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
          at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
          at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
          at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
          at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
          at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

      at updateSavedWallets (src/components/Configure/Configure.js:322:25)

PASS src/hooks/__tests__/useBCH.test.js (7.138 s)
PASS src/hooks/__tests__/useWallet.test.js (8.029 s)

Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        10.02 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Mocking other console.logs not related to the migration

Tail of the build log:

  949.48 kB  build/static/js/main.7c582504.js
  67.2 kB    build/static/css/main.7fa8dcbb.css

The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

  https://cra.link/deployment


> cashtab@1.0.0 test
> node scripts/test.js "--reporters=default" "--reporters=jest-junit" "--coverageReporters=text" "--coverageReporters=lcov" "--coverageReporters=teamcity"

jest-haste-map: duplicate manual mock found: mockLegacyWallets
  The following files share their name; please delete one of them:
    * <rootDir>/src/utils/__mocks__/mockLegacyWallets.js
    * <rootDir>/src/hooks/__mocks__/mockLegacyWallets.js

PASS src/utils/__tests__/formatting.test.js
PASS src/hooks/__tests__/migrations.test.js
PASS src/components/Common/__tests__/QRCode.test.js
PASS src/utils/__tests__/validation.test.js
PASS src/utils/__tests__/cashMethods.test.js
PASS src/components/Receive/__tests__/Receive.test.js
PASS src/components/Airdrop/__tests__/Airdrop.test.js
PASS src/utils/__tests__/tokenMethods.test.js
PASS src/components/Home/__tests__/Home.test.js (5.03 s)
PASS src/components/Tokens/__tests__/Tokens.test.js (5.055 s)
PASS src/components/Send/__tests__/SendToken.test.js (5.074 s)
PASS src/components/Tokens/__tests__/CreateTokenForm.test.js
PASS src/components/Common/__tests__/StyledCollapse.test.js
PASS src/components/Send/__tests__/Send.test.js (5.225 s)
PASS src/components/__tests__/NotFound.test.js
PASS src/components/Configure/__tests__/Configure.test.js
PASS src/hooks/__tests__/useBCH.test.js (7.111 s)
PASS src/hooks/__tests__/useWallet.test.js (7.078 s)

Test Suites: 18 passed, 18 total
Tests:       336 passed, 336 total
Snapshots:   33 passed, 33 total
Time:        9.786 s
Ran all test suites.

> cashtab@1.0.0 posttest
> ./scripts/addGenerated.sh

/work/abc-ci-builds/cashtab-tests/script.sh: line 24: coverage/lcov-report/coverage-summary.txt: No such file or directory
Build cashtab-tests failed with exit code 1

Removing mocked console logs to test ci unit testing

Remove mocked console.log statements from unit tests

Patch antd sourcemap error with minimized css import

This revision is now accepted and ready to land.Mar 29 2022, 17:54
This revision was automatically updated to reflect the committed changes.