1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-12 12:50:00 -05:00

remove std/testing/runner.ts, use deno test for std/ tests (#4397)

This introduces BREAKING CHANGE by removing "std/testing/runner.ts".

Std tests are now run using "deno test" subcommand.
This commit is contained in:
Bartek Iwańczuk 2020-03-19 14:49:06 +01:00 committed by GitHub
parent 8de4a05f2a
commit 74c37e759a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1 additions and 108 deletions

View file

@ -17,11 +17,10 @@ mod tests {
cwd.push("std");
let mut deno = deno_cmd
.current_dir(cwd) // note: std tests expect to run from "std" dir
.arg("test")
.arg("--seed=86") // Some tests rely on specific random numbers.
.arg("-A")
// .arg("-Ldebug")
.arg("./testing/runner.ts")
.arg("--exclude=testing/testdata")
.spawn()
.expect("failed to spawn script");
let status = deno.wait().expect("failed to wait for the child process");

View file

@ -1,94 +0,0 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";
import { isWindows } from "../path/mod.ts";
import { findTestModules } from "./runner.ts";
const { cwd, test } = Deno;
function urlToFilePath(url: URL): string {
// Since `new URL('file:///C:/a').pathname` is `/C:/a`, remove leading slash.
return url.pathname.slice(url.protocol == "file:" && isWindows ? 1 : 0);
}
async function findTestModulesArray(
include: string[],
exclude: string[],
root: string = cwd()
): Promise<string[]> {
const result = [];
for await (const testModule of findTestModules(include, exclude, root)) {
result.push(testModule);
}
return result;
}
const TEST_DATA_URL = new URL("testdata", import.meta.url);
const TEST_DATA_PATH = urlToFilePath(TEST_DATA_URL);
test(async function findTestModulesDir1(): Promise<void> {
const urls = await findTestModulesArray(["."], [], TEST_DATA_PATH);
assertEquals(urls.sort(), [
`${TEST_DATA_URL}/bar_test.js`,
`${TEST_DATA_URL}/foo_test.ts`,
`${TEST_DATA_URL}/subdir/bar_test.js`,
`${TEST_DATA_URL}/subdir/foo_test.ts`,
`${TEST_DATA_URL}/subdir/test.js`,
`${TEST_DATA_URL}/subdir/test.ts`,
`${TEST_DATA_URL}/test.js`,
`${TEST_DATA_URL}/test.ts`
]);
});
test(async function findTestModulesDir2(): Promise<void> {
const urls = await findTestModulesArray(["subdir"], [], TEST_DATA_PATH);
assertEquals(urls.sort(), [
`${TEST_DATA_URL}/subdir/bar_test.js`,
`${TEST_DATA_URL}/subdir/foo_test.ts`,
`${TEST_DATA_URL}/subdir/test.js`,
`${TEST_DATA_URL}/subdir/test.ts`
]);
});
test(async function findTestModulesGlob(): Promise<void> {
const urls = await findTestModulesArray(
["**/*_test.{js,ts}"],
[],
TEST_DATA_PATH
);
assertEquals(urls.sort(), [
`${TEST_DATA_URL}/bar_test.js`,
`${TEST_DATA_URL}/foo_test.ts`,
`${TEST_DATA_URL}/subdir/bar_test.js`,
`${TEST_DATA_URL}/subdir/foo_test.ts`
]);
});
test(async function findTestModulesExcludeDir(): Promise<void> {
const urls = await findTestModulesArray(["."], ["subdir"], TEST_DATA_PATH);
assertEquals(urls.sort(), [
`${TEST_DATA_URL}/bar_test.js`,
`${TEST_DATA_URL}/foo_test.ts`,
`${TEST_DATA_URL}/test.js`,
`${TEST_DATA_URL}/test.ts`
]);
});
test(async function findTestModulesExcludeGlob(): Promise<void> {
const urls = await findTestModulesArray(["."], ["**/foo*"], TEST_DATA_PATH);
assertEquals(urls.sort(), [
`${TEST_DATA_URL}/bar_test.js`,
`${TEST_DATA_URL}/subdir/bar_test.js`,
`${TEST_DATA_URL}/subdir/test.js`,
`${TEST_DATA_URL}/subdir/test.ts`,
`${TEST_DATA_URL}/test.js`,
`${TEST_DATA_URL}/test.ts`
]);
});
test(async function findTestModulesRemote(): Promise<void> {
const urls = [
"https://example.com/colors_test.ts",
"http://example.com/printf_test.ts"
];
const matches = await findTestModulesArray(urls, []);
assertEquals(matches, urls);
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};

View file

@ -1 +0,0 @@
export {};