# How to Run Tests in TaxHacker: Setting Up Automated Testing for the Next.js Codebase

> Learn how to run tests in TaxHacker by setting up automated testing for your Next.js codebase. Follow this guide to configure Jest or Playwright for your project.

- Repository: [Vasily Zubarev/TaxHacker](https://github.com/vas3k/TaxHacker)
- Tags: how-to-guide
- Published: 2026-04-01

---

**TaxHacker does not ship with a built-in test suite, so you must manually install and configure a testing framework like Jest or Playwright before you can run any automated tests.**

The [vas3k/TaxHacker](https://github.com/vas3k/TaxHacker) repository is a Next.js application that currently relies on manual testing and ESLint for code quality. If you are looking to run tests in TaxHacker, you first need to understand that the project lacks predefined test scripts or test files. This guide explains the current verification options available and provides complete setup instructions for adding both unit and end-to-end testing capabilities.

## Why TaxHacker Has No Default Test Command

Examining the [`package.json`](https://github.com/vas3k/TaxHacker/blob/main/package.json) file reveals that the project defines only four npm scripts: `dev`, `build`, `start`, and `lint`.

```json
{
  "scripts": {
    "dev": "next dev -p 7331 --turbopack",
    "build": "next build",
    "start": "prisma migrate deploy && next start",
    "lint": "next lint"
  }
}

```

There are no `test` or `e2e` entries in the scripts section. Additionally, the source tree contains no files matching standard test patterns such as `*.test.ts`, `*.spec.ts`, or `*.test.tsx`. While [`package-lock.json`](https://github.com/vas3k/TaxHacker/blob/main/package-lock.json) lists **@playwright/test** as a dev-dependency, the repository lacks both a [`playwright.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/playwright.config.ts) configuration file and an actual Playwright test directory.

## Current Verification: Running the Linter

The only automated quality check available out of the box is the Next.js ESLint integration. To run static analysis across the codebase, use the built-in lint script:

```bash
npm run lint

```

This command executes `next lint` and checks for JavaScript and TypeScript errors according to the project's ESLint configuration. While this catches syntax issues and style violations, it does not verify runtime behavior or business logic.

## Adding Unit Tests with Jest

To implement unit testing in TaxHacker, you need to install Jest and its TypeScript preset manually. Since the project uses TypeScript, `ts-jest` is the recommended preset for handling `*.ts` and `*.tsx` files.

First, install the required dev dependencies:

```bash
npm i -D jest ts-jest @types/jest

```

Create a [`jest.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/jest.config.ts) file in the project root:

```typescript
export default {
  preset: 'ts-jest',
  testEnvironment: 'node',
  moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
  testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
};

```

Add the test script to your [`package.json`](https://github.com/vas3k/TaxHacker/blob/main/package.json):

```json
{
  "scripts": {
    "test": "jest --detectOpenHandles"
  }
}

```

Place your test files alongside the source code you want to test, such as [`models/users.test.ts`](https://github.com/vas3k/TaxHacker/blob/main/models/users.test.ts), then execute:

```bash
npm run test

```

## Adding End-to-End Tests with Playwright

Because **@playwright/test** already exists in the lock file, you only need to install the browser binaries and create a configuration to run end-to-end tests in TaxHacker.

Install the Playwright browsers:

```bash
npx playwright install

```

Create a minimal [`playwright.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/playwright.config.ts):

```typescript
import { defineConfig } from '@playwright/test';

export default defineConfig({
  testDir: 'e2e',
  webServer: {
    command: 'npm run dev',
    port: 7331,
    timeout: 120 * 1000,
    reuseExistingServer: !process.env.CI,
  },
});

```

Create a sample test file at [`e2e/home.spec.ts`](https://github.com/vas3k/TaxHacker/blob/main/e2e/home.spec.ts):

```typescript
import { test, expect } from '@playwright/test';

test('homepage loads', async ({ page }) => {
  await page.goto('http://localhost:7331');
  await expect(page).toHaveTitle(/TaxHacker/);
});

```

Run the Playwright suite:

```bash
npx playwright test

```

## Verifying Database Schema Integrity

Although not a traditional test runner, you can verify database migration integrity using the Prisma CLI, which is already included as a dev dependency. This ensures your `prisma/schema.prisma` definitions align with the database state:

```bash
npx prisma migrate dev

```

This command is particularly useful during development to catch schema drift before deploying the application.

## Summary

- **TaxHacker has no built-in test suite**: The [`package.json`](https://github.com/vas3k/TaxHacker/blob/main/package.json) contains no test scripts and the repository lacks `*.test.ts` files.
- **Linting is available immediately**: Run `npm run lint` to execute Next.js ESLint for static code analysis.
- **Add Jest for unit testing**: Install `jest` and `ts-jest`, create a [`jest.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/jest.config.ts), and add a test script to run unit tests.
- **Leverage existing Playwright**: Since Playwright is already in [`package-lock.json`](https://github.com/vas3k/TaxHacker/blob/main/package-lock.json), you only need to install browsers and create a config to enable end-to-end testing.
- **Prisma validates schemas**: Use `npx prisma migrate dev` to verify database integrity as part of your quality workflow.

## Frequently Asked Questions

### Does TaxHacker come with any pre-written tests?

No, the repository does not contain any pre-written tests. According to the source code in [`package.json`](https://github.com/vas3k/TaxHacker/blob/main/package.json), there are no test scripts defined, and no files matching `*.test.ts` or `*.spec.ts` patterns exist in the codebase. You must implement your own test suite from scratch.

### Can I run tests without installing additional dependencies?

No, you cannot run automated tests without installing additional dependencies. The only verification command available without extra packages is `npm run lint`, which performs static analysis. To execute actual unit or integration tests, you must install a testing framework like Jest or Playwright.

### Why is Playwright listed in package-lock.json but not configured?

The [`package-lock.json`](https://github.com/vas3k/TaxHacker/blob/main/package-lock.json) file shows that `@playwright/test` was previously added as a dev-dependency, but the project maintainers did not commit a [`playwright.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/playwright.config.ts) file or any test specifications. You can activate it by installing the browser binaries with `npx playwright install` and creating the necessary configuration files.

### What is the fastest way to add testing to TaxHacker?

The fastest approach is to install Jest for unit testing. Run `npm i -D jest ts-jest @types/jest`, create a basic [`jest.config.ts`](https://github.com/vas3k/TaxHacker/blob/main/jest.config.ts), and add `"test": "jest"` to the scripts section of [`package.json`](https://github.com/vas3k/TaxHacker/blob/main/package.json). This setup takes less than five minutes and allows you to immediately start writing tests for utilities and models.