diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-02-06 19:21:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 19:21:26 -0500 |
commit | e54684864dee1c708325570eaaff2fce0f928387 (patch) | |
tree | 02c4b8800cb281b8cd3ccdd4e7f4c974b2a55105 /cli/tests/integration/publish_tests.rs | |
parent | 1007358768584856ac63dffaa82fdb00bf726bd9 (diff) |
fix(publish): handle diagnostic outside graph (#22310)
Hacky quick fix. The real fix is a lot more work to do (move the
`SourceTextInfo` into all the diagnostics in order to make this less
error pone). I've already started on it, but it will require a lot of
downstream create changes.
Closes #22288
Diffstat (limited to 'cli/tests/integration/publish_tests.rs')
-rw-r--r-- | cli/tests/integration/publish_tests.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/tests/integration/publish_tests.rs b/cli/tests/integration/publish_tests.rs index b15ca5f89..28c57e010 100644 --- a/cli/tests/integration/publish_tests.rs +++ b/cli/tests/integration/publish_tests.rs @@ -97,6 +97,32 @@ fn publish_non_exported_files_using_import_map() { .any(|l| l.contains("Unfurling") && l.ends_with("other.ts"))); } +#[test] +fn publish_warning_not_in_graph() { + let context = publish_context_builder().build(); + let temp_dir = context.temp_dir().path(); + temp_dir.join("deno.json").write_json(&json!({ + "name": "@foo/bar", + "version": "1.0.0", + "exports": "./mod.ts", + })); + // file not in the graph that uses a non-analyzable dynamic import (cause a diagnostic) + let other_ts = temp_dir.join("_other.ts"); + other_ts + .write("const nonAnalyzable = './_other.ts'; await import(nonAnalyzable);"); + let mod_ts = temp_dir.join("mod.ts"); + mod_ts.write( + "export function test(a: number, b: number): number { return a + b; }", + ); + context + .new_command() + .args("publish --token 'sadfasdf'") + .run() + .assert_matches_text( + "[WILDCARD]unable to analyze dynamic import[WILDCARD]", + ); +} + itest!(javascript_missing_decl_file { args: "publish --token 'sadfasdf'", output: "publish/javascript_missing_decl_file.out", |