From ded6afccf21f0f6804fa5ff8bd7e5be6275092d5 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 24 Apr 2024 14:52:05 -0400 Subject: fix(publish): --dry-publish should error for gitignored excluded files (#23540) Files that were gitignored only were not included in the diagnostic. --- tests/specs/jsr/excluded_export_module/publish.out | 4 ++-- tests/specs/publish/dry_run_gitignored/__test__.jsonc | 14 ++++++++++++++ tests/specs/publish/dry_run_gitignored/deno.json | 5 +++++ tests/specs/publish/dry_run_gitignored/gitignored.ts | 0 tests/specs/publish/dry_run_gitignored/mod.out | 11 +++++++++++ tests/specs/publish/dry_run_gitignored/mod.ts | 1 + 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tests/specs/publish/dry_run_gitignored/__test__.jsonc create mode 100644 tests/specs/publish/dry_run_gitignored/deno.json create mode 100644 tests/specs/publish/dry_run_gitignored/gitignored.ts create mode 100644 tests/specs/publish/dry_run_gitignored/mod.out create mode 100644 tests/specs/publish/dry_run_gitignored/mod.ts (limited to 'tests') diff --git a/tests/specs/jsr/excluded_export_module/publish.out b/tests/specs/jsr/excluded_export_module/publish.out index bcf94e521..bb17a3305 100644 --- a/tests/specs/jsr/excluded_export_module/publish.out +++ b/tests/specs/jsr/excluded_export_module/publish.out @@ -3,14 +3,14 @@ Checking for slow types in the public API... Check file:///[WILDLINE]/main.ts error[excluded-module]: module in package's module graph was excluded from publishing --> [WILDLINE]excluded_file1.ts - = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file + = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore info: excluded modules referenced via a package export will error at runtime due to not existing in the package docs: https://jsr.io/go/excluded-module error[excluded-module]: module in package's module graph was excluded from publishing --> [WILDLINE]excluded_file2.ts - = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file + = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore info: excluded modules referenced via a package export will error at runtime due to not existing in the package docs: https://jsr.io/go/excluded-module diff --git a/tests/specs/publish/dry_run_gitignored/__test__.jsonc b/tests/specs/publish/dry_run_gitignored/__test__.jsonc new file mode 100644 index 000000000..aea49eba3 --- /dev/null +++ b/tests/specs/publish/dry_run_gitignored/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [{ + "args": [ + "eval", + "Deno.writeTextFileSync('.gitignore', 'gitignored.ts')" + ], + "output": "[WILDCARD]" + }, { + "args": "publish --dry-run", + "output": "mod.out", + "exitCode": 1 + }] +} diff --git a/tests/specs/publish/dry_run_gitignored/deno.json b/tests/specs/publish/dry_run_gitignored/deno.json new file mode 100644 index 000000000..fe4300ad6 --- /dev/null +++ b/tests/specs/publish/dry_run_gitignored/deno.json @@ -0,0 +1,5 @@ +{ + "name": "@scope/pkg", + "version": "1.0.0", + "exports": "./mod.ts" +} diff --git a/tests/specs/publish/dry_run_gitignored/gitignored.ts b/tests/specs/publish/dry_run_gitignored/gitignored.ts new file mode 100644 index 000000000..e69de29bb diff --git a/tests/specs/publish/dry_run_gitignored/mod.out b/tests/specs/publish/dry_run_gitignored/mod.out new file mode 100644 index 000000000..32010bf6c --- /dev/null +++ b/tests/specs/publish/dry_run_gitignored/mod.out @@ -0,0 +1,11 @@ +Check file:///[WILDLINE]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDLINE]/mod.ts +error[excluded-module]: module in package's module graph was excluded from publishing + --> [WILDLINE]gitignored.ts + = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore + + info: excluded modules referenced via a package export will error at runtime due to not existing in the package + docs: https://jsr.io/go/excluded-module + +error: Found 1 problem diff --git a/tests/specs/publish/dry_run_gitignored/mod.ts b/tests/specs/publish/dry_run_gitignored/mod.ts new file mode 100644 index 000000000..52c6e4a8a --- /dev/null +++ b/tests/specs/publish/dry_run_gitignored/mod.ts @@ -0,0 +1 @@ +import "./gitignored.ts"; -- cgit v1.2.3