Skip to content

Commit

Permalink
Use vitest instead of jest
Browse files Browse the repository at this point in the history
  • Loading branch information
mellevanderlinde committed Jan 2, 2025
1 parent 0ed669f commit e263f21
Show file tree
Hide file tree
Showing 19 changed files with 947 additions and 1,955 deletions.
1 change: 0 additions & 1 deletion apps/infra/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.js
!jest.config.js
!eslint.config.js
*.d.ts
node_modules
Expand Down
12 changes: 0 additions & 12 deletions apps/infra/jest.config.ts

This file was deleted.

10 changes: 4 additions & 6 deletions apps/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@
"scripts": {
"build": "tsc",
"lint": "eslint .",
"test": "jest",
"test:update": "jest -u"
"test": "vitest run",
"test:update": "vitest run -u"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.10.3",
"aws-cdk": "^2.173.4",
"eslint-config": "workspace:*",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"vitest": "^2.1.8"
},
"dependencies": {
"aws-cdk-lib": "^2.173.4",
Expand Down
2 changes: 1 addition & 1 deletion apps/infra/test/__snapshots__/stack.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Match with snapshot 1`] = `
{
Expand Down
1 change: 1 addition & 0 deletions apps/infra/test/stack.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { App, assertions } from "aws-cdk-lib";
import { expect, test } from "vitest";
import { PortfolioStack } from "../lib/portfolio-stack";

test("Match with snapshot", () => {
Expand Down
2 changes: 2 additions & 0 deletions apps/infra/test/website.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, test, describe } from "vitest";

describe("Check if website is available", () => {
const domain = "mellevanderlinde.com";

Expand Down
2 changes: 1 addition & 1 deletion apps/infra/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"exclude": [
"node_modules",
"cdk.out",
"jest.config.ts"
"**/*.test.ts"
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Match footer 1`] = `
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Match blog 1`] = `
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "vitest";
import { render } from "@testing-library/react";
import { Header1 } from "@app/components/header";
import { Navbar } from "@app/components/nav";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "vitest";
import { render } from "@testing-library/react";
import Home from "@app/page";
import Projects from "@app/projects/page";
Expand Down
12 changes: 0 additions & 12 deletions apps/website/jest.config.ts

This file was deleted.

10 changes: 5 additions & 5 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"build": "next build",
"dev": "open http://localhost:3000 && next dev --turbopack",
"lint": "eslint .",
"test": "jest",
"test:update": "jest -u"
"test": "vitest run",
"test:update": "vitest run -u"
},
"dependencies": {
"@types/node": "^22.10.3",
Expand All @@ -26,10 +26,10 @@
"devDependencies": {
"@tailwindcss/typography": "^0.5.15",
"@testing-library/react": "^16.1.0",
"@types/jest": "^29.5.14",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"eslint-config": "workspace:*",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0"
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^2.1.8"
}
}
10 changes: 10 additions & 0 deletions apps/website/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
plugins: [tsconfigPaths(), react()],
test: {
environment: "jsdom",
},
});
1 change: 1 addition & 0 deletions packages/reading-time/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, it } from "vitest";
import { getReadingTime } from "./index";

const sentence = "This is an example sentence. ";
Expand Down
9 changes: 0 additions & 9 deletions packages/reading-time/jest.config.ts

This file was deleted.

8 changes: 3 additions & 5 deletions packages/reading-time/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
"scripts": {
"build": "tsc --build --clean",
"lint": "eslint .",
"test": "jest"
"test": "vitest run"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"eslint-config": "workspace:*",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"vitest": "^2.1.8"
}
}
3 changes: 1 addition & 2 deletions packages/reading-time/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true
},
"exclude": ["jest.config.ts"]
}
}
Loading

0 comments on commit e263f21

Please sign in to comment.