Skip to content

Commit

Permalink
Merge pull request #183 from felix-berlin/test/add-unit-tests
Browse files Browse the repository at this point in the history
Test/add unit tests
  • Loading branch information
felix-berlin authored Jan 28, 2024
2 parents ce3cb23 + eff6b2c commit e826dc9
Show file tree
Hide file tree
Showing 21 changed files with 1,384 additions and 224 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Unit tests
on:
pull_request:
push:
branches:
- main
- beta

jobs:
lint:
name: Run unit tests
runs-on: ubuntu-latest

steps:
- name: Setup pnpm 🛠️
uses: pnpm/action-setup@v2
with:
version: 8

- name: Checkout ✅
uses: actions/checkout@v4

- name: Setup Node.js 🔧
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"

- name: Install dependencies 🛠️
run: pnpm i

- name: Run Vitest 🧪
run: pnpm run test:unit

- name: Create coverage report 📝
run: pnpm run test:unit:coverage

- name: Codecov
uses: codecov/[email protected]
with:
directory: ./coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
tests/unit/coverage
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.releaserc
.prettierrc.cjs
.vitest.config.ts
renovate.json
.github
demo
Expand Down
11 changes: 11 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
plugins: [require.resolve("prettier-plugin-astro")],
overrides: [
{
files: "*.astro",
options: {
parser: "astro",
},
},
],
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
![npm](https://img.shields.io/npm/v/astro-breadcrumbs?logo=npm&style=flat-square)
![GitHub package.json version](https://img.shields.io/github/package-json/v/felix-berlin/astro-breadcrumbs?label=github&logo=github&style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/felix-berlin/astro-breadcrumbs/release.yml?label=release&logo=github&style=flat-square)
[![codecov](https://codecov.io/gh/felix-berlin/astro-breadcrumbs/graph/badge.svg?token=8GTWBCTPYZ)](https://codecov.io/gh/felix-berlin/astro-breadcrumbs)
![GitHub file size in bytes](https://img.shields.io/github/size/felix-berlin/astro-breadcrumbs/src/Breadcrumbs.astro?label=component%20size&logo=astro&style=flat-square)
![GitHub file size in bytes](https://img.shields.io/github/size/felix-berlin/astro-breadcrumbs/src/breadcrumbs.css?label=CSS%20Size&logo=CSS3&style=flat-square)
![GitHub file size in bytes](https://img.shields.io/github/size/felix-berlin/astro-breadcrumbs/src/breadcrumbs.scss?label=SCSS%20Size&logo=SASS&style=flat-square)
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@astrojs/starlight": "^0.17.0",
"astro": "^4.2.6",
"astro-breadcrumbs": "^1.8.1",
"astro-breadcrumbs": "^1.9.0",
"astro-matomo": "^1.4.2",
"sharp": "^0.33.2"
},
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"scripts": {
"release": "semantic-release --branches main",
"preinstall": "npx only-allow pnpm"
"test:unit": "vitest --coverage",
"test:unit:coverage": "vitest run --coverage"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -64,7 +65,12 @@
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"semantic-release": "^23.0.0"
"@vitest/coverage-v8": "^1.2.2",
"jsdom": "^24.0.0",
"prettier": "^3.2.4",
"prettier-plugin-astro": "^0.13.0",
"semantic-release": "^23.0.0",
"vitest": "^1.2.2"
},
"peerDependencies": {
"astro": "^2.0.0-beta.0 || ^3.0.0 || ^4.0.0"
Expand Down
Loading

0 comments on commit e826dc9

Please sign in to comment.