mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
test: run js_unit_tests with --unstable-*
flags (#25394)
This commit is contained in:
parent
5ee671311a
commit
0e0a5c24ea
3 changed files with 44 additions and 25 deletions
|
@ -722,26 +722,27 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
||||||
target,
|
target,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO(bartlomieju): this is not ideal, but because we use `ObjectAssign`
|
||||||
|
// above any properties that are defined elsewhere using `Object.defineProperty`
|
||||||
|
// are lost.
|
||||||
|
let jupyterNs = undefined;
|
||||||
|
ObjectDefineProperty(finalDenoNs, "jupyter", {
|
||||||
|
get() {
|
||||||
|
if (jupyterNs) {
|
||||||
|
return jupyterNs;
|
||||||
|
}
|
||||||
|
throw new Error(
|
||||||
|
"Deno.jupyter is only available in `deno jupyter` subcommand.",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
jupyterNs = val;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// TODO(bartlomieju): deprecate --unstable
|
// TODO(bartlomieju): deprecate --unstable
|
||||||
if (unstableFlag) {
|
if (unstableFlag) {
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstable);
|
ObjectAssign(finalDenoNs, denoNsUnstable);
|
||||||
// TODO(bartlomieju): this is not ideal, but because we use `ObjectAssign`
|
|
||||||
// above any properties that are defined elsewhere using `Object.defineProperty`
|
|
||||||
// are lost.
|
|
||||||
let jupyterNs = undefined;
|
|
||||||
ObjectDefineProperty(finalDenoNs, "jupyter", {
|
|
||||||
get() {
|
|
||||||
if (jupyterNs) {
|
|
||||||
return jupyterNs;
|
|
||||||
}
|
|
||||||
throw new Error(
|
|
||||||
"Deno.jupyter is only available in `deno jupyter` subcommand.",
|
|
||||||
);
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
jupyterNs = val;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i <= unstableFeatures.length; i++) {
|
for (let i = 0; i <= unstableFeatures.length; i++) {
|
||||||
const id = unstableFeatures[i];
|
const id = unstableFeatures[i];
|
||||||
|
|
|
@ -83,7 +83,7 @@ pub static UNSTABLE_GRANULAR_FLAGS: &[UnstableGranularFlag] = &[
|
||||||
UnstableGranularFlag {
|
UnstableGranularFlag {
|
||||||
name: ops::http::UNSTABLE_FEATURE_NAME,
|
name: ops::http::UNSTABLE_FEATURE_NAME,
|
||||||
help_text: "Enable unstable HTTP APIs",
|
help_text: "Enable unstable HTTP APIs",
|
||||||
show_in_help: false,
|
show_in_help: true,
|
||||||
id: 5,
|
id: 5,
|
||||||
},
|
},
|
||||||
UnstableGranularFlag {
|
UnstableGranularFlag {
|
||||||
|
|
|
@ -116,22 +116,40 @@ util::unit_test_factory!(
|
||||||
fn js_unit_test(test: String) {
|
fn js_unit_test(test: String) {
|
||||||
let _g = util::http_server();
|
let _g = util::http_server();
|
||||||
|
|
||||||
let deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
.current_dir(util::root_path())
|
.current_dir(util::root_path())
|
||||||
.arg("test")
|
.arg("test")
|
||||||
.arg("--config")
|
.arg("--config")
|
||||||
.arg(util::deno_config_path())
|
.arg(util::deno_config_path())
|
||||||
.arg("--no-lock")
|
.arg("--no-lock")
|
||||||
.arg("--unstable")
|
// TODO(bartlomieju): would be better if we could apply this unstable
|
||||||
|
// flag to particular files, but there's many of them that rely on unstable
|
||||||
|
// net APIs (`reusePort` in `listen` and `listenTls`; `listenDatagram`, `createHttpClient`)
|
||||||
|
.arg("--unstable-net")
|
||||||
|
.arg("--unstable-http")
|
||||||
.arg("--location=http://127.0.0.1:4545/")
|
.arg("--location=http://127.0.0.1:4545/")
|
||||||
.arg("--no-prompt");
|
.arg("--no-prompt");
|
||||||
|
|
||||||
|
if test == "broadcast_channel_test" {
|
||||||
|
deno = deno.arg("--unstable-broadcast-channel");
|
||||||
|
}
|
||||||
|
|
||||||
|
if test == "cron_test" {
|
||||||
|
deno = deno.arg("--unstable-cron");
|
||||||
|
}
|
||||||
|
|
||||||
|
if test.contains("kv_") {
|
||||||
|
deno = deno.arg("--unstable-kv");
|
||||||
|
}
|
||||||
|
|
||||||
|
if test == "worker_permissions_test" || test == "worker_test" {
|
||||||
|
deno = deno.arg("--unstable-worker-options");
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(mmastrac): it would be better to just load a test CA for all tests
|
// TODO(mmastrac): it would be better to just load a test CA for all tests
|
||||||
let deno = if test == "websocket_test" || test == "tls_sni_test" {
|
if test == "websocket_test" || test == "tls_sni_test" {
|
||||||
deno.arg("--unsafely-ignore-certificate-errors")
|
deno = deno.arg("--unsafely-ignore-certificate-errors");
|
||||||
} else {
|
}
|
||||||
deno
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut deno = deno
|
let mut deno = deno
|
||||||
.arg("-A")
|
.arg("-A")
|
||||||
|
|
Loading…
Reference in a new issue