Skip to content

tdnl/ra4-test

Repository files navigation

ra4-test

How was this project generated?

npx create-react-admin@latest ra4-test
npm i --save-dev vitest @testing-library/jest-dom @testing-library/react jsdom

Update vite.config.ts to setup vitest:

  // ...
  test: {
    globals: true,
    environment: "jsdom",
    threads: false,
    setupFiles: "src/tests/setup-tests.ts",
    include: ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js", "**/*.spec.jsx"],
  },
  // ...

Add test in script:

{
  "scripts": {
    "test": "vitest"
  }
}

The Issue

Running npm test will start vitest who will then fail because some tests are throwing errors:

TypeError: Cannot read properties of null (reading 'control')TypeError: Cannot read properties of null (reading 'control')

Test Pass Using RA Component Note
button-with-state.spec.tsx ✔️ Custom components
ra-button-with-state.spec.tsx ✔️
ra-toolbar-with-save.spec.tsx ✔️
toolbar-with-save-cjs.spec.tsx Files were taken from cjs folder in ra-ui-material-ui
toolbar-with-save.spec.tsx ✔️ Files were taken from esm folder in ra-ui-material-ui

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published