mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 11:53:59 -05:00
fix(cli): don't ignore diagnostics about for await (#12116)
Fixes #12115
This commit is contained in:
parent
00948a6d68
commit
99de9eb4c2
4 changed files with 30 additions and 3 deletions
|
@ -622,6 +622,12 @@ itest!(error_026_remote_import_error {
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(error_for_await {
|
||||||
|
args: "run --reload error_for_await.ts",
|
||||||
|
output: "error_for_await.ts.out",
|
||||||
|
exit_code: 1,
|
||||||
|
});
|
||||||
|
|
||||||
itest!(error_missing_module_named_import {
|
itest!(error_missing_module_named_import {
|
||||||
args: "run --reload error_missing_module_named_import.ts",
|
args: "run --reload error_missing_module_named_import.ts",
|
||||||
output: "error_missing_module_named_import.ts.out",
|
output: "error_missing_module_named_import.ts.out",
|
||||||
|
|
14
cli/tests/testdata/error_for_await.ts
vendored
Normal file
14
cli/tests/testdata/error_for_await.ts
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const listener = Deno.listen({ port: 8080 });
|
||||||
|
|
||||||
|
for await (const conn of listener) {
|
||||||
|
handleConn(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConn(conn: Deno.Conn) {
|
||||||
|
const httpConn = Deno.serveHttp(conn);
|
||||||
|
for await (const event of httpConn) {
|
||||||
|
event.respondWith(new Response("html", { status: 200 }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
10
cli/tests/testdata/error_for_await.ts.out
vendored
Normal file
10
cli/tests/testdata/error_for_await.ts.out
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[WILDCARD]
|
||||||
|
error: TS1103 [ERROR]: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
||||||
|
for await (const event of httpConn) {
|
||||||
|
~~~~~
|
||||||
|
at [WILDCARD]error_for_await.ts:9:7
|
||||||
|
|
||||||
|
TS1356 [ERROR]: Did you mean to mark this function as 'async'?
|
||||||
|
function handleConn(conn: Deno.Conn) {
|
||||||
|
~~~~~~~~~~
|
||||||
|
at [WILDCARD]error_for_await.ts:7:10
|
|
@ -148,9 +148,6 @@ delete Object.prototype.__proto__;
|
||||||
// when that file is a module, but this file has no imports or exports.
|
// when that file is a module, but this file has no imports or exports.
|
||||||
// Consider adding an empty 'export {}' to make this file a module.
|
// Consider adding an empty 'export {}' to make this file a module.
|
||||||
1375,
|
1375,
|
||||||
// TS1103: 'for-await-of' statement is only allowed within an async function
|
|
||||||
// or async generator.
|
|
||||||
1103,
|
|
||||||
// TS2306: File 'file:///Users/rld/src/deno/cli/tests/testdata/subdir/amd_like.js' is
|
// TS2306: File 'file:///Users/rld/src/deno/cli/tests/testdata/subdir/amd_like.js' is
|
||||||
// not a module.
|
// not a module.
|
||||||
2306,
|
2306,
|
||||||
|
|
Loading…
Add table
Reference in a new issue