summaryrefslogtreecommitdiff
path: root/tests/integration/pm_tests.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2024-03-06 13:24:15 +0000
committerGitHub <noreply@github.com>2024-03-06 13:24:15 +0000
commit01bc2f530ea311a231f19b8f620b6cc9f94f0886 (patch)
tree1d448eeb12050cab8a7a10ea23432c9e6829af26 /tests/integration/pm_tests.rs
parent8b1f160bb58a36a6f75759165f91de8c5c7afe06 (diff)
feat(unstable/pm): support npm packages in 'deno add' (#22715)
Diffstat (limited to 'tests/integration/pm_tests.rs')
-rw-r--r--tests/integration/pm_tests.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/integration/pm_tests.rs b/tests/integration/pm_tests.rs
index cc5527c40..668519bdc 100644
--- a/tests/integration/pm_tests.rs
+++ b/tests/integration/pm_tests.rs
@@ -2,9 +2,7 @@
use deno_core::serde_json::json;
use test_util::assert_contains;
-use test_util::env_vars_for_jsr_tests;
-// use test_util::env_vars_for_npm_tests;
-// use test_util::itest;
+use test_util::env_vars_for_jsr_npm_tests;
use test_util::TestContextBuilder;
#[test]
@@ -110,21 +108,24 @@ fn add_multiple() {
}
#[test]
-fn add_not_supported_npm() {
+fn add_npm() {
let context = pm_context_builder().build();
+ let temp_dir = context.temp_dir().path();
- let output = context
- .new_command()
- .args("add @denotest/add npm:express")
- .run();
- output.assert_exit_code(1);
+ let output = context.new_command().args("add npm:chalk@4.1").run();
+ output.assert_exit_code(0);
let output = output.combined_output();
- assert_contains!(output, "error: Adding npm: packages is currently not supported. Package: npm:express");
+ assert_contains!(output, "Add chalk");
+ temp_dir.join("deno.json").assert_matches_json(json!({
+ "imports": {
+ "chalk": "npm:chalk@^4.1.2"
+ }
+ }));
}
fn pm_context_builder() -> TestContextBuilder {
TestContextBuilder::new()
.use_http_server()
- .envs(env_vars_for_jsr_tests())
+ .envs(env_vars_for_jsr_npm_tests())
.use_temp_cwd()
}