fix + ci: fix table type + setup unit test ci (#130)

1. Added tsc type check to app lint cmd so it would capture type errors going forward (ex: regression from this PR 03f78dde12)
2. Run app unit tests
This commit is contained in:
Warren 2023-11-28 14:32:04 -08:00 committed by GitHub
parent b047798e7d
commit e42b78fe53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 6 deletions

View file

@ -30,6 +30,20 @@ jobs:
vector --version
- name: Run lint + type check
run: make ci-lint
unit:
timeout-minutes: 8
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install root dependencies
uses: bahmutov/npm-install@v1
- name: Run unit tests
run: make ci-unit
integration:
timeout-minutes: 8
runs-on: ubuntu-20.04

View file

@ -25,11 +25,11 @@ dev-down:
.PHONY: dev-lint
dev-lint:
./docker/ingestor/run_linting.sh && yarn workspaces run lint
./docker/ingestor/run_linting.sh && npx nx run-many -t lint
.PHONY: ci-lint
ci-lint:
./docker/ingestor/run_linting.sh && yarn workspaces run ci:lint
./docker/ingestor/run_linting.sh && npx nx run-many -t ci:lint
.PHONY: dev-int
dev-int:
@ -40,6 +40,14 @@ dev-int:
ci-int:
docker compose -p int -f ./docker-compose.ci.yml run --rm api ci:int
.PHONY: dev-unit
dev-unit:
npx nx run-many -t dev:unit
.PHONY: ci-unit
ci-unit:
npx nx run-many -t ci:unit
.PHONY: build-local
build-local:
docker build ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target prod &

View file

@ -11,8 +11,8 @@
"build": "next build",
"start": "next start",
"lint": "eslint . --ext .ts,.tsx",
"ci:lint": "yarn lint",
"ci:unit": "jest --coverage"
"ci:lint": "yarn lint && yarn tsc --noEmit",
"ci:unit": "jest --ci --coverage"
},
"dependencies": {
"@hyperdx/browser": "^0.18.4",

View file

@ -10,7 +10,7 @@ import { UNDEFINED_WIDTH } from '../tableUtils';
import styles from './Table.module.scss';
type TableProps<T extends Record<string, unknown>> = {
type TableProps<T extends Record<string, unknown> | string[]> = {
data?: T[];
columns: ColumnDef<T>[];
emptyMessage?: string;
@ -20,7 +20,7 @@ type TableProps<T extends Record<string, unknown>> = {
interactive?: boolean;
};
export const Table = <T extends Record<string, unknown>>({
export const Table = <T extends Record<string, unknown> | string[]>({
data = [],
columns,
emptyMessage,