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

template: @types/supertest ^6.0.0 #1366

Merged
merged 12 commits into from
Jan 3, 2024
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
16 changes: 16 additions & 0 deletions .changeset/five-baboons-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'skuba': patch
---

lint: Disable `Promise<void>` return checks in tests

This works around an [existing incompatibility](https://github.com/koajs/koa/issues/1755) between Koa and the built-in `http.RequestListener` type:

```typescript
const app = new Koa();

const agent = supertest.agent(app.callback());
// ~~~~~~~~~~~~~~
// Promise returned in function argument where a void return was expected.
// @typescript-eslint/no-misused-promises
```
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"lint": "pnpm run --silent skuba lint && pnpm run --silent lint:md",
"lint:md": "remark --frail --quiet .",
"release": "pnpm run --silent build && changeset publish",
"skuba": "pnpm run --silent build && node --env-file=.env lib/skuba",
"skuba": "pnpm run --silent build && pnpm run --silent skuba:exec",
"skuba:exec": "node --env-file=.env lib/skuba",
"stage": "changeset version && pnpm run format",
"test": "pnpm run --silent skuba test --selectProjects unit",
"test:ci": "pnpm run --silent skuba test --runInBand",
Expand Down Expand Up @@ -81,7 +82,7 @@
"enquirer": "^2.3.6",
"esbuild": "~0.19.0",
"eslint": "^8.11.0",
"eslint-config-skuba": "3.0.4",
"eslint-config-skuba": "3.1.0",
"execa": "^5.0.0",
"fdir": "^6.0.0",
"fs-extra": "^11.0.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions scripts/test-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ fi

directory="tmp-${template}"

types_jest="@types/jest@$(jq --raw-output '.dependencies."@types/jest"' < package.json)"

echo '--- cleanup'
rm -rf "${directory}" "../${directory}"

Expand All @@ -19,11 +21,8 @@ pnpm install --frozen-lockfile
echo '--- pnpm run build'
pnpm run build

echo '--- pnpm link --global'
pnpm link --global

echo "--- skuba init ${template}"
skuba init << EOF
pnpm run skuba:exec init << EOF
{
"destinationDir": "${directory}",
"templateComplete": true,
Expand All @@ -50,10 +49,14 @@ mv "${directory}" "../${directory}"

cd "../${directory}" || exit 1

# @types/jest doesn't seem to get hoisted correctly when linking with pnpm.
echo "--- pnpm add --save-dev ../skuba ${types_jest}"
pnpm add --save-dev ../skuba "${types_jest}"

echo "--- skuba version ${template}"
skuba version
skuba -v
skuba --version
pnpm exec skuba version
pnpm exec skuba -v
pnpm exec skuba --version

set +e
echo "--- pnpm run build ${template}"
Expand Down
2 changes: 0 additions & 2 deletions src/wrapper/testing/httpServerRequestListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const app = new Koa().use((ctx) => {
}
});

// FIXME: https://github.com/koajs/koa/issues/1755
// eslint-disable-next-line @typescript-eslint/no-misused-promises
const httpServer = http.createServer(app.callback());

Object.assign(httpServer, {
Expand Down
2 changes: 1 addition & 1 deletion template/express-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"devDependencies": {
"@types/express": "^4.17.13",
"@types/node": "^20.9.0",
"@types/supertest": "^2.0.11",
"@types/supertest": "^6.0.0",
"pino-pretty": "^10.0.0",
"skuba": "*",
"supertest": "^6.1.6"
Expand Down
2 changes: 1 addition & 1 deletion template/koa-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/koa-bodyparser": "^5.0.2",
"@types/koa__router": "^12.0.0",
"@types/node": "^20.9.0",
"@types/supertest": "^2.0.11",
"@types/supertest": "^6.0.0",
"chance": "^1.1.8",
"pino-pretty": "^10.0.0",
"skuba": "*",
Expand Down