Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ref: dedicated environment for issue #952 test #1356

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ yarn-error.log
coverage
tests/**/yarn.lock
tests/**/quick-start.ts
tests/**/issue952.*
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ node_modules
dist
coverage
tests/**/quick-start.ts
tests/**/issue952.*
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"start": "yarn tsnode example/index.ts",
"build": "yarn build:compile && yarn build:tests && yarn build:assets",
"build:compile": "tsup && attw --pack",
"build:tests": "yarn build:int && yarn build:esm && yarn build:vi",
"build:tests": "yarn cleanup && yarn build:int && yarn build:952 && yarn build:esm && yarn build:vi",
"build:int": "yarn tsnode tools/integration-test.ts && yarn install --cwd ./tests/integration",
"build:952": "yarn tsnode tools/issue952-test.ts && yarn install --cwd ./tests/issue952",
"build:esm": "yarn tsnode tools/esm-test.ts && yarn install --cwd ./tests/esm",
"build:vi": "yarn install --cwd ./tests/vitest",
"build:assets": "yarn build:swagger && yarn build:client && yarn build:license",
Expand All @@ -31,7 +32,7 @@
"build:logo": "yarn tsnode tools/startup-logo.ts",
"test": "yarn test:types && yarn test:jest && yarn test:badge",
"test:int": "jest ./tests/integration",
"test:952": "yarn --cwd tests/integration tsc -p tsconfig.issue952.json && rm tests/integration/issue952.d.ts",
"test:952": "yarn --cwd ./tests/issue952 test",
"test:esm": "jest ./tests/esm",
"test:vi": "yarn --cwd ./tests/vitest test",
"test:u": "yarn test:jest -u && yarn test:badge",
Expand All @@ -40,6 +41,7 @@
"test:badge": "make-coverage-badge --output-path ./coverage.svg",
"lint": "eslint src example tests tools && yarn prettier *.md --check",
"mdfix": "prettier *.md --write",
"cleanup": "rm -rf tests/**/node_modules",
"tsnode": "node -r @swc-node/register",
"precommit": "yarn build && yarn lint && yarn test && git add example/example.swagger.yaml example/example.client.ts ./LICENSE ./coverage.svg",
"prepublishOnly": "yarn build && yarn lint && yarn test",
Expand Down
2 changes: 1 addition & 1 deletion tests/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"dependencies": {
"express-zod-api": "../..",
"express-zod-api": "link:../..",
"express": "^4",
"http-errors": "^2",
"typescript": "^5",
Expand Down
5 changes: 1 addition & 4 deletions tests/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
"private": true,
"version": "0.0.0",
"dependencies": {
"express-zod-api": "../..",
"express-zod-api": "link:../..",
"express": "^4",
"http-errors": "^2",
"typescript": "^5",
"zod": "^3"
},
"devDependencies": {
"@types/express": "^4"
}
}
19 changes: 19 additions & 0 deletions tests/issue952/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "express-zod-api-issue-952-test",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "tsc -p tsconfig.json",
"posttest": "rm quick-start.d.ts"
},
"dependencies": {
"express-zod-api": "link:../..",
"express": "^4",
"http-errors": "^2",
"typescript": "^5",
"zod": "^3"
},
"devDependencies": {
"@types/express": "^4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["issue952.ts"],
"exclude": ["quick*.ts"]
"include": ["*.ts"]
}
4 changes: 0 additions & 4 deletions tools/integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ import { extractReadmeQuickStart } from "./extract-quick-start";

const quickStart = extractReadmeQuickStart();

/** @link https://github.com/RobinTail/express-zod-api/issues/952 */
const issue952 = quickStart.replace(/const/g, "export const");

const dir = "./tests/integration";
writeFileSync(`${dir}/quick-start.ts`, quickStart.trim());
writeFileSync(`${dir}/issue952.ts`, issue952.trim());
10 changes: 10 additions & 0 deletions tools/issue952-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { writeFileSync } from "node:fs";
import { extractReadmeQuickStart } from "./extract-quick-start";

const quickStart = extractReadmeQuickStart();

/** @link https://github.com/RobinTail/express-zod-api/issues/952 */
const issue952 = quickStart.replace(/const/g, "export const");

const dir = "./tests/issue952";
writeFileSync(`${dir}/quick-start.ts`, issue952.trim());