diff --git a/examples/react-testing-lib/src/App.test.tsx b/examples/react-testing-lib/src/App.test.tsx
index e58778ff2..2a004f6eb 100644
--- a/examples/react-testing-lib/src/App.test.tsx
+++ b/examples/react-testing-lib/src/App.test.tsx
@@ -1,16 +1,16 @@
import { describe, expect, it } from 'vitest'
-import { render, screen, userEvent } from './utils/test-utils'
import App from './App'
+import { render, screen, userEvent } from './utils/test-utils'
describe('Simple working test', () => {
it('the title is visible', () => {
render()
- expect(screen.getByText(/Hello Vite \+ React!/i)).toBeDefined()
+ expect(screen.getByText(/Hello Vite \+ React!/i)).toBeInTheDocument()
})
- it('should increment count on click', () => {
+ it('should increment count on click', async() => {
render()
userEvent.click(screen.getByRole('button'))
- expect(screen.findByText(/count is: 1/i)).toBeDefined()
+ expect(await screen.findByText(/count is: 1/i)).toBeInTheDocument()
})
})
diff --git a/examples/react-testing-lib/src/test/setup.ts b/examples/react-testing-lib/src/test/setup.ts
new file mode 100644
index 000000000..c44951a68
--- /dev/null
+++ b/examples/react-testing-lib/src/test/setup.ts
@@ -0,0 +1 @@
+import '@testing-library/jest-dom'
diff --git a/examples/react-testing-lib/vite.config.ts b/examples/react-testing-lib/vite.config.ts
index 3f4d16755..c954c14c4 100644
--- a/examples/react-testing-lib/vite.config.ts
+++ b/examples/react-testing-lib/vite.config.ts
@@ -10,5 +10,6 @@ export default defineConfig({
test: {
global: true,
environment: 'jsdom',
+ setupFiles: './src/test/setup.ts',
},
})