-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix another issue with TypeScript default exports
- Loading branch information
Showing
6 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/project-setups/typescript-nodenext-commonjs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"type": "commonjs", | ||
"scripts": { | ||
"helmet:test": "ts-node-esm --compilerOptions '{\"module\": \"nodenext\", \"moduleResolution\": \"nodenext\"}' test.ts" | ||
} | ||
} |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...t-setups/typescript-nodenext/package.json → ...tups/typescript-nodenext-esm/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { IncomingMessage, ServerResponse } from "http"; | ||
import connect from "connect"; | ||
import supertest from "supertest"; | ||
import helmet, { frameguard } from "helmet"; | ||
|
||
const handler = (_: IncomingMessage, res: ServerResponse) => | ||
res.end("Hello world"); | ||
|
||
async function testTopLevel() { | ||
const app = connect().use(helmet()).use(handler); | ||
await supertest(app) | ||
.get("/") | ||
.expect(200, "Hello world") | ||
.expect("x-download-options", "noopen"); | ||
} | ||
|
||
async function testImportedMiddleware() { | ||
const app = connect().use(frameguard()).use(handler); | ||
await supertest(app) | ||
.get("/") | ||
.expect(200, "Hello world") | ||
.expect("x-frame-options", "SAMEORIGIN"); | ||
} | ||
|
||
async function testAttachedMiddleware() { | ||
const app = connect().use(helmet.frameguard()).use(handler); | ||
await supertest(app) | ||
.get("/") | ||
.expect(200, "Hello world") | ||
.expect("x-frame-options", "SAMEORIGIN"); | ||
} | ||
|
||
async function main() { | ||
await testTopLevel(); | ||
await testImportedMiddleware(); | ||
await testAttachedMiddleware(); | ||
} | ||
|
||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |