Skip to content

Commit

Permalink
Add unit tests for OpenAPI generator
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama committed Jan 13, 2024
1 parent 3c87518 commit c019544
Show file tree
Hide file tree
Showing 18 changed files with 1,805 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "0.1.3",
"private": true,
"scripts": {
"build": "next build && pnpm build:index",
"build": "pnpm build:openapi && next build && pnpm build:index",
"build:index": "node ./update-index.mjs",
"build:openapi": "node ./generate-docs.mjs",
"build:shaders": "glslx shaders/rain.glsl --output=shaders/rain.min.js --format=js --renaming=internal-only",
"dev": "next dev",
"generate:openapi": "node ./generate-docs.mjs",
"lint": "next lint",
"start": "next start"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint:prettier": "prettier --cache --check --ignore-path .gitignore --ignore-path .prettierignore .",
"prettier": "prettier --cache --write --list-different --ignore-path .gitignore --ignore-path .prettierignore .",
"release": "turbo run build --filter=./packages/* && changeset publish",
"test": "turbo run test",
"test": "vitest",
"types:check": "turbo run types:check",
"version": "changeset version && pnpm install --lockfile-only"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/headless/test/page-builder.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest';
import { loader } from '@/source';
import type * as PageTree from '@/server/page-tree';
import { loader } from '../src/source';
import type * as PageTree from '../src/server/page-tree';

describe('Page Tree Builder', () => {
test('Simple', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/headless/test/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
parseFilePath,
parseFolderPath,
splitPath,
} from '@/source/path';
} from '../src/source/path';
import { describe, expect, test } from 'vitest';

describe('Path utilities', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/headless/test/storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { loader } from '@/source';
import { Storage } from '@/source/file-system';
import { parseFilePath, parseFolderPath } from '@/source/path';
import { loader } from '../src/source';
import { Storage } from '../src/source/file-system';
import { parseFilePath, parseFolderPath } from '../src/source/path';
import { describe, expect, test } from 'vitest';

describe('Virtual Storage', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/headless/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "dist"]
}
9 changes: 0 additions & 9 deletions packages/headless/vitest.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions packages/headless/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineProject } from 'vitest/config';

export default defineProject({
resolve: {
alias: {
'@/': new URL('./src/', import.meta.url).pathname,
},
},
});
8 changes: 5 additions & 3 deletions packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
"repository": "github:fuma-nama/next-docs",
"license": "MIT",
"author": "Fuma Nama",
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"fuma-docs-openapi": "./dist/bin.mjs"
"fuma-docs-openapi": "./dist/bin.js"
},
"scripts": {
"build": "tsup",
"clean": "rimraf dist",
"dev": "tsup --watch",
"lint": "eslint .",
"test": "vitest",
"types:check": "tsc --noEmit"
},
"dependencies": {
Expand Down
Loading

0 comments on commit c019544

Please sign in to comment.