Skip to content

Commit caa4428

Browse files
committed
Add unit test
1 parent 188d5c0 commit caa4428

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.github/workflows/publish-to-npm-on-new-release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
with:
1414
node-version: 16
1515
registry-url: https://registry.npmjs.org
16+
- name: Unit Testing
17+
run: npm run test
18+
1619
- name: Update version
1720
run: |
1821
git config --global user.name "mayank1513"

__tests__/test_export.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { expectTypeOf, test } from "vitest";
2+
import reactUseClientPlugin from "../dist/index";
3+
import pluginFromSrc from "../src/index";
4+
5+
test("plugin types work properly", () => {
6+
expectTypeOf(reactUseClientPlugin).toMatchTypeOf(pluginFromSrc);
7+
});

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"scripts": {
1212
"build": "tsc && node createPackageJSON.js",
13+
"test": "vitest run",
1314
"publish-package": "npm run build && cp README.md dist/README.md && cd dist && npm publish && cd ..",
1415
"publish-gpr": "node prepGPR.js && cd dist && npm publish"
1516
},
@@ -36,6 +37,7 @@
3637
"devDependencies": {
3738
"@types/node": "^18",
3839
"esbuild": "^0.18.17",
39-
"typescript": "^5.1.6"
40+
"typescript": "^5.1.6",
41+
"vitest": "^0.34.1"
4042
}
4143
}

0 commit comments

Comments
 (0)