kbss-cvut / record-manager-ui

GNU Lesser General Public License v3.0
0 stars 2 forks source link

[feature] add vitest #130

Closed shellyear closed 6 months ago

shellyear commented 6 months ago

Partially resolves https://github.com/kbss-cvut/record-manager-ui/issues/110

@blcham


 Test Files  39 passed | 5 skipped (44)
      Tests  272 passed | 21 skipped (293)
   Start at  22:12:40
   Duration  10.56s (transform 2.24s, setup 4.24s, collect 18.21s, tests 752ms, environment 11.13s, prepare 2.65s)

There are remaining errors that are not shown in the terminal, but in the build pipeline: [1]

_[ This error originated in "tests/__tests__/actions/UserActions.spec.jsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

⎯⎯⎯⎯⎯ Uncaught Exception ⎯⎯⎯⎯⎯
AssertionError: expected [ …(3) ] to deeply equal [ { …(2) }, { …(3) }, { …(2) } ]_

[2]

Error: done() callback is deprecated, use promise instead
 ❯ context node_modules/@vitest/runner/dist/index.js:73:11
 ❯ Timeout._onTimeout tests/__tests__/actions/UserActions.spec.jsx:566:7
    564|     setTimeout(() => {
    565|       expect(store.getActions()).toEqual(expectedActions);
    566|       done();
       |       ^
    567|     }, TEST_TIMEOUT);
    568|   });
 ❯ listOnTimeout node:internal/timers:569:17
 ❯ processTimers node:internal/timers:512:7

This error originated in "tests/__tests__/actions/UserActions.spec.jsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

[3] warning stderr | tests/tests/components/User.spec.jsx > User > renders filled admin's form Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

UPD: all errors are runtime and relate to UserActions.spec.jsx

e.g

stdout | tests/__tests__/actions/UserActions.spec.jsx > User asynchronous actions > creates SAVE_USER_SUCCESS action when saving user successfully is done
{
  storeActions: [ { type: 'SAVE_USER_PENDING', actionFlag: 'CREATE_ENTITY' } ],
  expectedActions: [
    { type: 'SAVE_USER_PENDING', actionFlag: 'CREATE_ENTITY' },
    {
      type: 'SAVE_USER_SUCCESS',
      actionFlag: 'CREATE_ENTITY',
      user: [Object]
    },
    { type: 'LOAD_USERS_PENDING' },
    { type: 'LOAD_USERS_SUCCESS', users: [Array] }
  ]
}
shellyear commented 6 months ago

@blcham There are runtime errors left, also @cfaester/enzyme-adapter-react-18 will be removed

blcham commented 6 months ago

xit --> test.skip

blcham commented 6 months ago

@shellyear still there are 57 files committed (i.e. to review), you need to rebase from main: image

It seems that you forgot to do sync before rebase: image

shellyear commented 6 months ago

@shellyear still there are 57 files committed (i.e. to review), you need to rebase from main: image

It seems that you forgot to do sync before rebase: image

@blcham I did it manually using, git fetch upstream & git pull upstream main. But most likely will use sync fork next time

shellyear commented 6 months ago

@blcham fixed the last error https://github.com/kbss-cvut/record-manager-ui/pull/130/commits/03235d8226637d646a71b12f3afabd2bc7d0c920