-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from abikart/main
feat(tests): setup
- Loading branch information
Showing
14 changed files
with
2,270 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: PR Checks | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.18.0' | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: '9.12.1' | ||
|
||
- name: Install Dependencies | ||
run: pnpm install | ||
|
||
- name: Build Common Package | ||
run: pnpm common build | ||
|
||
- name: Test Common Package | ||
run: pnpm common test | ||
|
||
- name: Test Frontend | ||
run: pnpm frontend test | ||
|
||
- name: Upload Coverage Reports | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-reports | ||
path: | | ||
apps/frontend/coverage/ | ||
packages/common/coverage/ | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.18.0' | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: '9.12.1' | ||
|
||
- name: Install Dependencies | ||
run: pnpm install | ||
|
||
- name: Run Biome Check | ||
run: pnpm check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, expect, it } from "vitest"; | ||
import App from "./App"; | ||
|
||
describe("App", () => { | ||
it("renders hello world", () => { | ||
render(<App />); | ||
expect(screen.getByText(/hello world/i)).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { isBlank, hello } from "common"; | ||
import { hello, isBlank } from "common"; | ||
|
||
const App = () => { | ||
return ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import "@testing-library/jest-dom"; | ||
import { cleanup } from "@testing-library/react"; | ||
import { afterEach } from "vitest"; | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { defineConfig } from "vite"; | ||
import react from "@vitejs/plugin-react-swc"; | ||
import { defineConfig } from "vite"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
base: process.env.GITHUB_PAGES // Set base URL for GitHub Pages | ||
? "/starter/" // Replace with your actual repository name | ||
: "/", | ||
test: { | ||
globals: true, | ||
environment: "jsdom", | ||
setupFiles: ["./src/test/setup.ts"], | ||
coverage: { | ||
provider: "v8", | ||
reporter: ["text", "json", "html"], | ||
exclude: ["node_modules/", "src/test/setup.ts"], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default { extends: ['@commitlint/config-conventional'] }; | ||
export default { extends: ["@commitlint/config-conventional"] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { hello } from "./main"; | ||
|
||
describe("hello", () => { | ||
it("returns hello", () => { | ||
expect(hello()).toBe("Hello World"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { defineConfig } from "vite"; | ||
import { resolve } from "node:path"; | ||
import dts from "vite-plugin-dts"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
build: { lib: { entry: resolve(__dirname, "src/main.ts"), formats: ["es"] } }, | ||
resolve: { alias: { src: resolve("src/") } }, | ||
plugins: [dts()], | ||
build: { | ||
lib: { | ||
entry: "src/main.ts", | ||
formats: ["es"], | ||
fileName: "common", | ||
}, | ||
}, | ||
test: { | ||
coverage: { | ||
provider: "v8", | ||
reporter: ["text", "json", "html"], | ||
exclude: ["node_modules/"], | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.