Skip to content

Commit f4be8bc

Browse files
authored
tests(run): add spec tests for non-executable entrypoints (#34779)
Adds characterization spec tests for two `deno run` error paths where the command-line entrypoint can't be executed as an ES module. The existing run specs cover missing modules and import-*statement* resolution, but not these entrypoint cases. New spec dir `tests/specs/run/entrypoint_errors`: | entrypoint | error | | --- | --- | | a directory | `ERR_UNSUPPORTED_DIR_IMPORT` (no index resolution for file: ESM entrypoints, even when the dir contains a module) | | a `.json` file | rejected — JSON needs an explicit `with { type: "json" }` attribute, which a bare entrypoint can't supply | Each asserts exit code 1 and the error output (the directory path is wildcarded). Test-only change; no runtime behavior is affected.
1 parent d23528d commit f4be8bc

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"tests": {
3+
"directory_entrypoint": {
4+
"args": "run subdir",
5+
"output": "error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file://[WILDCARD]/subdir' is not supported resolving ES modules\n",
6+
"exitCode": 1
7+
},
8+
"json_entrypoint": {
9+
"args": "run data.json",
10+
"output": "error: Attempted to load JSON module without specifying \"type\": \"json\" attribute in the import statement.\n",
11+
"exitCode": 1
12+
}
13+
}
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "name": "x" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("hi");

0 commit comments

Comments
 (0)