Skip to content

Commit e5caeb9

Browse files
authored
Tests (#24)
* add npm badge * add tests * add test workflow * ignore test dist dir * fix release * lint * prettier
1 parent 94b9fa3 commit e5caeb9

17 files changed

+2877
-196
lines changed

.github/workflows/main.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
- uses: pnpm/action-setup@v4
14+
with:
15+
version: 10
16+
- run: pnpm install
17+
- run: pnpm lint
18+
- run: pnpm format
19+
- run: pnpm build
20+
- run: pnpm test

.github/workflows/release.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ name: Release
44
on:
55
push:
66
tags:
7-
- '*'
7+
- "*"
88

99
jobs:
1010
publish:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@v4
15-
- run: npm publish
16-
env:
17-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
- uses: pnpm/action-setup@v4
16+
with:
17+
version: 10
18+
- run: pnpm install
19+
- run: pnpm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm-lock.yaml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Weaviate Agents JS/TS client <img alt='Weaviate logo' src='https://weaviate.io/img/site/weaviate-logo-light.png' width='148' align='right' />
1+
# Weaviate Agents JS/TS client <img alt='Weaviate logo' src='https://weaviate.io/img/site/weaviate-logo-light.png' width='148' align='right' /> &middot; [![npm version](https://img.shields.io/npm/v/weaviate-agents)](https://www.npmjs.com/package/weaviate-agents)
22

33
JS/TS client for Weaviate Agents.
44

eslint.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import js from "@eslint/js";
22
import globals from "globals";
33
import tseslint from "typescript-eslint";
4-
import { defineConfig } from "eslint/config";
5-
4+
import { defineConfig, globalIgnores } from "eslint/config";
65

76
export default defineConfig([
87
{ files: ["**/*.{ts}"], plugins: { js }, extends: ["js/recommended"] },
98
{ files: ["**/*.{ts}"], languageOptions: { globals: globals.node } },
109
tseslint.configs.recommended,
10+
globalIgnores(["dist"]),
1111
{
1212
rules: {
13-
'@typescript-eslint/naming-convention': [
14-
'error',
15-
{
16-
selector: 'default',
17-
format: ['camelCase', 'PascalCase'],
18-
},
19-
{
20-
selector: ['objectLiteralProperty', 'typeProperty'],
21-
format: null,
22-
},
23-
],
13+
"@typescript-eslint/naming-convention": [
14+
"error",
15+
{
16+
selector: "default",
17+
format: ["camelCase", "PascalCase"],
18+
},
19+
{
20+
selector: ["objectLiteralProperty", "typeProperty"],
21+
format: null,
22+
},
23+
],
2424
},
2525
},
2626
]);

jest.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createDefaultPreset } from "ts-jest";
2+
3+
/** @type {import("jest").Config} **/
4+
export default {
5+
...createDefaultPreset(),
6+
moduleNameMapper: {
7+
"^(\\.{1,2}/.*)\\.js$": "$1",
8+
},
9+
testPathIgnorePatterns: ["dist"],
10+
};

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"node": ">=20.0.0"
99
},
1010
"scripts": {
11+
"lint": "eslint",
12+
"format": "prettier --check .",
1113
"build": "tsc",
14+
"test": "jest",
1215
"prepack": "pnpm build"
1316
},
1417
"repository": {
@@ -28,9 +31,13 @@
2831
},
2932
"devDependencies": {
3033
"@eslint/js": "^9.26.0",
34+
"@types/jest": "^30.0.0",
3135
"eslint": "^9.26.0",
3236
"globals": "^16.1.0",
37+
"jest": "^30.0.4",
38+
"prettier": "^3.6.2",
39+
"ts-jest": "^29.4.0",
3340
"typescript": "^5.8.3",
3441
"typescript-eslint": "^8.32.1"
3542
}
36-
}
43+
}

0 commit comments

Comments
 (0)