mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
tests: enable wpt for url (#9046)
This commit is contained in:
parent
feff6361b1
commit
66e99d349b
8 changed files with 551 additions and 9 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -224,6 +224,16 @@ jobs:
|
|||
echo $(git rev-parse HEAD) > canary-latest.txt
|
||||
gsutil cp canary-latest.txt gs://dl.deno.land/canary-latest.txt
|
||||
|
||||
- name: Configure hosts file for WPT (unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: ./wpt make-hosts-file | sudo tee -a /etc/hosts
|
||||
working-directory: test_util/wpt/
|
||||
|
||||
- name: Configure hosts file for WPT (windows)
|
||||
if: runner.os == 'Windows'
|
||||
working-directory: test_util/wpt/
|
||||
run: python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts -Encoding ascii -Append
|
||||
|
||||
- name: Test release
|
||||
if: matrix.kind == 'test_release'
|
||||
run: cargo test --release --locked --all-targets
|
||||
|
|
|
@ -5,6 +5,7 @@ use deno_core::serde_json;
|
|||
use deno_core::url;
|
||||
use deno_runtime::deno_fetch::reqwest;
|
||||
use deno_runtime::deno_websocket::tokio_tungstenite;
|
||||
use std::io::BufReader;
|
||||
use std::io::{BufRead, Write};
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
@ -5249,6 +5250,32 @@ fn jsonc_to_serde(j: jsonc_parser::JsonValue) -> serde_json::Value {
|
|||
}
|
||||
}
|
||||
|
||||
struct WPTServer(std::process::Child);
|
||||
|
||||
impl Drop for WPTServer {
|
||||
fn drop(&mut self) {
|
||||
match self.0.try_wait() {
|
||||
Ok(None) => {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
println!("libc kill");
|
||||
unsafe {
|
||||
libc::kill(self.0.id() as i32, libc::SIGTERM);
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
println!("std kill");
|
||||
self.0.kill().expect("killing 'wpt serve' failed");
|
||||
}
|
||||
let _ = self.0.wait();
|
||||
}
|
||||
Ok(Some(status)) => panic!("'wpt serve' exited unexpectedly {}", status),
|
||||
Err(e) => panic!("'wpt serve' error: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn web_platform_tests() {
|
||||
use deno_core::serde::Deserialize;
|
||||
|
@ -5270,6 +5297,61 @@ fn web_platform_tests() {
|
|||
let config: std::collections::HashMap<String, Vec<WptConfig>> =
|
||||
deno_core::serde_json::from_value(jsonc_to_serde(jsonc)).unwrap();
|
||||
|
||||
// Observation: `python3 wpt serve` hangs with the python3 from homebrew
|
||||
// but works okay with /usr/bin/python, which is python 2.7.10. Observed
|
||||
// with homebrew python 3.8.5, 3.8.7 and 3.9.1.
|
||||
let python = match true {
|
||||
_ if cfg!(target_os = "windows") => "python.exe",
|
||||
_ if cfg!(target_os = "macos") => "python",
|
||||
_ => "python3",
|
||||
};
|
||||
|
||||
eprintln!("If the wpt server fails or gets stuck, please set up your /etc/hosts file like specified in //docs/contributing/building_from_source.md.");
|
||||
|
||||
let mut proc = Command::new(python)
|
||||
.current_dir(util::wpt_path())
|
||||
.arg("wpt.py")
|
||||
.arg("serve")
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let stderr = proc.stderr.as_mut().unwrap();
|
||||
let mut stderr = BufReader::new(stderr).lines();
|
||||
let mut ready_8000 = false;
|
||||
let mut ready_8443 = false;
|
||||
let mut ready_8444 = false;
|
||||
let mut ready_9000 = false;
|
||||
while let Ok(line) = stderr.next().unwrap() {
|
||||
if !line.starts_with("DEBUG:") {
|
||||
eprintln!("{}", line);
|
||||
}
|
||||
if cfg!(target_os = "windows") && line.contains("Using ports") {
|
||||
break;
|
||||
}
|
||||
if line.contains("web-platform.test:8000") {
|
||||
ready_8000 = true;
|
||||
}
|
||||
if line.contains("web-platform.test:8443") {
|
||||
ready_8443 = true;
|
||||
}
|
||||
if line.contains("web-platform.test:8444") {
|
||||
ready_8444 = true;
|
||||
}
|
||||
if line.contains("web-platform.test:9000") {
|
||||
ready_9000 = true;
|
||||
}
|
||||
// WPT + python2 doesn't support HTTP/2.0.
|
||||
if line.contains("Cannot start HTTP/2.0 server") {
|
||||
ready_9000 = true;
|
||||
}
|
||||
if ready_8000 && ready_8443 && ready_8444 && ready_9000 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let _wpt_server = WPTServer(proc);
|
||||
|
||||
for (suite_name, includes) in config.into_iter() {
|
||||
let suite_path = util::wpt_path().join(suite_name);
|
||||
let dir = WalkDir::new(&suite_path)
|
||||
|
@ -5352,14 +5434,15 @@ fn web_platform_tests() {
|
|||
})
|
||||
.collect();
|
||||
|
||||
let mut variants: Vec<&str> = test_file_text
|
||||
let mut variants: Vec<String> = test_file_text
|
||||
.split('\n')
|
||||
.into_iter()
|
||||
.filter_map(|t| t.strip_prefix("// META: variant="))
|
||||
.map(|t| format!("?{}", t))
|
||||
.collect();
|
||||
|
||||
if variants.is_empty() {
|
||||
variants.push("");
|
||||
variants.push("".to_string());
|
||||
}
|
||||
|
||||
for variant in variants {
|
||||
|
@ -5382,11 +5465,19 @@ fn web_platform_tests() {
|
|||
let bundle = concat_bundle(files, file.path(), "".to_string());
|
||||
file.write_all(bundle.as_bytes()).unwrap();
|
||||
|
||||
let self_path = test_file_path.strip_prefix(util::wpt_path()).unwrap();
|
||||
|
||||
let child = util::deno_cmd()
|
||||
.current_dir(test_file_path.parent().unwrap())
|
||||
.arg("run")
|
||||
.arg("--location")
|
||||
.arg(&format!("http://web-platform-tests/?{}", variant))
|
||||
.arg(&format!(
|
||||
"http://web-platform.test:8000/{}{}",
|
||||
self_path.to_str().unwrap(),
|
||||
variant
|
||||
))
|
||||
.arg("--cert")
|
||||
.arg(util::wpt_path().join("tools/certs/cacert.pem"))
|
||||
.arg("-A")
|
||||
.arg(file.path())
|
||||
.arg(deno_core::serde_json::to_string(&expect_fail).unwrap())
|
||||
|
|
|
@ -424,7 +424,7 @@ unitTest(
|
|||
unitTest(
|
||||
{ perms: { net: true } },
|
||||
async function netTcpListenCloseWhileIterating(): Promise<void> {
|
||||
const listener = Deno.listen({ port: 8000 });
|
||||
const listener = Deno.listen({ port: 8001 });
|
||||
const nextWhileClosing = listener[Symbol.asyncIterator]().next();
|
||||
listener.close();
|
||||
assertEquals(await nextWhileClosing, { value: undefined, done: true });
|
||||
|
@ -437,7 +437,7 @@ unitTest(
|
|||
unitTest(
|
||||
{ perms: { net: true } },
|
||||
async function netUdpListenCloseWhileIterating(): Promise<void> {
|
||||
const socket = Deno.listenDatagram({ port: 8000, transport: "udp" });
|
||||
const socket = Deno.listenDatagram({ port: 8001, transport: "udp" });
|
||||
const nextWhileClosing = socket[Symbol.asyncIterator]().next();
|
||||
socket.close();
|
||||
assertEquals(await nextWhileClosing, { value: undefined, done: true });
|
||||
|
|
|
@ -241,5 +241,411 @@
|
|||
"does not inherit from Error: class-side"
|
||||
]
|
||||
}
|
||||
],
|
||||
"url": [
|
||||
"historical",
|
||||
{
|
||||
"name": "url-constructor",
|
||||
"expectFail": [
|
||||
"Parsing: <http://example\t.\norg> against <http://example.org/foo/bar>",
|
||||
"Parsing: <a:\t foo.com> against <http://example.org/foo/bar>",
|
||||
"Parsing: <lolscheme:x x#x x> against <about:blank>",
|
||||
"Parsing: <http://f:00000000000000/c> against <http://example.org/foo/bar>",
|
||||
"Parsing: <http://f:00000000000000000000080/c> against <http://example.org/foo/bar>",
|
||||
"Parsing: <http://f: /c> against <http://example.org/foo/bar>",
|
||||
"Parsing: <http://f: 21 / b ? d # e > against <http://example.org/foo/bar>",
|
||||
"Parsing: <:#> against <http://example.org/foo/bar>",
|
||||
"Parsing: <#> against <http://example.org/foo/bar>",
|
||||
"Parsing: <?> against <http://example.org/foo/bar>",
|
||||
"Parsing: <http://[::127.0.0.1]> against <http://example.org/foo/bar>",
|
||||
"Parsing: <http://[0:0:0:0:0:0:13.1.68.3]> against <http://example.org/foo/bar>",
|
||||
"Parsing: <file:c:\\foo\\bar.html> against <file:///tmp/mock/path>",
|
||||
"Parsing: < File:c|////foo\\bar.html> against <file:///tmp/mock/path>",
|
||||
"Parsing: <C|/foo/bar> against <file:///tmp/mock/path>",
|
||||
"Parsing: </C|\\foo\\bar> against <file:///tmp/mock/path>",
|
||||
"Parsing: <//C|/foo/bar> against <file:///tmp/mock/path>",
|
||||
"Parsing: <file://localhost> against <file:///tmp/mock/path>",
|
||||
"Parsing: <file://localhost/> against <file:///tmp/mock/path>",
|
||||
"Parsing: <file://localhost/test> against <file:///tmp/mock/path>",
|
||||
"Parsing: <http://example.com/foo/%2e> against <about:blank>",
|
||||
"Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>",
|
||||
"Parsing: <http://example.com////../..> against <about:blank>",
|
||||
"Parsing: <http://example.com/foo\t\u0091%91> against <about:blank>",
|
||||
"Parsing: <http://example.com/foo\tbar> against <about:blank>",
|
||||
"Parsing: <http://www.google.com/foo?bar=baz#> against <about:blank>",
|
||||
"Parsing: <http://www/foo/%2E/html> against <about:blank>",
|
||||
"Parsing: <file:..> against <http://www.example.com/test>",
|
||||
"Parsing: <\u0000\u001b\u0004\u0012 http://example.com/\u001f \r > against <about:blank>",
|
||||
"Parsing: <https://%EF%BF%BD> against <about:blank>",
|
||||
"Parsing: <http://[::1.2.3.]> against <http://other.com/>",
|
||||
"Parsing: <http://[::1.2.]> against <http://other.com/>",
|
||||
"Parsing: <http://[::1.]> against <http://other.com/>",
|
||||
"Parsing: <#> against <test:test>",
|
||||
"Parsing: <#> against <test:test?test>",
|
||||
"Parsing: <i> against <sc:sd>",
|
||||
"Parsing: <i> against <sc:sd/sd>",
|
||||
"Parsing: <../i> against <sc:sd>",
|
||||
"Parsing: <../i> against <sc:sd/sd>",
|
||||
"Parsing: </i> against <sc:sd>",
|
||||
"Parsing: </i> against <sc:sd/sd>",
|
||||
"Parsing: <?i> against <sc:sd>",
|
||||
"Parsing: <?i> against <sc:sd/sd>",
|
||||
"Parsing: <sc://@/> against <about:blank>",
|
||||
"Parsing: <sc://te@s:t@/> against <about:blank>",
|
||||
"Parsing: <sc://:/> against <about:blank>",
|
||||
"Parsing: <sc://:12/> against <about:blank>",
|
||||
"Parsing: <sc://\\/> against <about:blank>",
|
||||
"Parsing: <sc:\\../> against <about:blank>",
|
||||
"Parsing: <ftp://%e2%98%83> against <about:blank>",
|
||||
"Parsing: <https://%e2%98%83> against <about:blank>",
|
||||
"Parsing: <h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg> against <about:blank>",
|
||||
"Parsing: <https://0x.0x.0> against <about:blank>",
|
||||
"Parsing: </> against <file://h/C:/a/b>",
|
||||
"Parsing: <//d:> against <file:///C:/a/b>",
|
||||
"Parsing: <//d:/..> against <file:///C:/a/b>",
|
||||
"Parsing: <file:\\\\//> against <about:blank>",
|
||||
"Parsing: <file:\\\\\\\\> against <about:blank>",
|
||||
"Parsing: <file:\\\\\\\\?fox> against <about:blank>",
|
||||
"Parsing: <file:\\\\\\\\#guppy> against <about:blank>",
|
||||
"Parsing: <file://spider///> against <about:blank>",
|
||||
"Parsing: <file:\\\\localhost//> against <about:blank>",
|
||||
"Parsing: <file://\\/localhost//cat> against <about:blank>",
|
||||
"Parsing: <file://localhost//a//../..//> against <about:blank>",
|
||||
"Parsing: </////mouse> against <file:///elephant>",
|
||||
"Parsing: <\\/localhost//pig> against <file://lion/>",
|
||||
"Parsing: <//localhost//pig> against <file://lion/>",
|
||||
"Parsing: <C|> against <file://host/dir/file>",
|
||||
"Parsing: <C|> against <file://host/D:/dir1/dir2/file>",
|
||||
"Parsing: <C|#> against <file://host/dir/file>",
|
||||
"Parsing: <C|?> against <file://host/dir/file>",
|
||||
"Parsing: <C|/> against <file://host/dir/file>",
|
||||
"Parsing: <C|\n/> against <file://host/dir/file>",
|
||||
"Parsing: <C|\\> against <file://host/dir/file>",
|
||||
"Parsing: </c|/foo/bar> against <file:///c:/baz/qux>",
|
||||
"Parsing: </c:/foo/bar> against <file://host/path>",
|
||||
"Parsing: <file://example.net/C:/> against <about:blank>",
|
||||
"Parsing: <file://1.2.3.4/C:/> against <about:blank>",
|
||||
"Parsing: <file://[1::8]/C:/> against <about:blank>",
|
||||
"Parsing: <file:/C|/> against <about:blank>",
|
||||
"Parsing: <file://C|/> against <about:blank>",
|
||||
"Parsing: <\\\\\\.\\Y:> against <about:blank>",
|
||||
"Parsing: <\\\\\\.\\y:> against <about:blank>",
|
||||
"Parsing: <file://localhost//a//../..//foo> against <about:blank>",
|
||||
"Parsing: <file://localhost////foo> against <about:blank>",
|
||||
"Parsing: <file:////foo> against <about:blank>",
|
||||
"Parsing: <file:////one/two> against <file:///>",
|
||||
"Parsing: <////one/two> against <file:///>",
|
||||
"Parsing: <file:.//p> against <about:blank>",
|
||||
"Parsing: <http://[1:0::]> against <http://example.net/>",
|
||||
"Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>",
|
||||
"Parsing: <https://[0::0::0]> against <about:blank>",
|
||||
"Parsing: <https://[0:.0]> against <about:blank>",
|
||||
"Parsing: <https://[0:0:]> against <about:blank>",
|
||||
"Parsing: <https://[0:1:2:3:4:5:6:7.0.0.0.1]> against <about:blank>",
|
||||
"Parsing: <https://[0:1.00.0.0.0]> against <about:blank>",
|
||||
"Parsing: <https://[0:1.290.0.0.0]> against <about:blank>",
|
||||
"Parsing: <https://[0:1.23.23]> against <about:blank>",
|
||||
"Parsing: <#x> against <sc://ñ>",
|
||||
"Parsing: <?x> against <sc://ñ>",
|
||||
"Parsing: <sc://?> against <about:blank>",
|
||||
"Parsing: <sc://#> against <about:blank>",
|
||||
"Parsing: <non-spec:/.//> against <about:blank>",
|
||||
"Parsing: <non-spec:/..//> against <about:blank>",
|
||||
"Parsing: <non-spec:/a/..//> against <about:blank>",
|
||||
"Parsing: <non-spec:/.//path> against <about:blank>",
|
||||
"Parsing: <non-spec:/..//path> against <about:blank>",
|
||||
"Parsing: <non-spec:/a/..//path> against <about:blank>",
|
||||
"Parsing: </.//path> against <non-spec:/p>",
|
||||
"Parsing: </..//path> against <non-spec:/p>",
|
||||
"Parsing: <..//path> against <non-spec:/p>",
|
||||
"Parsing: <a/..//path> against <non-spec:/p>",
|
||||
"Parsing: <> against <non-spec:/..//p>",
|
||||
"Parsing: <path> against <non-spec:/..//p>",
|
||||
"Parsing: <non-special://[1:2:0:0:5:0:0:0]/> against <about:blank>",
|
||||
"Parsing: <http://[::127.0.0.0.1]> against <about:blank>",
|
||||
"Parsing: <http://example.org/test?#> against <about:blank>",
|
||||
"Parsing: <a> against <about:blank>",
|
||||
"Parsing: <a/> against <about:blank>",
|
||||
"Parsing: <a//> against <about:blank>",
|
||||
"Parsing: <test-a-colon.html> against <a:>",
|
||||
"Parsing: <test-a-colon-b.html> against <a:b>",
|
||||
"Parsing: <file://a%C2%ADb/p> against <about:blank>",
|
||||
"Parsing: <file:///p> against <about:blank>",
|
||||
"Parsing: <file://%C2%AD/p> against <about:blank>",
|
||||
"Parsing: <file://xn--/p> against <about:blank>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "url-origin",
|
||||
"expectFail": [
|
||||
"Origin parsing: <http://example\t.\norg> against <http://example.org/foo/bar>",
|
||||
"Origin parsing: <non-special://test:@test/x> against <about:blank>",
|
||||
"Origin parsing: <non-special://:@test/x> against <about:blank>",
|
||||
"Origin parsing: <http://f:00000000000000/c> against <http://example.org/foo/bar>",
|
||||
"Origin parsing: <http://f:00000000000000000000080/c> against <http://example.org/foo/bar>",
|
||||
"Origin parsing: <http://[::127.0.0.1]> against <http://example.org/foo/bar>",
|
||||
"Origin parsing: <http://[0:0:0:0:0:0:13.1.68.3]> against <http://example.org/foo/bar>",
|
||||
"Origin parsing: <ssh://example.com/foo/bar.git> against <http://example.org/>",
|
||||
"Origin parsing: <httpa://foo:80/> against <about:blank>",
|
||||
"Origin parsing: <gopher://foo:70/> against <about:blank>",
|
||||
"Origin parsing: <gopher://foo:443/> against <about:blank>",
|
||||
"Origin parsing: <\u0000\u001b\u0004\u0012 http://example.com/\u001f \r > against <about:blank>",
|
||||
"Origin parsing: <sc://faß.ExAmPlE/> against <about:blank>",
|
||||
"Origin parsing: <notspecial://host/?'> against <about:blank>",
|
||||
"Origin parsing: <i> against <sc://ho/pa>",
|
||||
"Origin parsing: <../i> against <sc://ho/pa>",
|
||||
"Origin parsing: </i> against <sc://ho/pa>",
|
||||
"Origin parsing: <?i> against <sc://ho/pa>",
|
||||
"Origin parsing: <#i> against <sc://ho/pa>",
|
||||
"Origin parsing: <sc://ñ.test/> against <about:blank>",
|
||||
"Origin parsing: <x> against <sc://ñ>",
|
||||
"Origin parsing: <sc://\u001f!\"$&'()*+,-.;=_`{|}~/> against <about:blank>",
|
||||
"Origin parsing: <ftp://%e2%98%83> against <about:blank>",
|
||||
"Origin parsing: <https://%e2%98%83> against <about:blank>",
|
||||
"Origin parsing: <h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg> against <about:blank>",
|
||||
"Origin parsing: <https://0x.0x.0> against <about:blank>",
|
||||
"Origin parsing: <http://[1:0::]> against <http://example.net/>",
|
||||
"Origin parsing: <sc://ñ> against <about:blank>",
|
||||
"Origin parsing: <sc://ñ?x> against <about:blank>",
|
||||
"Origin parsing: <sc://ñ#x> against <about:blank>",
|
||||
"Origin parsing: <#x> against <sc://ñ>",
|
||||
"Origin parsing: <?x> against <sc://ñ>",
|
||||
"Origin parsing: <tftp://foobar.com/someconfig;mode=netascii> against <about:blank>",
|
||||
"Origin parsing: <telnet://user:pass@foobar.com:23/> against <about:blank>",
|
||||
"Origin parsing: <ut2004://10.10.10.10:7777/Index.ut2> against <about:blank>",
|
||||
"Origin parsing: <redis://foo:bar@somehost:6379/0?baz=bam&qux=baz> against <about:blank>",
|
||||
"Origin parsing: <rsync://foo@host:911/sup> against <about:blank>",
|
||||
"Origin parsing: <git://github.com/foo/bar.git> against <about:blank>",
|
||||
"Origin parsing: <irc://myserver.com:6999/channel?passwd> against <about:blank>",
|
||||
"Origin parsing: <dns://fw.example.org:9999/foo.bar.org?type=TXT> against <about:blank>",
|
||||
"Origin parsing: <ldap://localhost:389/ou=People,o=JNDITutorial> against <about:blank>",
|
||||
"Origin parsing: <git+https://github.com/foo/bar> against <about:blank>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "url-searchparams",
|
||||
"expectFail": [
|
||||
"URL.searchParams updating, clearing",
|
||||
"URL.searchParams and URL.search setters, update propagation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "url-setters-stripping",
|
||||
"expectFail": [
|
||||
"Setting protocol with leading U+0000 (https:)",
|
||||
"Setting protocol with U+0000 before inserted colon (https:)",
|
||||
"Setting host with leading U+0000 (https:)",
|
||||
"Setting host with middle U+0000 (https:)",
|
||||
"Setting host with trailing U+0000 (https:)",
|
||||
"Setting port with middle U+0000 (https:)",
|
||||
"Setting port with trailing U+0000 (https:)",
|
||||
"Setting protocol with leading U+0009 (https:)",
|
||||
"Setting protocol with U+0009 before inserted colon (https:)",
|
||||
"Setting host with leading U+0009 (https:)",
|
||||
"Setting hostname with leading U+0009 (https:)",
|
||||
"Setting host with middle U+0009 (https:)",
|
||||
"Setting hostname with middle U+0009 (https:)",
|
||||
"Setting host with trailing U+0009 (https:)",
|
||||
"Setting hostname with trailing U+0009 (https:)",
|
||||
"Setting port with leading U+0009 (https:)",
|
||||
"Setting port with middle U+0009 (https:)",
|
||||
"Setting port with trailing U+0009 (https:)",
|
||||
"Setting pathname with leading U+0009 (https:)",
|
||||
"Setting pathname with middle U+0009 (https:)",
|
||||
"Setting pathname with trailing U+0009 (https:)",
|
||||
"Setting search with leading U+0009 (https:)",
|
||||
"Setting search with middle U+0009 (https:)",
|
||||
"Setting search with trailing U+0009 (https:)",
|
||||
"Setting hash with leading U+0009 (https:)",
|
||||
"Setting hash with middle U+0009 (https:)",
|
||||
"Setting hash with trailing U+0009 (https:)",
|
||||
"Setting protocol with leading U+000A (https:)",
|
||||
"Setting protocol with U+000A before inserted colon (https:)",
|
||||
"Setting host with leading U+000A (https:)",
|
||||
"Setting hostname with leading U+000A (https:)",
|
||||
"Setting host with middle U+000A (https:)",
|
||||
"Setting hostname with middle U+000A (https:)",
|
||||
"Setting host with trailing U+000A (https:)",
|
||||
"Setting hostname with trailing U+000A (https:)",
|
||||
"Setting port with leading U+000A (https:)",
|
||||
"Setting port with middle U+000A (https:)",
|
||||
"Setting port with trailing U+000A (https:)",
|
||||
"Setting pathname with leading U+000A (https:)",
|
||||
"Setting pathname with middle U+000A (https:)",
|
||||
"Setting pathname with trailing U+000A (https:)",
|
||||
"Setting search with leading U+000A (https:)",
|
||||
"Setting search with middle U+000A (https:)",
|
||||
"Setting search with trailing U+000A (https:)",
|
||||
"Setting hash with leading U+000A (https:)",
|
||||
"Setting hash with middle U+000A (https:)",
|
||||
"Setting hash with trailing U+000A (https:)",
|
||||
"Setting protocol with leading U+000D (https:)",
|
||||
"Setting protocol with U+000D before inserted colon (https:)",
|
||||
"Setting host with leading U+000D (https:)",
|
||||
"Setting hostname with leading U+000D (https:)",
|
||||
"Setting host with middle U+000D (https:)",
|
||||
"Setting hostname with middle U+000D (https:)",
|
||||
"Setting host with trailing U+000D (https:)",
|
||||
"Setting hostname with trailing U+000D (https:)",
|
||||
"Setting port with leading U+000D (https:)",
|
||||
"Setting port with middle U+000D (https:)",
|
||||
"Setting port with trailing U+000D (https:)",
|
||||
"Setting pathname with leading U+000D (https:)",
|
||||
"Setting pathname with middle U+000D (https:)",
|
||||
"Setting pathname with trailing U+000D (https:)",
|
||||
"Setting search with leading U+000D (https:)",
|
||||
"Setting search with middle U+000D (https:)",
|
||||
"Setting search with trailing U+000D (https:)",
|
||||
"Setting hash with leading U+000D (https:)",
|
||||
"Setting hash with middle U+000D (https:)",
|
||||
"Setting hash with trailing U+000D (https:)",
|
||||
"Setting protocol with leading U+001F (https:)",
|
||||
"Setting protocol with U+001F before inserted colon (https:)",
|
||||
"Setting host with leading U+001F (https:)",
|
||||
"Setting host with middle U+001F (https:)",
|
||||
"Setting host with trailing U+001F (https:)",
|
||||
"Setting port with middle U+001F (https:)",
|
||||
"Setting port with trailing U+001F (https:)",
|
||||
"Setting protocol with leading U+0000 (wpt++:)",
|
||||
"Setting protocol with U+0000 before inserted colon (wpt++:)",
|
||||
"Setting host with leading U+0000 (wpt++:)",
|
||||
"Setting host with middle U+0000 (wpt++:)",
|
||||
"Setting host with trailing U+0000 (wpt++:)",
|
||||
"Setting port with middle U+0000 (wpt++:)",
|
||||
"Setting port with trailing U+0000 (wpt++:)",
|
||||
"Setting pathname with leading U+0000 (wpt++:)",
|
||||
"Setting pathname with middle U+0000 (wpt++:)",
|
||||
"Setting pathname with trailing U+0000 (wpt++:)",
|
||||
"Setting protocol with leading U+0009 (wpt++:)",
|
||||
"Setting protocol with U+0009 before inserted colon (wpt++:)",
|
||||
"Setting host with leading U+0009 (wpt++:)",
|
||||
"Setting hostname with leading U+0009 (wpt++:)",
|
||||
"Setting host with middle U+0009 (wpt++:)",
|
||||
"Setting hostname with middle U+0009 (wpt++:)",
|
||||
"Setting host with trailing U+0009 (wpt++:)",
|
||||
"Setting hostname with trailing U+0009 (wpt++:)",
|
||||
"Setting port with leading U+0009 (wpt++:)",
|
||||
"Setting port with middle U+0009 (wpt++:)",
|
||||
"Setting port with trailing U+0009 (wpt++:)",
|
||||
"Setting pathname with leading U+0009 (wpt++:)",
|
||||
"Setting pathname with middle U+0009 (wpt++:)",
|
||||
"Setting pathname with trailing U+0009 (wpt++:)",
|
||||
"Setting search with leading U+0009 (wpt++:)",
|
||||
"Setting search with middle U+0009 (wpt++:)",
|
||||
"Setting search with trailing U+0009 (wpt++:)",
|
||||
"Setting hash with leading U+0009 (wpt++:)",
|
||||
"Setting hash with middle U+0009 (wpt++:)",
|
||||
"Setting hash with trailing U+0009 (wpt++:)",
|
||||
"Setting protocol with leading U+000A (wpt++:)",
|
||||
"Setting protocol with U+000A before inserted colon (wpt++:)",
|
||||
"Setting host with leading U+000A (wpt++:)",
|
||||
"Setting hostname with leading U+000A (wpt++:)",
|
||||
"Setting host with middle U+000A (wpt++:)",
|
||||
"Setting hostname with middle U+000A (wpt++:)",
|
||||
"Setting host with trailing U+000A (wpt++:)",
|
||||
"Setting hostname with trailing U+000A (wpt++:)",
|
||||
"Setting port with leading U+000A (wpt++:)",
|
||||
"Setting port with middle U+000A (wpt++:)",
|
||||
"Setting port with trailing U+000A (wpt++:)",
|
||||
"Setting pathname with leading U+000A (wpt++:)",
|
||||
"Setting pathname with middle U+000A (wpt++:)",
|
||||
"Setting pathname with trailing U+000A (wpt++:)",
|
||||
"Setting search with leading U+000A (wpt++:)",
|
||||
"Setting search with middle U+000A (wpt++:)",
|
||||
"Setting search with trailing U+000A (wpt++:)",
|
||||
"Setting hash with leading U+000A (wpt++:)",
|
||||
"Setting hash with middle U+000A (wpt++:)",
|
||||
"Setting hash with trailing U+000A (wpt++:)",
|
||||
"Setting protocol with leading U+000D (wpt++:)",
|
||||
"Setting protocol with U+000D before inserted colon (wpt++:)",
|
||||
"Setting host with leading U+000D (wpt++:)",
|
||||
"Setting hostname with leading U+000D (wpt++:)",
|
||||
"Setting host with middle U+000D (wpt++:)",
|
||||
"Setting hostname with middle U+000D (wpt++:)",
|
||||
"Setting host with trailing U+000D (wpt++:)",
|
||||
"Setting hostname with trailing U+000D (wpt++:)",
|
||||
"Setting port with leading U+000D (wpt++:)",
|
||||
"Setting port with middle U+000D (wpt++:)",
|
||||
"Setting port with trailing U+000D (wpt++:)",
|
||||
"Setting pathname with leading U+000D (wpt++:)",
|
||||
"Setting pathname with middle U+000D (wpt++:)",
|
||||
"Setting pathname with trailing U+000D (wpt++:)",
|
||||
"Setting search with leading U+000D (wpt++:)",
|
||||
"Setting search with middle U+000D (wpt++:)",
|
||||
"Setting search with trailing U+000D (wpt++:)",
|
||||
"Setting hash with leading U+000D (wpt++:)",
|
||||
"Setting hash with middle U+000D (wpt++:)",
|
||||
"Setting hash with trailing U+000D (wpt++:)",
|
||||
"Setting protocol with leading U+001F (wpt++:)",
|
||||
"Setting protocol with U+001F before inserted colon (wpt++:)",
|
||||
"Setting host with leading U+001F (wpt++:)",
|
||||
"Setting host with middle U+001F (wpt++:)",
|
||||
"Setting host with trailing U+001F (wpt++:)",
|
||||
"Setting port with middle U+001F (wpt++:)",
|
||||
"Setting port with trailing U+001F (wpt++:)",
|
||||
"Setting pathname with leading U+001F (wpt++:)",
|
||||
"Setting pathname with middle U+001F (wpt++:)",
|
||||
"Setting pathname with trailing U+001F (wpt++:)"
|
||||
]
|
||||
},
|
||||
"url-tojson",
|
||||
{
|
||||
"name": "urlencoded-parser",
|
||||
"expectFail": [
|
||||
"URLSearchParams constructed with: %EF%BB%BFtest=%EF%BB%BF",
|
||||
"request.formData() with input: test=",
|
||||
"response.formData() with input: test=",
|
||||
"request.formData() with input: %FE%FF",
|
||||
"response.formData() with input: %FE%FF",
|
||||
"request.formData() with input: %FF%FE",
|
||||
"response.formData() with input: %FF%FE",
|
||||
"request.formData() with input: %C2",
|
||||
"response.formData() with input: %C2",
|
||||
"request.formData() with input: %C2x",
|
||||
"response.formData() with input: %C2x",
|
||||
"request.formData() with input: _charset_=windows-1252&test=%C2x",
|
||||
"response.formData() with input: _charset_=windows-1252&test=%C2x",
|
||||
"request.formData() with input: %=a",
|
||||
"response.formData() with input: %=a",
|
||||
"request.formData() with input: %a=a",
|
||||
"response.formData() with input: %a=a",
|
||||
"request.formData() with input: %a_=a",
|
||||
"response.formData() with input: %a_=a",
|
||||
"request.formData() with input: id=0&value=%",
|
||||
"response.formData() with input: id=0&value=%",
|
||||
"request.formData() with input: b=%2sf%2a",
|
||||
"response.formData() with input: b=%2sf%2a",
|
||||
"request.formData() with input: b=%2%2af%2a",
|
||||
"response.formData() with input: b=%2%2af%2a",
|
||||
"request.formData() with input: b=%%2a",
|
||||
"response.formData() with input: b=%%2a"
|
||||
]
|
||||
},
|
||||
"urlsearchparams-append",
|
||||
{
|
||||
"name": "urlsearchparams-constructor",
|
||||
"expectFail": [
|
||||
"URLSearchParams constructor, empty string as argument",
|
||||
"Construct with 2 unpaired surrogates (no trailing)",
|
||||
"Construct with 3 unpaired surrogates (no leading)",
|
||||
"Construct with object with NULL, non-ASCII, and surrogate keys"
|
||||
]
|
||||
},
|
||||
"urlsearchparams-delete",
|
||||
{
|
||||
"name": "urlsearchparams-foreach",
|
||||
"expectFail": [
|
||||
"For-of Check",
|
||||
"delete next param during iteration",
|
||||
"delete current param during iteration",
|
||||
"delete every param seen during iteration"
|
||||
]
|
||||
},
|
||||
"urlsearchparams-get",
|
||||
"urlsearchparams-getall",
|
||||
"urlsearchparams-has",
|
||||
"urlsearchparams-set",
|
||||
"urlsearchparams-sort",
|
||||
"urlsearchparams-stringifier"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -111,13 +111,13 @@ window.add_completion_callback((tests, harnessStatus) => {
|
|||
console.log(`\nfailures:\n`);
|
||||
}
|
||||
for (const result of failed) {
|
||||
console.log(` ${result.name}`);
|
||||
console.log(` ${JSON.stringify(result.name)}`);
|
||||
}
|
||||
if (expectedFailedButPassedCount > 0) {
|
||||
console.log(`\nexpected failures that passed:\n`);
|
||||
}
|
||||
for (const result of expectedFailedButPassed) {
|
||||
console.log(` ${result.name}`);
|
||||
console.log(` ${JSON.stringify(result.name)}`);
|
||||
}
|
||||
console.log(
|
||||
`\ntest result: ${
|
||||
|
|
|
@ -109,3 +109,38 @@ cargo clean && cargo build -vv
|
|||
# Run:
|
||||
./target/debug/deno run cli/tests/002_hello.ts
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
> :warning: **IMPORTANT**: Our test suite relies on certain entries to be
|
||||
> configured in your /etc/hosts file. If these entries are not present in your
|
||||
> /etc/hosts file, the `web_platform_tests` test **will** fail. To configure
|
||||
> these entries, run the following command:
|
||||
|
||||
> ```shell
|
||||
> # macOS / Linux
|
||||
> cd test_utils/wpt/
|
||||
> ./wpt make-hosts-file | sudo tee -a /etc/hosts
|
||||
> ```
|
||||
|
||||
> ```powershell
|
||||
> # Windows (use powershell!)
|
||||
> cd test_utils/wpt/
|
||||
> python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts -Encoding ascii -Append
|
||||
> ```
|
||||
|
||||
> If you use WSL, be aware that WSL may attempt to override /etc/hosts each time
|
||||
> it is launched, which would then require you to re-run hosts this setup. This
|
||||
> behavior
|
||||
> [can be configured](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#network).
|
||||
|
||||
```shell
|
||||
# Run the full test suite:
|
||||
cargo test
|
||||
|
||||
# Run a specific test:
|
||||
cargo test web_platform_tests
|
||||
|
||||
# Run a specific test, and don't swallow test output:
|
||||
cargo test web_platform_tests -- --nocapture
|
||||
```
|
||||
|
|
|
@ -335,7 +335,7 @@ Deno.test("contentType", async () => {
|
|||
Deno.test("file_server running as library", async function (): Promise<void> {
|
||||
await startFileServerAsLibrary();
|
||||
try {
|
||||
const res = await fetch("http://localhost:8000");
|
||||
const res = await fetch("http://localhost:4504");
|
||||
assertEquals(res.status, 200);
|
||||
const _ = await res.text();
|
||||
} finally {
|
||||
|
|
2
std/http/testdata/file_server_as_library.ts
vendored
2
std/http/testdata/file_server_as_library.ts
vendored
|
@ -1,7 +1,7 @@
|
|||
import { serve } from "../server.ts";
|
||||
import { serveFile } from "../file_server.ts";
|
||||
|
||||
const server = serve({ port: 8000 });
|
||||
const server = serve({ port: 4504 });
|
||||
|
||||
console.log("Server running...");
|
||||
|
||||
|
|
Loading…
Reference in a new issue