AlexanderRichey / styled-react-modal

Styled modal component for React πŸ’…βš›οΈ
The Unlicense
213 stars 22 forks source link

Updated dependencies using `npm-check-updates` #61

Closed dantecesa closed 2 years ago

dantecesa commented 2 years ago

Used npm-check-updates to bump dependencies to latest versions (mostly because I want to use this without having to use --legacy-peer-deps when installing w/ React 18 β†’ see #62).

Note, tests fail locally (see below), but they also fail for the latest on main… so not sure what's going on there. They seem to be fine in CI here (so maybe there's some Jest settings πŸ§™ that I'm missing…).

styled-react-modal [dc-updatedependencies] : npm run test

> styled-react-modal@3.0.0 test
> jest --coverage --verbose

 FAIL  tests/Modal.test.jsx
  <Modal />
    βœ• renders nothing when not open (1 ms)
    βœ• renders children when open
    βœ• calls onBackgroundClick when the background is clicked
    βœ• calls onEscapeKeydown when the escape key is pressed
    βœ• calls beforeOpen() before it opens
    βœ• calls beforeOpen() before it opens and waits to call afterOpen() if it returns a promise
    βœ• calls afterOpen() after it opens
    βœ• calls beforeClose() before it closes
    βœ• calls beforeClose() before it closes and waits to call afterClose() if it returns a promise
    βœ• calls afterClose() after it closes (1 ms)
    βœ• passes background props to background
  Modal.styled()
    βœ• returns to a <Modal /> instance (1 ms)

  ● <Modal /> β€Ί renders nothing when not open

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:41:29)

  ● <Modal /> β€Ί renders children when open

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:46:27)

  ● <Modal /> β€Ί calls onBackgroundClick when the background is clicked

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:52:29)

  ● <Modal /> β€Ί calls onEscapeKeydown when the escape key is pressed

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:63:5)

  ● <Modal /> β€Ί calls beforeOpen() before it opens

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:74:29)

  ● <Modal /> β€Ί calls beforeOpen() before it opens and waits to call afterOpen() if it returns a promise

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at renderWithProvider (tests/Modal.test.jsx:89:29)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:86:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:66:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:117:21)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
      at node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7

  ● <Modal /> β€Ί calls afterOpen() after it opens

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:103:29)

  ● <Modal /> β€Ί calls beforeClose() before it closes

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:115:29)

  ● <Modal /> β€Ί calls beforeClose() before it closes and waits to call afterClose() if it returns a promise

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at renderWithProvider (tests/Modal.test.jsx:131:29)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:86:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:66:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:117:21)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
      at node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7

  ● <Modal /> β€Ί calls afterClose() after it closes

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:146:29)

  ● <Modal /> β€Ί passes background props to background

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      30 |   };
      31 |
    > 32 |   return render(
         |          ^
      33 |     <ModalProvider data-testid="provider" {...providerProps}>
      34 |       <StatefulModal {...finalModalProps} />
      35 |     </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at renderWithProvider (tests/Modal.test.jsx:32:10)
      at Object.renderWithProvider (tests/Modal.test.jsx:161:29)

  ● Modal.styled() β€Ί returns to a <Modal /> instance

    The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: document is not defined

      179 |     `;
      180 |
    > 181 |     const { getByTestId } = render(
          |                             ^
      182 |       <ModalProvider>
      183 |         <StyledModal isOpen={true} data-testid="modal" />
      184 |       </ModalProvider>

      at render (node_modules/@testing-library/react/dist/pure.js:210:5)
      at Object.<anonymous> (tests/Modal.test.jsx:181:29)

-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |    12.9 |     2.32 |    5.55 |    12.9 |                   
 Modal.jsx         |      10 |     2.43 |    6.66 |      10 | 8-133,144         
 ModalProvider.jsx |      10 |        0 |       0 |      10 | 10-26             
 baseStyles.jsx    |     100 |      100 |     100 |     100 |                   
 context.jsx       |     100 |      100 |     100 |     100 |                   
 index.jsx         |       0 |        0 |       0 |       0 |                   
-------------------|---------|----------|---------|---------|-------------------
Test Suites: 1 failed, 1 total
Tests:       12 failed, 12 total
Snapshots:   0 total
Time:        0.373 s, estimated 1 s
Ran all test suites.
codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit abcdfba8c5e52b37ff66a1211120c78afe891184:

Sandbox Source
styled-react-modal demo Configuration
dantecesa commented 2 years ago

Appreciate the follow up & the fix!!