Skip to content

Commit e1bae63

Browse files
committed
test: add coverage tests
1 parent 92aa697 commit e1bae63

10 files changed

Lines changed: 1090 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
publish:
10+
name: Publish npm package
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Use Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: pnpm
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: 9
31+
run_install: false
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Build
37+
run: pnpm run build
38+
39+
- name: Run tests
40+
run: pnpm run test
41+
42+
- name: Publish to npm
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
run: |
46+
pnpm publish --access public --no-git-checks

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Human-friendly numeric pattern codes for OTP, SMS, 2FA, etc.",
55
"author": {
66
"name": "TeaCoder",
7-
"url": "https://teaocder.ru"
7+
"url": "https://teacoder.ru"
88
},
99
"license": "UNLICENSED",
1010
"main": "./dist/index.cjs",
@@ -23,7 +23,10 @@
2323
],
2424
"scripts": {
2525
"clean": "rm -rf dist",
26-
"build": "tsup"
26+
"build": "tsup",
27+
"test": "vitest",
28+
"test:coverage": "vitest run --coverage",
29+
"test:ci": "vitest run"
2730
},
2831
"keywords": [
2932
"otp",

0 commit comments

Comments
 (0)