Skip to content

Commit 591c30e

Browse files
authored
Merge pull request #172 from authzed/171-use-vitest
Generate ESM code and use vitest for tests
2 parents e29e7a3 + ff91f0b commit 591c30e

41 files changed

Lines changed: 592 additions & 726 deletions

Some content is hidden

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

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: "Lint and Test"
23
on:
34
push:

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
node_modules
22
dist
3-
src/authzedapi/authzed/api/v0
4-
src/authzedapi/authzed/api/v1alpha1
5-
js-dist/src/authzedapi/authzed/api/v0
6-
js-dist/src/authzedapi/authzed/api/v1alpha1
73

84
# Because of how node's dependency management works,
95
# and the fact that a lockfile in a published package
@@ -13,3 +9,4 @@ yarn.lock
139
package-lock.json
1410
js-dist/yarn.lock
1511
js-dist/package-lock.json
12+
js-dist/src

buf.gen.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
---
22
version: "v2"
33
plugins:
4-
- remote: buf.build/community/timostamm-protobuf-ts:v2.9.4
4+
- remote: "buf.build/community/timostamm-protobuf-ts:v2.9.1"
55
out: "src/authzedapi"
6-
opt: generate_dependencies,long_type_string,client_grpc1
6+
opt:
7+
- generate_dependencies
8+
- long_type_string
9+
- client_grpc1
710
inputs:
811
- module: "buf.build/authzed/api:v1.38.0"
12+
paths:
13+
# NOTE: This grabs only the v1 proto and ignores v0 and v1dev.
14+
- "authzed/api/v1"

docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
services:
23
spicedb-servetesting:
34
image: quay.io/authzed/spicedb:latest
@@ -7,4 +8,4 @@ services:
78
test: ["CMD", "/usr/local/bin/grpc_health_probe", "-addr=:50051"]
89
interval: 30s
910
timeout: 30s
10-
retries: 3
11+
retries: 3

jasmine.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

js-dist/jasmine.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

js-dist/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@authzed/authzed-js-node",
33
"author": "authzed",
44
"version": "0.19.0",
5+
"type": "module",
56
"description": "authzed js client for nodejs",
67
"keywords": [
78
"authorization",
@@ -18,14 +19,14 @@
1819
"private": false,
1920
"scripts": {
2021
"test": "../scripts/run-and-test.sh",
21-
"only-run-tests": "jasmine --config=jasmine.json"
22+
"only-run-tests": "vitest"
2223
},
2324
"dependencies": {
2425
"@grpc/grpc-js": "^1.11.3",
2526
"google-protobuf": "^3.15.3"
2627
},
2728
"devDependencies": {
2829
"grpc-tools": "^1.11.2",
29-
"jasmine": "^5.3.0"
30+
"vitest": "^2.1.3"
3031
}
3132
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@authzed/authzed-node",
33
"author": "authzed",
44
"version": "0.19.0",
5+
"type": "module",
56
"description": "authzed client for nodejs",
67
"keywords": [
78
"authorization",
@@ -19,12 +20,12 @@
1920
"private": false,
2021
"scripts": {
2122
"test": "./scripts/run-and-test.sh",
22-
"only-run-tests": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
23-
"buf": "./buf.gen.yaml",
23+
"only-run-tests": "vitest",
24+
"buf": "buf generate && tsc-esm-fix --src src/authzedapi --ext='.js'",
2425
"lint": "./node_modules/.bin/eslint src",
2526
"build": "tsc",
2627
"prepublish": "yarn build",
27-
"build-js-client": "tsc --target es2018 --declaration false --outDir js-dist"
28+
"build-js-client": "tsc --declaration false --outDir js-dist"
2829
},
2930
"dependencies": {
3031
"@grpc/grpc-js": "^1.12.5",
@@ -36,14 +37,13 @@
3637
"@eslint/eslintrc": "^3.2.0",
3738
"@eslint/js": "^9.17.0",
3839
"@protobuf-ts/plugin": "^2.9.4",
39-
"@types/jasmine": "^5.1.5",
40-
"@types/jest": "^29.5.14",
40+
"@tsconfig/node18": "^18.2.4",
4141
"@typescript-eslint/eslint-plugin": "^8.19.0",
4242
"@typescript-eslint/parser": "^8.19.0",
4343
"eslint": "^9.17.0",
4444
"grpc-tools": "^1.12.4",
45-
"jasmine": "^5.5.0",
46-
"ts-node": "^10.9.2",
47-
"typescript": "^5.7"
45+
"tsc-esm-fix": "^3.1.2",
46+
"typescript": "^5.7",
47+
"vitest": "^2.1.3"
4848
}
4949
}

src/authzedapi/authzed/api/materialize/v0/watchpermissions.grpc-client.ts

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/authzedapi/authzed/api/materialize/v0/watchpermissions.ts

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)