Skip to content

Error message from shutting down a Jest + MSW test #2493

Closed Answered by promer94
joshkel asked this question in Q&A
Discussion options

You must be logged in to vote

You could provide your own isVisible implementation for testing environment.

/** @jest-environment jsdom */
import * as React from 'react'
import { Hello } from './test'
import { fireEvent, render, screen } from '@testing-library/react'
import { rest } from 'msw'
import { setupServer } from 'msw/node'
import { SWRConfig } from 'swr'

const renderWithSWRConfig = (component) => {
  const map = new Map()
  return render(
    <SWRConfig
      value={{
        provider: () => map,
        isOnline() {
          /* Customize the network state detector */
          return true
        },
        isVisible() {
          /* Customize the visibility state detector */
          return true
        },

Replies: 6 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@joshkel
Comment options

@giovannivocale-molar
Comment options

@chrislicodes
Comment options

@joshkel
Comment options

@chrislicodes
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by promer94
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
7 participants
Converted from issue

This discussion was converted from issue #2463 on March 08, 2023 13:33.