Skip to content

Commit

Permalink
use bun instead of vitest, remove testing library
Browse files Browse the repository at this point in the history
problems with index.test.tsx due to Next.js Image
  • Loading branch information
syhner committed Sep 9, 2023
1 parent 7ef936f commit 2230f85
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 88 deletions.
14 changes: 0 additions & 14 deletions README.md
Expand Up @@ -39,9 +39,6 @@ Some features depend on environment variables (indicated in features list with

### Testing

- 🧪 [**Vitest**](https://vitest.dev/) - Flexible testing framework
- 🐙 [**React Testing Library**](https://testing-library.com/docs/react-testing-library/intro/) - Maintainable component testing
- 🔗 integrates with Vitest as your testing framework
- 🎭 [**Playwright**](https://playwright.dev/) - End-to-end testing against multiple environments

### Deployment
Expand Down Expand Up @@ -129,11 +126,6 @@ Some features depend on environment variables (indicated in features list with
- [`.prettierignore`](.prettierignore)
- [`.prettierrc.json`](.prettierrc.json)

### [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)

- [`src/app/page.test.tsx`](src/app/page.test.tsx)
- [`testing/setup.ts`](testing/setup.ts)

### [shadcn/ui](https://ui.shadcn.com/)

- [`src/components/providers/theme-provider.tsx`](src/components/providers/theme-provider.tsx)
Expand Down Expand Up @@ -167,12 +159,6 @@ Some features depend on environment variables (indicated in features list with
- [`tsconfig.json`](tsconfig.json) - all modifications from [create-next-app](https://www.npmjs.com/package/create-next-app) are explained with comments
- [`types/reset.d.ts`](types/reset.d.ts) - using [ts-reset](https://github.com/total-typescript/ts-reset) to increase type-safety

### [Vitest](https://vitest.dev/)

- [`testing/setup.ts`](testing/setup.ts)
- [`types/vitest.d.ts`](types/vitest.d.ts)
- [`vitest.config.ts`](vitest.config.ts)

### [VS Code](https://code.visualstudio.com/)

- [`.vscode/extensions.json`](.vscode/extensions.json) - recommended workspace extensions
Expand Down
Binary file modified bun.lockb
Binary file not shown.
13 changes: 2 additions & 11 deletions package.json
Expand Up @@ -16,7 +16,7 @@
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit",
"----TEST": "",
"test:unit": "vitest",
"test:unit": "bun test src",
"test:e2e": "playwright test",
"----DATABASE": "",
"db:drop": "drizzle-kit drop",
Expand Down Expand Up @@ -67,8 +67,6 @@
"@next/bundle-analyzer": "^13.4.10",
"@playwright/test": "^1.37.1",
"@tailwindcss/typography": "^0.5.9",
"@testing-library/jest-dom": "^6.0.1",
"@testing-library/react": "^14.0.0",
"@total-typescript/ts-reset": "^0.4.2",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
Expand All @@ -79,18 +77,11 @@
"eslint": "8.48.0",
"eslint-config-next": "13.4.19",
"eslint-config-prettier": "^8.8.0",
"jsdom": "^22.1.0",
"postcss": "8.4.29",
"prettier": "^3.0.0",
"prettier-plugin-tailwindcss": "^0.4.1",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.6",
"typescript": "5.2.2",
"vitest": "^0.34.2"
},
"pnpm": {
"overrides": {
"@auth/core": "0.12.0"
}
"typescript": "5.2.2"
}
}
13 changes: 0 additions & 13 deletions src/app/page.test.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions src/trpc/router/index.test.ts
@@ -1,6 +1,4 @@
// @vitest-environment node

import { expect, it, test } from 'vitest';
import { expect, it, test } from 'bun:test';
import { appRouter } from '.';
import { createContext } from '../init';

Expand Down
29 changes: 10 additions & 19 deletions testing/setup.ts
@@ -1,20 +1,11 @@
import matchers from '@testing-library/jest-dom/matchers';
import { cleanup } from '@testing-library/react';
import { afterEach, expect, vi } from 'vitest';
// import { vi } from 'vitest';

expect.extend(matchers);

vi.mock('next-auth', () => {
const auth = () => ({ user: null });
return {
default: () => ({
auth,
handlers: {},
}),
};
});

// Hooks are reset before each suite
afterEach(() => {
cleanup();
});
// vi.mock('next-auth', () => {
// const auth = () => ({ user: null });
// return {
// default: () => ({
// auth,
// handlers: {},
// }),
// };
// });
9 changes: 0 additions & 9 deletions types/vitest.d.ts

This file was deleted.

19 changes: 0 additions & 19 deletions vitest.config.ts

This file was deleted.

0 comments on commit 2230f85

Please sign in to comment.