Skip to content

Commit

Permalink
fix: make some warnings more standard (#25324)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Sep 3, 2024
1 parent 3f6740c commit bf7571a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cli/npm/managed/resolvers/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,9 @@ async fn sync_resolution_with_fs(
.map(|(_, p)| format!("npm:{p}"))
.collect::<Vec<_>>()
.join(", ");
log::warn!("{}: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
log::warn!("{} Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):\n {packages}", crate::colors::yellow("warning"));
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):\n {packages}", crate::colors::yellow("Warning"));
for (scripts_warned_path, _) in packages_with_scripts_not_run {
let _ignore_err = fs::write(scripts_warned_path, "");
}
Expand Down
2 changes: 1 addition & 1 deletion cli/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ impl<'a> deno_graph::source::NpmResolver for WorkerCliNpmGraphResolver<'a> {
let line = start.line + 1;
let column = start.character + 1;
if !*DENO_DISABLE_PEDANTIC_NODE_WARNINGS {
log::warn!("Warning: Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{line}:{column}. If you want to use a built-in Node module, add a \"node:\" prefix.")
log::warn!("{} Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{line}:{column}. If you want to use a built-in Node module, add a \"node:\" prefix.", colors::yellow("Warning"))
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4632,15 +4632,15 @@ itest!(node_prefix_missing {

itest!(node_prefix_missing_unstable_bare_node_builtins_enbaled {
args: "run --unstable-bare-node-builtins run/node_prefix_missing/main.ts",
output: "run/node_prefix_missing/main.ts.out_feature_enabled",
output: "run/node_prefix_missing/feature_enabled.out",
envs: env_vars_for_npm_tests(),
exit_code: 0,
});

itest!(
node_prefix_missing_unstable_bare_node_builtins_enbaled_by_env {
args: "run run/node_prefix_missing/main.ts",
output: "run/node_prefix_missing/main.ts.out_feature_enabled",
output: "run/node_prefix_missing/feature_enabled.out",
envs: [
env_vars_for_npm_tests(),
vec![(
Expand All @@ -4655,14 +4655,14 @@ itest!(

itest!(node_prefix_missing_unstable_bare_node_builtins_enbaled_by_config {
args: "run --config=run/node_prefix_missing/config.json run/node_prefix_missing/main.ts",
output: "run/node_prefix_missing/main.ts.out_feature_enabled",
output: "run/node_prefix_missing/feature_enabled.out",
envs: env_vars_for_npm_tests(),
exit_code: 0,
});

itest!(node_prefix_missing_unstable_bare_node_builtins_enbaled_with_import_map {
args: "run --unstable-bare-node-builtins --import-map run/node_prefix_missing/import_map.json run/node_prefix_missing/main.ts",
output: "run/node_prefix_missing/main.ts.out_feature_enabled",
output: "run/node_prefix_missing/feature_enabled.out",
envs: env_vars_for_npm_tests(),
exit_code: 0,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Download http://localhost:4260/@denotest/bin/1.0.0.tgz
Initialize @denotest/node-lifecycle-scripts@1.0.0
Initialize @denotest/bin@1.0.0
[UNORDERED_END]
warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
Warning Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):
npm:@denotest/node-lifecycle-scripts@1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Download http://localhost:4260/@denotest/bin/1.0.0.tgz
Initialize @denotest/node-lifecycle-scripts@1.0.0
Initialize @denotest/bin@1.0.0
[UNORDERED_END]
warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
Warning Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):
npm:@denotest/node-lifecycle-scripts@1.0.0
2 changes: 1 addition & 1 deletion tests/specs/npm/lifecycle_scripts/node_gyp_not_run.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Download http://localhost:4260/@denotest/node-addon
Download http://localhost:4260/node-gyp
[WILDCARD]
warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
Warning Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):
npm:@denotest/node-addon@1.0.0
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/npm/lifecycle_scripts/only_warns_first1.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Download http://localhost:4260/@denotest/bin/1.0.0.tgz
Initialize @denotest/node-lifecycle-scripts@1.0.0
Initialize @denotest/bin@1.0.0
[UNORDERED_END]
warning: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
Warning Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):
npm:@denotest/node-lifecycle-scripts@1.0.0
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/publish/bare_node_builtins/bare_node_builtins.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
Download http://localhost:4260/@types/node
Download http://localhost:4260/@types/node/node-18.16.19.tgz
Check file:///[WILDLINE]/mod.ts
Expand Down
2 changes: 2 additions & 0 deletions tests/testdata/run/node_prefix_missing/feature_enabled.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[WILDCARD]Warning Resolving "fs" as "node:fs" at file:///[WILDCARD]/tests/testdata/run/node_prefix_missing/main.ts:1:16. If you want to use a built-in Node module, add a "node:" prefix.
[Function: writeFile]

This file was deleted.

0 comments on commit bf7571a

Please sign in to comment.