Skip to content

Conversation

@amanvatss
Copy link

This pull request introduces a pre-configured testing environment for the MERN templates (both JavaScript and TypeScript), enabling developers to run tests out-of-the-box with npm test.


Before This PR

  • The generated templates had no built-in testing capabilities.
  • Developers had to manually install, configure, and debug a testing framework from scratch.

After This PR

  • Both the JavaScript and TypeScript MERN templates now include a fully configured Jest and React Testing Library setup.
  • Developers can immediately start writing tests for their components.
  • A sample test (App.test.js/.tsx) is included to verify the setup and provide an example.

Changes Implemented

  • Dependencies Added: jest, jest-environment-jsdom, @testing-library/react, @testing-library/jest-dom.
  • JavaScript Template:
    • Configured Babel (.babelrc) for JSX transformation.
    • Added jest.config.js, jest.setup.js, and a fileMock.js for static assets.
  • TypeScript Template:
    • Added ts-jest, @types/jest, and typescript dependencies.
    • Created a custom jest.config.js to handle TypeScript and JSX compilation correctly for the test environment.
  • Added npm test script to the package.json of both client templates.

This feature significantly improves the quality and completeness of the scaffolded projects, promoting best practices from the start.


Proof of Work (Test Results)

Here are the screenshots showing the tests passing for both the JavaScript and TypeScript templates.

JavaScript MERN Template:
image

TypeScript MERN Template:
image

Closes #111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add pre-configured testing environment with Jest and Testing Library

1 participant