summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/publish_tests.rs9
-rw-r--r--tests/testdata/publish/package_json.out8
-rw-r--r--tests/testdata/publish/package_json/deno.json8
-rw-r--r--tests/testdata/publish/package_json/mod.ts9
-rw-r--r--tests/testdata/publish/package_json/package.json7
-rw-r--r--tests/util/server/src/lib.rs8
6 files changed, 49 insertions, 0 deletions
diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs
index 71bc838a8..e8eda5010 100644
--- a/tests/integration/publish_tests.rs
+++ b/tests/integration/publish_tests.rs
@@ -3,6 +3,7 @@
use deno_core::serde_json::json;
use test_util::assert_contains;
use test_util::assert_not_contains;
+use test_util::env_vars_for_jsr_npm_tests;
use test_util::env_vars_for_jsr_tests;
use test_util::env_vars_for_npm_tests;
use test_util::itest;
@@ -147,6 +148,14 @@ itest!(javascript_decl_file {
exit_code: 0,
});
+itest!(package_json {
+ args: "publish --token 'sadfasdf'",
+ output: "publish/package_json.out",
+ cwd: Some("publish/package_json"),
+ envs: env_vars_for_jsr_npm_tests(),
+ http_server: true,
+});
+
itest!(successful {
args: "publish --token 'sadfasdf'",
output: "publish/successful.out",
diff --git a/tests/testdata/publish/package_json.out b/tests/testdata/publish/package_json.out
new file mode 100644
index 000000000..7b54ce8da
--- /dev/null
+++ b/tests/testdata/publish/package_json.out
@@ -0,0 +1,8 @@
+Download http://localhost:4545/npm/registry/picocolors
+Download http://localhost:4545/npm/registry/picocolors/picocolors-1.0.0.tgz
+Check file:///[WILDCARD]/publish/package_json/mod.ts
+Checking for slow types in the public API...
+Check file:///[WILDCARD]/publish/package_json/mod.ts
+Publishing @foo/bar@1.0.0 ...
+Successfully published @foo/bar@1.0.0
+Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details
diff --git a/tests/testdata/publish/package_json/deno.json b/tests/testdata/publish/package_json/deno.json
new file mode 100644
index 000000000..6e2826ef5
--- /dev/null
+++ b/tests/testdata/publish/package_json/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "@foo/bar",
+ "version": "1.0.0",
+ "exports": {
+ ".": "./mod.ts"
+ },
+ "nodeModulesDir": false
+}
diff --git a/tests/testdata/publish/package_json/mod.ts b/tests/testdata/publish/package_json/mod.ts
new file mode 100644
index 000000000..ae98962fa
--- /dev/null
+++ b/tests/testdata/publish/package_json/mod.ts
@@ -0,0 +1,9 @@
+import pc from "picocolors";
+
+export function add(a: number, b: number): number {
+ return a + b;
+}
+
+export function getValue(): string {
+ return pc.green("hey");
+}
diff --git a/tests/testdata/publish/package_json/package.json b/tests/testdata/publish/package_json/package.json
new file mode 100644
index 000000000..c1b171f4c
--- /dev/null
+++ b/tests/testdata/publish/package_json/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@deno/foo",
+ "version": "0.0.1",
+ "dependencies": {
+ "picocolors": "*"
+ }
+}
diff --git a/tests/util/server/src/lib.rs b/tests/util/server/src/lib.rs
index ead05641d..9a0323433 100644
--- a/tests/util/server/src/lib.rs
+++ b/tests/util/server/src/lib.rs
@@ -64,6 +64,14 @@ pub fn env_vars_for_jsr_tests() -> Vec<(String, String)> {
]
}
+pub fn env_vars_for_jsr_npm_tests() -> Vec<(String, String)> {
+ vec![
+ ("NPM_CONFIG_REGISTRY".to_string(), npm_registry_url()),
+ ("JSR_URL".to_string(), jsr_registry_url()),
+ ("NO_COLOR".to_string(), "1".to_string()),
+ ]
+}
+
pub fn root_path() -> PathRef {
PathRef::new(
PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR")))