Skip to content

Commit

Permalink
Add tsd for testing types (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
silas authored Oct 25, 2024
1 parent 3e81b54 commit b234a6e
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ jobs:
- name: Install
run: pnpm install

- name: Types
run: pnpm types

- name: Test
run: pnpm test
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"./lib"
],
"dependencies": {
"papi": "^1.1.0",
"uuid": "^10.0.0"
"papi": "^1.1.0"
},
"devDependencies": {
"@types/node": "^22.7.6",
Expand All @@ -22,12 +21,14 @@
"prettier": "^3.3.3",
"should": "^13.2.1",
"sinon": "^19.0.2",
"temp": "^0.9.4"
"temp": "^0.9.4",
"tsd": "^0.31.2",
"uuid": "^10.0.0"
},
"scripts": {
"format": "prettier -w .",
"test": "jshint lib test && prettier -c . && nyc mocha -- --recursive --check-leaks && nyc check-coverage --statements 100 --functions 100 --branches 100 --lines 100",
"types": "dtslint test/types",
"types": "tsd",
"acceptance": "ACCEPTANCE=true nyc mocha -- test/acceptance --recursive --check-leaks --timeout 30000",
"acceptanceSetupMacOS": "sudo ifconfig lo0 alias 127.0.0.2 up && sudo ifconfig lo0 alias 127.0.0.3 up"
},
Expand Down
607 changes: 604 additions & 3 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test-d/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { expectType } from "tsd";

import Consul from "../lib";

const consul = new Consul();

expectType<Consul>(consul);
6 changes: 0 additions & 6 deletions test/types/.eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions test/types/index.d.ts

This file was deleted.

15 changes: 0 additions & 15 deletions test/types/tsconfig.json

This file was deleted.

6 changes: 0 additions & 6 deletions test/types/type-tests.ts

This file was deleted.

0 comments on commit b234a6e

Please sign in to comment.