From 44b20db0875658d61e6f26c0f98c78bae8fcd5ad Mon Sep 17 00:00:00 2001 From: Ahmed Elsakaan Date: Sat, 8 Jun 2024 15:06:23 +0100 Subject: [PATCH] chore: remove bun test for now --- .github/workflows/main-ci.yml | 3 -- .github/workflows/pr-ci.yml | 3 -- bun-test.d.ts | 11 -------- bunfig.toml | 3 -- eslint.config.js | 8 ------ package.json | 3 -- src/lib/utils.spec.tsx | 53 ----------------------------------- src/test/setup.ts | 12 -------- src/test/utils.tsx | 16 ----------- tsconfig.json | 1 - 10 files changed, 113 deletions(-) delete mode 100644 bun-test.d.ts delete mode 100644 bunfig.toml delete mode 100644 src/lib/utils.spec.tsx delete mode 100644 src/test/setup.ts delete mode 100644 src/test/utils.tsx diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index c1d2c4b5..b68fd36d 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -62,8 +62,5 @@ jobs: - name: Typecheck run: bun typecheck - - name: Unit tests - run: bun test - - name: Build run: bun run build diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 3c5e7214..84742de6 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -77,8 +77,5 @@ jobs: - name: Typecheck run: bun typecheck - - name: Unit tests - run: bun test - - name: Build run: bun run build diff --git a/bun-test.d.ts b/bun-test.d.ts deleted file mode 100644 index 098700a9..00000000 --- a/bun-test.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { type TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'; -import { type expect } from 'bun:test'; - -declare module 'bun:test' { - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - interface Matchers - extends TestingLibraryMatchers< - ReturnType, - T - > {} -} diff --git a/bunfig.toml b/bunfig.toml deleted file mode 100644 index 3779f01c..00000000 --- a/bunfig.toml +++ /dev/null @@ -1,3 +0,0 @@ -[test] -preload = "./src/test/setup.ts" -root = "./src" \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 282fdc72..252e6c63 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -51,14 +51,6 @@ export default tseslint.config( extends: [jsdoc.configs['flat/recommended-typescript-error']], }, - // Unit tests - { - files: ['src/**/?(*.)+(spec|test).[jt]s?(x)'], - extends: [ - ...fixupConfigRules(compat.extends('plugin:testing-library/react')), - ], - }, - // Settings and rule overrides { linterOptions: { diff --git a/package.json b/package.json index 086adcc1..fabba81c 100644 --- a/package.json +++ b/package.json @@ -111,8 +111,6 @@ "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/typography": "^0.5.13", - "@testing-library/jest-dom": "^6.4.5", - "@testing-library/react": "^16.0.0", "@total-typescript/ts-reset": "^0.5.1", "@types/bun": "^1.1.3", "@types/eslint": "^8.56.10", @@ -132,7 +130,6 @@ "eslint-plugin-regexp": "^2.6.0", "eslint-plugin-security": "^3.0.0", "eslint-plugin-tailwindcss": "^3.17.3", - "eslint-plugin-testing-library": "^6.2.2", "globals": "^15.4.0", "husky": "^9.0.11", "lint-staged": "^15.2.5", diff --git a/src/lib/utils.spec.tsx b/src/lib/utils.spec.tsx deleted file mode 100644 index 6dabe939..00000000 --- a/src/lib/utils.spec.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable no-global-assign */ -import { afterEach, describe, expect, it } from 'bun:test'; - -import { cn, constructMetadata, getBaseUrl } from './utils'; - -describe('utils', () => { - const originalWindow = window; - - afterEach(() => { - window = originalWindow; - }); - - it('should merge classes using cn function', () => { - // eslint-disable-next-line tailwindcss/classnames-order, tailwindcss/no-contradicting-classname - const classes = cn('text-black p-4', 'text-white'); - - expect(classes).toBe('p-4 text-white'); - }); - - it('should get the base URL', () => { - Object.defineProperty(window, 'location', { - value: new URL('http://example.com'), - configurable: true, - }); - - expect(getBaseUrl()).toBe('http://example.com'); - }); - - it('should get the base vercel url when available', () => { - // @ts-expect-error window needs to be undefined - window = undefined; - - process.env['VERCEL_URL'] = 'example.com'; - - expect(getBaseUrl()).toBe('https://example.com'); - }); - - it('should construct metadata', () => { - Object.defineProperty(window, 'location', { - value: new URL('http://example.com'), - configurable: true, - }); - - const metadata = constructMetadata({ - title: 'hello', - description: 'world', - }); - - expect(metadata.title).toBe('hello'); - expect(metadata.description).toBe('world'); - }); -}); -/* eslint-enable no-global-assign */ diff --git a/src/test/setup.ts b/src/test/setup.ts deleted file mode 100644 index 41e713b0..00000000 --- a/src/test/setup.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { GlobalRegistrator } from '@happy-dom/global-registrator'; -import * as matchers from '@testing-library/jest-dom/matchers'; -import { cleanup } from '@testing-library/react'; -import { afterEach, expect } from 'bun:test'; - -GlobalRegistrator.register(); - -expect.extend(matchers); - -afterEach(() => { - cleanup(); -}); diff --git a/src/test/utils.tsx b/src/test/utils.tsx deleted file mode 100644 index 676d8ef0..00000000 --- a/src/test/utils.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import type { RenderOptions } from '@testing-library/react'; -import type { PropsWithChildren, ReactElement } from 'react'; - -import { render } from '@testing-library/react'; - -const AllTheProviders = ({ children }: PropsWithChildren) => { - return
{children}
; -}; - -const customRender = ( - ui: ReactElement, - options?: Omit, -) => render(ui, { wrapper: AllTheProviders, ...options }); - -export * from '@testing-library/react'; -export { customRender as render }; diff --git a/tsconfig.json b/tsconfig.json index 204cb272..de82c2cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,7 +43,6 @@ }, "include": [ "next-env.d.ts", - "bun-test.d.ts", "reset.d.ts", "eslint.d.ts", "**/*.ts",