Skip to content

Commit 816297e

Browse files
committed
chore: setup test
1 parent c7827c1 commit 816297e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3154
-69
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
*.snap

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "@antfu/eslint-config",
3+
"env": {
4+
"jest": true
5+
},
36
"rules": {
47
"@typescript-eslint/no-unused-vars": "off"
58
}

.github/workflows/test.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
pull_request:
10+
branches:
11+
- main
12+
- master
13+
14+
jobs:
15+
build:
16+
runs-on: ${{ matrix.os }}
17+
18+
strategy:
19+
matrix:
20+
node-version: [12.x, 14.x]
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
fail-fast: false
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
32+
- name: Setup
33+
run: npm i -g pnpm @antfu/ni
34+
35+
- name: Install
36+
run: nci
37+
38+
- name: Lint
39+
run: nr lint --if-present
40+
41+
- name: Test
42+
run: nr test --if-present

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-workspace-root-check=true

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

jest.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
roots: [
3+
'<rootDir>',
4+
],
5+
testMatch: [
6+
'**/__tests__/**/*.+(ts|tsx|js)',
7+
'**/?(*.)+(spec|test).+(ts|tsx|js)',
8+
],
9+
transform: {
10+
'^.+\\.(ts|tsx)$': 'ts-jest',
11+
},
12+
}

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
],
2020
"scripts": {
2121
"dev": "npm run build -- --watch",
22-
"example:dev": "npm -C example/vue3 run dev",
23-
"example:build": "npm -C example/vue3 run build",
22+
"example:dev": "npm -C examples/vue3 run dev",
23+
"example:build": "npm -C examples/vue3 run build",
2424
"build": "tsup src/index.ts --dts --format cjs,esm",
2525
"prepublishOnly": "npm run build",
26-
"release": "npx git-ensure -a && npx bumpp --commit --tag --push"
26+
"release": "npx git-ensure -a && npx bumpp --commit --tag --push",
27+
"test": "jest",
28+
"test:update": "jest --u"
2729
},
2830
"dependencies": {
2931
"chokidar": "^3.5.1",
@@ -41,8 +43,10 @@
4143
"@types/node": "^14.14.31",
4244
"@typescript-eslint/eslint-plugin": "^4.15.2",
4345
"eslint": "^7.20.0",
46+
"jest": "^26.6.3",
4447
"rollup": "^2.39.1",
4548
"standard-version": "^9.1.1",
49+
"ts-jest": "^26.5.2",
4650
"tsup": "^4.2.0",
4751
"typescript": "^4.1.5",
4852
"vite": "^2.0.2"

0 commit comments

Comments
 (0)