chore: use same test server for jsr tests (#22303)

We had two test servers.
This commit is contained in:
David Sherret 2024-02-06 21:06:34 -05:00 committed by GitHub
parent 043fee48fd
commit 227ec14e6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 87 additions and 83 deletions

View file

@ -3,18 +3,10 @@
use deno_core::serde_json::json;
use test_util::assert_contains;
use test_util::assert_not_contains;
use test_util::env_vars_for_jsr_tests;
use test_util::env_vars_for_npm_tests;
use test_util::TestContextBuilder;
static TEST_REGISTRY_URL: &str = "http://127.0.0.1:4250";
pub fn env_vars_for_registry() -> Vec<(String, String)> {
vec![(
"DENO_REGISTRY_URL".to_string(),
TEST_REGISTRY_URL.to_string(),
)]
}
itest!(no_token {
args: "publish",
cwd: Some("publish/missing_deno_json"),
@ -40,7 +32,9 @@ itest!(no_zap {
args: "publish --no-zap --token 'sadfasdf'",
output: "publish/no_zap.out",
cwd: Some("publish/invalid_fast_check"),
exit_code: 1,
envs: env_vars_for_jsr_tests(),
http_server: true,
exit_code: 0,
});
itest!(invalid_path {
@ -127,7 +121,7 @@ itest!(javascript_missing_decl_file {
args: "publish --token 'sadfasdf'",
output: "publish/javascript_missing_decl_file.out",
cwd: Some("publish/javascript_missing_decl_file"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
exit_code: 0,
http_server: true,
});
@ -136,7 +130,7 @@ itest!(unanalyzable_dynamic_import {
args: "publish --token 'sadfasdf'",
output: "publish/unanalyzable_dynamic_import.out",
cwd: Some("publish/unanalyzable_dynamic_import"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
exit_code: 0,
http_server: true,
});
@ -145,7 +139,7 @@ itest!(javascript_decl_file {
args: "publish --token 'sadfasdf'",
output: "publish/javascript_decl_file.out",
cwd: Some("publish/javascript_decl_file"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
exit_code: 0,
});
@ -154,7 +148,7 @@ itest!(successful {
args: "publish --token 'sadfasdf'",
output: "publish/successful.out",
cwd: Some("publish/successful"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
});
@ -162,7 +156,7 @@ itest!(node_specifier {
args: "publish --token 'sadfasdf'",
output: "publish/node_specifier.out",
cwd: Some("publish/node_specifier"),
envs: env_vars_for_registry()
envs: env_vars_for_jsr_tests()
.into_iter()
.chain(env_vars_for_npm_tests().into_iter())
.collect(),
@ -173,7 +167,7 @@ itest!(config_file_jsonc {
args: "publish --token 'sadfasdf'",
output: "publish/deno_jsonc.out",
cwd: Some("publish/deno_jsonc"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
});
@ -181,7 +175,7 @@ itest!(workspace_all {
args: "publish --token 'sadfasdf'",
output: "publish/workspace.out",
cwd: Some("publish/workspace"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
});
@ -189,7 +183,7 @@ itest!(workspace_individual {
args: "publish --token 'sadfasdf'",
output: "publish/workspace_individual.out",
cwd: Some("publish/workspace/bar"),
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
});
@ -197,7 +191,7 @@ itest!(dry_run {
args: "publish --token 'sadfasdf' --dry-run",
cwd: Some("publish/successful"),
output: "publish/dry_run.out",
envs: env_vars_for_registry(),
envs: env_vars_for_jsr_tests(),
http_server: true,
});
@ -278,6 +272,6 @@ fn includes_directories() {
fn publish_context_builder() -> TestContextBuilder {
TestContextBuilder::new()
.use_http_server()
.envs(env_vars_for_registry())
.envs(env_vars_for_jsr_tests())
.use_temp_cwd()
}

View file

@ -1059,8 +1059,8 @@ fn lock_deno_json_package_json_deps() {
}
},
"remote": {
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
},
"workspace": {
"dependencies": [
@ -1109,8 +1109,8 @@ fn lock_deno_json_package_json_deps() {
}
},
"remote": {
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
},
"workspace": {
"dependencies": [
@ -1141,8 +1141,8 @@ fn lock_deno_json_package_json_deps() {
}
},
"remote": {
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts": "5b0ce36e08d759118200d8b4627627b5a89b6261fbb0598e6961a6b287abb699",
"http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts": "9ce27ca439cb0e218b6e1ec26c043dbc0b54c9babc4cb432df478dd1721faade"
},
"workspace": {
"dependencies": [

View file

@ -1,13 +1,13 @@
Download http://localhost:4545/jsr/registry/@denotest/deps/meta.json
Download http://localhost:4545/jsr/registry/@denotest/deps/1.0.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json
Download http://127.0.0.1:4250/@denotest/deps/meta.json
Download http://127.0.0.1:4250/@denotest/deps/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1_meta.json
[UNORDERED_START]
Download http://localhost:4545/jsr/registry/@denotest/deps/1.0.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/TestClass.ts
Download http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts
[UNORDERED_END]
{ version: "0.1.1", other: Other {} }

View file

@ -1,14 +1,14 @@
Download http://localhost:4545/jsr/registry/@denotest/deps/meta.json
Download http://localhost:4545/jsr/registry/@denotest/deps/1.0.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1_meta.json
Download http://127.0.0.1:4250/@denotest/deps/meta.json
Download http://127.0.0.1:4250/@denotest/deps/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1_meta.json
[UNORDERED_START]
Download http://localhost:4545/jsr/registry/@denotest/deps/1.0.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/TestClass.ts
Download http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts
[UNORDERED_END]
local: [WILDCARD]main.ts
type: TypeScript
@ -16,7 +16,7 @@ dependencies: 4 unique
size: [WILDCARD]
file:///[WILDCARD]main.ts ([WILDCARD])
└─┬ http://localhost:4545/jsr/registry/@denotest/deps/1.0.0/mod.ts ([WILDCARD])
├── http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts ([WILDCARD])
└─┬ http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/mod.ts ([WILDCARD])
└── http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.1/TestClass.ts ([WILDCARD])
└─┬ http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts ([WILDCARD])
├── http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts ([WILDCARD])
└─┬ http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts ([WILDCARD])
└── http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts ([WILDCARD])

View file

@ -1,7 +1,7 @@
Download http://localhost:4545/jsr/registry/@denotest/module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0_meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json
[UNORDERED_START]
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts
[UNORDERED_END]
Test { other: Other {} }

View file

@ -1,8 +1,8 @@
Download http://localhost:4545/jsr/registry/@denotest/module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0_meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json
[UNORDERED_START]
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts
Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts
[UNORDERED_END]
local: [WILDCARD]main.ts
type: TypeScript
@ -10,5 +10,5 @@ dependencies: 2 unique
size: [WILDCARD]
file:///[WILDCARD]/module_graph/main.ts ([WILDCARD])
└─┬ http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/mod.ts ([WILDCARD])
└── http://localhost:4545/jsr/registry/@denotest/module_graph/1.4.0/other.ts ([WILDCARD])
└─┬ http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts ([WILDCARD])
└── http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts ([WILDCARD])

View file

@ -1,6 +1,6 @@
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/TestClass.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0_meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts
0.1.0
TestClass {}

View file

@ -1,12 +1,12 @@
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/TestClass.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0_meta.json
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts
Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts
local: [WILDCARD]main.ts
type: TypeScript
dependencies: 2 unique
size: [WILDCARD]
file:///[WILDCARD]/jsr/no_module_graph/main.ts ([WILDCARD])
└─┬ http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/mod.ts ([WILDCARD])
└── http://localhost:4545/jsr/registry/@denotest/no_module_graph/0.1.0/TestClass.ts ([WILDCARD])
└─┬ http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts ([WILDCARD])
└── http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts ([WILDCARD])

View file

@ -1,16 +1,16 @@
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph/meta.json
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph_invalid/meta.json
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph/0.1.0_meta.json
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph_invalid/0.1.0_meta.json
Download http://127.0.0.1:4250/@denotest/subset_type_graph/meta.json
Download http://127.0.0.1:4250/@denotest/subset_type_graph_invalid/meta.json
Download http://127.0.0.1:4250/@denotest/subset_type_graph/0.1.0_meta.json
Download http://127.0.0.1:4250/@denotest/subset_type_graph_invalid/0.1.0_meta.json
[UNORDERED_START]
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph/0.1.0/mod.ts
Download http://localhost:4545/jsr/registry/@denotest/subset_type_graph_invalid/0.1.0/mod.ts
Download http://127.0.0.1:4250/@denotest/subset_type_graph/0.1.0/mod.ts
Download http://127.0.0.1:4250/@denotest/subset_type_graph_invalid/0.1.0/mod.ts
[UNORDERED_END]
Check file:///[WILDCARD]/subset_type_graph/main.ts
error: TS2322 [ERROR]: Type 'string' is not assignable to type 'number'.
const invalidTypeCheck: number = "";
~~~~~~~~~~~~~~~~
at http://localhost:4545/jsr/registry/@denotest/subset_type_graph_invalid/0.1.0/mod.ts:11:7
at http://127.0.0.1:4250/@denotest/subset_type_graph_invalid/0.1.0/mod.ts:11:7
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
const error1: string = new Foo1().method();
@ -30,7 +30,7 @@ new Foo1().method2();
'method' is declared here.
method(): number {
~~~~~~
at http://localhost:4545/jsr/registry/@denotest/subset_type_graph/0.1.0/mod.ts:8:3
at http://127.0.0.1:4250/@denotest/subset_type_graph/0.1.0/mod.ts:8:3
TS2551 [ERROR]: Property 'method2' does not exist on type 'Foo'. Did you mean 'method'?
new Foo2().method2();
@ -40,6 +40,6 @@ new Foo2().method2();
'method' is declared here.
method() {
~~~~~~
at http://localhost:4545/jsr/registry/@denotest/subset_type_graph_invalid/0.1.0/mod.ts:2:3
at http://127.0.0.1:4250/@denotest/subset_type_graph_invalid/0.1.0/mod.ts:2:3
Found 5 errors.

View file

@ -1,4 +1,4 @@
Download http://localhost:4545/jsr/registry/@denotest/deps/meta.json
Download http://127.0.0.1:4250/@denotest/deps/meta.json
error: Could not find constraint in the list of versions: @denotest/deps@0.1.4
Specifier: jsr:@denotest/deps@0.1.4/mod.ts
at file:///[WILDCARD]/version_not_found/main.ts:1:19

View file

@ -1,4 +1,5 @@
Ensuring type checks...
Check file:///[WILDCARD]/mod.ts
error: Following packages don't exist, follow the links and create them:
- https://jsr.io/new?scope=foo&package=bar&from=cli
Publishing @foo/bar@1.1.0 ...
Successfully published @foo/bar@1.1.0
Visit http://127.0.0.1:4250/@foo/bar@1.1.0 for details

View file

@ -24,6 +24,7 @@ use crate::env_vars_for_jsr_tests;
use crate::env_vars_for_npm_tests;
use crate::fs::PathRef;
use crate::http_server;
use crate::jsr_registry_unset_url;
use crate::lsp::LspClientBuilder;
use crate::npm_registry_unset_url;
use crate::pty::Pty;
@ -686,6 +687,9 @@ impl TestCommandBuilder {
if !envs.contains_key("DENO_NO_UPDATE_CHECK") {
envs.insert("DENO_NO_UPDATE_CHECK".to_string(), "1".to_string());
}
if !envs.contains_key("DENO_REGISTRY_URL") {
envs.insert("DENO_REGISTRY_URL".to_string(), jsr_registry_unset_url());
}
for key in &self.envs_remove {
envs.remove(key);
}

View file

@ -100,7 +100,11 @@ pub fn npm_registry_unset_url() -> String {
}
pub fn jsr_registry_url() -> String {
"http://localhost:4545/jsr/registry/".to_string()
"http://127.0.0.1:4250/".to_string()
}
pub fn jsr_registry_unset_url() -> String {
"http://DENO_REGISTRY_URL.is.unset".to_string()
}
pub fn std_path() -> PathRef {
@ -441,6 +445,7 @@ pub fn deno_cmd_with_deno_dir(deno_dir: &TempDir) -> TestCommandBuilder {
TestCommandBuilder::new(deno_dir.clone())
.env("DENO_DIR", deno_dir.path())
.env("NPM_CONFIG_REGISTRY", npm_registry_unset_url())
.env("DENO_REGISTRY_URL", jsr_registry_unset_url())
}
pub fn run_powershell_script_file(