summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-26 16:41:16 +0100
committerGitHub <noreply@github.com>2024-01-26 16:41:16 +0100
commit9e0495baa7565737b8f1d66348b45bbed14831e0 (patch)
tree34bdb85953a4821b8f66bd08874fb8147f931d6b /cli/tests
parentc66f7b6d8d1d7481eee91d9ff898fd4eaddfdeea (diff)
fix: make deprecation warnings less verbose (#22128)
This commit makes deprecation warnings less verbose by default. Only a single warnings is issued per deprecated API use. `DENO_VERBOSE_WARNINGS` env var can be provided to enable more detailed logging for each use of API including a stack trace. https://github.com/denoland/deno/assets/13602871/9c036c84-0044-4cb6-9c8e-deb641f43712
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/run_tests.rs8
-rw-r--r--cli/tests/testdata/run/warn_on_deprecated_api/main.out41
-rw-r--r--cli/tests/testdata/run/warn_on_deprecated_api/main.verbose.out55
3 files changed, 64 insertions, 40 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index b8acce94d..b4ce77f0c 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -5099,6 +5099,14 @@ itest!(warn_on_deprecated_api {
exit_code: 0,
});
+itest!(warn_on_deprecated_api_verbose {
+ args: "run -A run/warn_on_deprecated_api/main.js",
+ output: "run/warn_on_deprecated_api/main.verbose.out",
+ envs: vec![("DENO_VERBOSE_WARNINGS".to_string(), "1".to_string())],
+ http_server: true,
+ exit_code: 0,
+});
+
itest!(warn_on_deprecated_api_with_flag {
args: "run -A --quiet run/warn_on_deprecated_api/main.js",
output: "run/warn_on_deprecated_api/main_disabled_flag.out",
diff --git a/cli/tests/testdata/run/warn_on_deprecated_api/main.out b/cli/tests/testdata/run/warn_on_deprecated_api/main.out
index c0944b3df..ff44c885f 100644
--- a/cli/tests/testdata/run/warn_on_deprecated_api/main.out
+++ b/cli/tests/testdata/run/warn_on_deprecated_api/main.out
@@ -1,38 +1,8 @@
Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
-warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
-
-Stack trace:
- at [WILDCARD]warn_on_deprecated_api/main.js:3:16
-
-hint: Use "Deno.Command()" API instead.
-
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
hello world
-warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
-
-Stack trace:
- at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
- at [WILDCARD]warn_on_deprecated_api/main.js:25:7
-
-hint: Use "Deno.Command()" API instead.
-
hello world
-warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
-
-Stack trace:
- at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
- at [WILDCARD]warn_on_deprecated_api/main.js:26:7
-
-hint: Use "Deno.Command()" API instead.
-
hello world
-warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
-
-Stack trace:
- at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
- at [WILDCARD]warn_on_deprecated_api/main.js:29:9
-
-hint: Use "Deno.Command()" API instead.
-
hello world
hello world
hello world
@@ -43,13 +13,4 @@ hello world
hello world
hello world
hello world
-warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
-
-Stack trace:
- at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
- at [WILDCARD]warn_on_deprecated_api/main.js:32:7
-
-hint: Use "Deno.Command()" API instead.
-hint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.
-
hello world
diff --git a/cli/tests/testdata/run/warn_on_deprecated_api/main.verbose.out b/cli/tests/testdata/run/warn_on_deprecated_api/main.verbose.out
new file mode 100644
index 000000000..c0944b3df
--- /dev/null
+++ b/cli/tests/testdata/run/warn_on_deprecated_api/main.verbose.out
@@ -0,0 +1,55 @@
+Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+Stack trace:
+ at [WILDCARD]warn_on_deprecated_api/main.js:3:16
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:25:7
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:26:7
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+Stack trace:
+ at runEcho ([WILDCARD]warn_on_deprecated_api/main.js:14:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:29:9
+
+hint: Use "Deno.Command()" API instead.
+
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+hello world
+warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
+
+Stack trace:
+ at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
+ at [WILDCARD]warn_on_deprecated_api/main.js:32:7
+
+hint: Use "Deno.Command()" API instead.
+hint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.
+
+hello world