mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove old test262 and dt runner infra (#53125)
This commit is contained in:
@@ -2,7 +2,6 @@ node_modules/
|
||||
.node_modules/
|
||||
built/*
|
||||
tests/cases/rwc/*
|
||||
tests/cases/test262/*
|
||||
tests/cases/perf/*
|
||||
!tests/cases/webharness/compilerToString.js
|
||||
test-args.txt
|
||||
@@ -14,7 +13,6 @@ tests/baselines/local.old/*
|
||||
tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/test262/*
|
||||
tests/baselines/reference/projectOutput/*
|
||||
tests/baselines/local/projectOutput/*
|
||||
tests/baselines/reference/testresults.tap
|
||||
|
||||
@@ -14,7 +14,6 @@ export const localBaseline = "tests/baselines/local/";
|
||||
export const refBaseline = "tests/baselines/reference/";
|
||||
export const localRwcBaseline = "internal/baselines/rwc/local";
|
||||
export const refRwcBaseline = "internal/baselines/rwc/reference";
|
||||
export const localTest262Baseline = "internal/baselines/test262/local";
|
||||
|
||||
/**
|
||||
* @param {string} runJs
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"extends": "../.eslintrc.json",
|
||||
"parserOptions": {
|
||||
"tsconfigRootDir": "src",
|
||||
"project": "./tsconfig-base.json"
|
||||
"project": "./tsconfig-eslint.json"
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
|
||||
@@ -610,7 +610,7 @@ export namespace Compiler {
|
||||
// if lib.d.ts is explicitly included in input files and there are some errors in it (i.e. because of duplicate identifiers)
|
||||
// then they will be added twice thus triggering 'total errors' assertion with condition
|
||||
// Similarly for tsconfig, which may be in the input files and contain errors.
|
||||
// 'totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics + numTest262HarnessDiagnostics, diagnostics.length
|
||||
// 'totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics, diagnostics.length
|
||||
|
||||
if (!error.file || !isDefaultLibraryFile(error.file.fileName) && !vpath.isTsConfigFile(error.file.fileName)) {
|
||||
totalErrorsReportedInNonLibraryNonTsconfigFiles++;
|
||||
@@ -719,13 +719,8 @@ export namespace Compiler {
|
||||
return !!diagnostic.file && (vpath.isTsConfigFile(diagnostic.file.fileName));
|
||||
});
|
||||
|
||||
const numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
// Count an error generated from tests262-harness folder.This should only apply for test262
|
||||
return !!diagnostic.file && diagnostic.file.fileName.indexOf("test262-harness") >= 0;
|
||||
});
|
||||
|
||||
// Verify we didn't miss any errors in total
|
||||
assert.equal(totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics + numTest262HarnessDiagnostics, diagnostics.length, "total number of errors");
|
||||
assert.equal(totalErrorsReportedInNonLibraryNonTsconfigFiles + numLibraryDiagnostics + numTsconfigDiagnostics, diagnostics.length, "total number of errors");
|
||||
}
|
||||
|
||||
export function doErrorBaseline(baselinePath: string, inputFiles: readonly TestFile[], errors: readonly ts.Diagnostic[], pretty?: boolean) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from "./_namespaces/Harness";
|
||||
import * as ts from "./_namespaces/ts";
|
||||
|
||||
export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc" | "test262" | "dt";
|
||||
export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc";
|
||||
export type CompilerTestKind = "conformance" | "compiler";
|
||||
export type FourslashTestKind = "fourslash" | "fourslash-shims" | "fourslash-shims-pp" | "fourslash-server";
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ export { Parallel };
|
||||
|
||||
export * from "../fourslashRunner";
|
||||
export * from "../compilerRunner";
|
||||
export * from "../externalCompileRunner";
|
||||
export * from "../test262Runner";
|
||||
export * from "../runner";
|
||||
|
||||
// If running as emitted CJS, don't start executing the tests here; instead start in runner.ts.
|
||||
|
||||
@@ -18,7 +18,6 @@ import * as vpath from "./_namespaces/vpath";
|
||||
export const enum CompilerTestType {
|
||||
Conformance,
|
||||
Regressions,
|
||||
Test262
|
||||
}
|
||||
|
||||
interface CompilerFileBasedTest extends FileBasedTest {
|
||||
@@ -41,9 +40,6 @@ export class CompilerBaselineRunner extends RunnerBase {
|
||||
else if (testType === CompilerTestType.Regressions) {
|
||||
this.testSuiteName = "compiler";
|
||||
}
|
||||
else if (testType === CompilerTestType.Test262) {
|
||||
this.testSuiteName = "test262";
|
||||
}
|
||||
else {
|
||||
this.testSuiteName = "compiler"; // default to this for historical reasons
|
||||
}
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
import * as del from "del";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
import {
|
||||
Baseline,
|
||||
IO,
|
||||
isWorker,
|
||||
RunnerBase,
|
||||
TestRunnerKind,
|
||||
} from "./_namespaces/Harness";
|
||||
import * as ts from "./_namespaces/ts";
|
||||
|
||||
interface ExecResult {
|
||||
stdout: Buffer;
|
||||
stderr: Buffer;
|
||||
status: number | null;
|
||||
}
|
||||
|
||||
interface UserConfig {
|
||||
types: string[];
|
||||
cloneUrl: string;
|
||||
branch?: string;
|
||||
path?: string;
|
||||
}
|
||||
|
||||
abstract class ExternalCompileRunnerBase extends RunnerBase {
|
||||
abstract testDir: string;
|
||||
abstract report(result: ExecResult): string | null;
|
||||
enumerateTestFiles() {
|
||||
return IO.getDirectories(this.testDir);
|
||||
}
|
||||
/** Setup the runner's tests so that they are ready to be executed by the harness
|
||||
* The first test should be a describe/it block that sets up the harness's compiler instance appropriately
|
||||
*/
|
||||
initializeTests(): void {
|
||||
// Read in and evaluate the test list
|
||||
const testList = this.tests && this.tests.length ? this.tests : this.getTestFiles();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const cls = this;
|
||||
describe(`${this.kind()} code samples`, function (this: Mocha.Suite) {
|
||||
this.timeout(600_000); // 10 minutes
|
||||
for (const test of testList) {
|
||||
cls.runTest(typeof test === "string" ? test : test.file);
|
||||
}
|
||||
});
|
||||
}
|
||||
private runTest(directoryName: string) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const cls = this;
|
||||
const timeout = 600_000; // 10 minutes
|
||||
describe(directoryName, function (this: Mocha.Suite) {
|
||||
this.timeout(timeout);
|
||||
const cp: typeof import("child_process") = require("child_process");
|
||||
|
||||
it("should build successfully", () => {
|
||||
let cwd = path.join(IO.getWorkspaceRoot(), cls.testDir, directoryName);
|
||||
const originalCwd = cwd;
|
||||
const stdio = isWorker ? "pipe" : "inherit";
|
||||
let types: string[] | undefined;
|
||||
if (fs.existsSync(path.join(cwd, "test.json"))) {
|
||||
const config = JSON.parse(fs.readFileSync(path.join(cwd, "test.json"), { encoding: "utf8" })) as UserConfig;
|
||||
ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present.");
|
||||
ts.Debug.assert(!!config.cloneUrl, "Bad format from test.json: cloneUrl field must be present.");
|
||||
const submoduleDir = path.join(cwd, directoryName);
|
||||
if (!fs.existsSync(submoduleDir)) {
|
||||
exec("git", ["--work-tree", submoduleDir, "clone", "-b", config.branch || "master", config.cloneUrl, path.join(submoduleDir, ".git")], { cwd });
|
||||
}
|
||||
else {
|
||||
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "checkout", config.branch || "master"], { cwd: submoduleDir });
|
||||
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "reset", "HEAD", "--hard"], { cwd: submoduleDir });
|
||||
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "clean", "-f"], { cwd: submoduleDir });
|
||||
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "pull", "-f"], { cwd: submoduleDir });
|
||||
}
|
||||
|
||||
types = config.types;
|
||||
|
||||
cwd = config.path ? path.join(cwd, config.path) : submoduleDir;
|
||||
}
|
||||
const npmVersionText = exec("npm", ["--version"], { cwd, stdio: "pipe" })?.trim();
|
||||
const npmVersion = npmVersionText ? ts.Version.tryParse(npmVersionText.trim()) : undefined;
|
||||
const isV7OrLater = !!npmVersion && npmVersion.major >= 7;
|
||||
if (fs.existsSync(path.join(cwd, "package.json"))) {
|
||||
if (fs.existsSync(path.join(cwd, "package-lock.json"))) {
|
||||
fs.unlinkSync(path.join(cwd, "package-lock.json"));
|
||||
}
|
||||
if (fs.existsSync(path.join(cwd, "node_modules"))) {
|
||||
del.sync(path.join(cwd, "node_modules"), { force: true });
|
||||
}
|
||||
exec("npm", ["i", "--ignore-scripts", ...(isV7OrLater ? ["--legacy-peer-deps"] : [])], { cwd, timeout: timeout / 2 }); // NPM shouldn't take the entire timeout - if it takes a long time, it should be terminated and we should log the failure
|
||||
}
|
||||
const args = [path.join(IO.getWorkspaceRoot(), "built/local/tsc.js")];
|
||||
if (types) {
|
||||
args.push("--types", types.join(","));
|
||||
// Also actually install those types (for, eg, the js projects which need node)
|
||||
if (types.length) {
|
||||
exec("npm", ["i", ...types.map(t => `@types/${t}`), "--no-save", "--ignore-scripts", ...(isV7OrLater ? ["--legacy-peer-deps"] : [])], { cwd: originalCwd, timeout: timeout / 2 }); // NPM shouldn't take the entire timeout - if it takes a long time, it should be terminated and we should log the failure
|
||||
}
|
||||
}
|
||||
args.push("--noEmit");
|
||||
Baseline.runBaseline(`${cls.kind()}/${directoryName}.log`, cls.report(cp.spawnSync(`node`, args, { cwd, timeout, shell: true })));
|
||||
|
||||
function exec(command: string, args: string[], options: { cwd: string, timeout?: number, stdio?: import("child_process").StdioOptions }): string | undefined {
|
||||
const res = cp.spawnSync(isWorker ? `${command} 2>&1` : command, args, { shell: true, stdio, ...options });
|
||||
if (res.status !== 0) {
|
||||
throw new Error(`${command} ${args.join(" ")} for ${directoryName} failed: ${res.stdout && res.stdout.toString()}`);
|
||||
}
|
||||
return options.stdio === "pipe" ? res.stdout.toString("utf8") : undefined;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DefinitelyTypedRunner extends ExternalCompileRunnerBase {
|
||||
readonly testDir = "../DefinitelyTyped/types/";
|
||||
override workingDirectory = this.testDir;
|
||||
kind(): TestRunnerKind {
|
||||
return "dt";
|
||||
}
|
||||
report(result: ExecResult) {
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
return !result.stdout.length && !result.stderr.length ? null : `Exit Code: ${result.status}
|
||||
Standard output:
|
||||
${result.stdout.toString().replace(/\r\n/g, "\n")}
|
||||
|
||||
|
||||
Standard error:
|
||||
${result.stderr.toString().replace(/\r\n/g, "\n")}`;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import * as FourSlash from "./_namespaces/FourSlash";
|
||||
import {
|
||||
CompilerBaselineRunner,
|
||||
CompilerTestType,
|
||||
DefinitelyTypedRunner,
|
||||
FourSlashRunner,
|
||||
GeneratedFourslashRunner,
|
||||
IO,
|
||||
@@ -11,7 +10,6 @@ import {
|
||||
setLightMode,
|
||||
setShardId,
|
||||
setShards,
|
||||
Test262BaselineRunner,
|
||||
TestRunnerKind,
|
||||
} from "./_namespaces/Harness";
|
||||
import * as project from "./_namespaces/project";
|
||||
@@ -76,10 +74,6 @@ export function createRunner(kind: TestRunnerKind): RunnerBase {
|
||||
return new project.ProjectRunner();
|
||||
case "rwc":
|
||||
return new RWC.RWCRunner();
|
||||
case "test262":
|
||||
return new Test262BaselineRunner();
|
||||
case "dt":
|
||||
return new DefinitelyTypedRunner();
|
||||
}
|
||||
return ts.Debug.fail(`Unknown runner kind ${kind}`);
|
||||
}
|
||||
@@ -214,12 +208,6 @@ function handleTestConfig() {
|
||||
case "rwc":
|
||||
runners.push(new RWC.RWCRunner());
|
||||
break;
|
||||
case "test262":
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
case "dt":
|
||||
runners.push(new DefinitelyTypedRunner());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
import * as compiler from "./_namespaces/compiler";
|
||||
import {
|
||||
Baseline,
|
||||
Compiler,
|
||||
IO,
|
||||
RunnerBase,
|
||||
TestCaseParser,
|
||||
TestRunnerKind,
|
||||
} from "./_namespaces/Harness";
|
||||
import * as ts from "./_namespaces/ts";
|
||||
import * as Utils from "./_namespaces/Utils";
|
||||
|
||||
// In harness baselines, null is different than undefined. See `generateActual` in `harness.ts`.
|
||||
export class Test262BaselineRunner extends RunnerBase {
|
||||
private static readonly basePath = "internal/cases/test262";
|
||||
private static readonly helpersFilePath = "tests/cases/test262-harness/helpers.d.ts";
|
||||
private static readonly helperFile: Compiler.TestFile = {
|
||||
unitName: Test262BaselineRunner.helpersFilePath,
|
||||
content: IO.readFile(Test262BaselineRunner.helpersFilePath)!,
|
||||
};
|
||||
private static readonly testFileExtensionRegex = /\.js$/;
|
||||
private static readonly options: ts.CompilerOptions = {
|
||||
allowNonTsExtensions: true,
|
||||
target: ts.ScriptTarget.Latest,
|
||||
module: ts.ModuleKind.CommonJS
|
||||
};
|
||||
private static readonly baselineOptions: Baseline.BaselineOptions = {
|
||||
Subfolder: "test262",
|
||||
Baselinefolder: "internal/baselines"
|
||||
};
|
||||
|
||||
private static getTestFilePath(filename: string): string {
|
||||
return Test262BaselineRunner.basePath + "/" + filename;
|
||||
}
|
||||
|
||||
private runTest(filePath: string) {
|
||||
describe("test262 test for " + filePath, () => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Everything declared here should be cleared out in the "after" callback.
|
||||
let testState: {
|
||||
filename: string;
|
||||
compilerResult: compiler.CompilationResult;
|
||||
inputFiles: Compiler.TestFile[];
|
||||
};
|
||||
|
||||
before(() => {
|
||||
const content = IO.readFile(filePath)!;
|
||||
const testFilename = ts.removeFileExtension(filePath).replace(/\//g, "_") + ".test";
|
||||
const testCaseContent = TestCaseParser.makeUnitsFromTest(content, testFilename);
|
||||
|
||||
const inputFiles: Compiler.TestFile[] = testCaseContent.testUnitData.map(unit => {
|
||||
const unitName = Test262BaselineRunner.getTestFilePath(unit.name);
|
||||
return { unitName, content: unit.content };
|
||||
});
|
||||
|
||||
// Emit the results
|
||||
testState = {
|
||||
filename: testFilename,
|
||||
inputFiles,
|
||||
compilerResult: undefined!, // TODO: GH#18217
|
||||
};
|
||||
|
||||
testState.compilerResult = Compiler.compileFiles(
|
||||
[Test262BaselineRunner.helperFile].concat(inputFiles),
|
||||
/*otherFiles*/ [],
|
||||
/* harnessOptions */ undefined,
|
||||
Test262BaselineRunner.options,
|
||||
/* currentDirectory */ undefined);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
testState = undefined!;
|
||||
});
|
||||
|
||||
it("has the expected emitted code", () => {
|
||||
const files = ts.arrayFrom(testState.compilerResult.js.values()).filter(f => f.file !== Test262BaselineRunner.helpersFilePath);
|
||||
Baseline.runBaseline(testState.filename + ".output.js", Compiler.collateOutputs(files), Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
|
||||
it("has the expected errors", () => {
|
||||
const errors = testState.compilerResult.diagnostics;
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
const baseline = errors.length === 0 ? null : Compiler.getErrorBaseline(testState.inputFiles, errors);
|
||||
Baseline.runBaseline(testState.filename + ".errors.txt", baseline, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
|
||||
it("satisfies invariants", () => {
|
||||
const sourceFile = testState.compilerResult.program!.getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
Utils.assertInvariants(sourceFile, /*parent:*/ undefined);
|
||||
});
|
||||
|
||||
it("has the expected AST", () => {
|
||||
const sourceFile = testState.compilerResult.program!.getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename))!;
|
||||
Baseline.runBaseline(testState.filename + ".AST.txt", Utils.sourceFileToJSON(sourceFile), Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public kind(): TestRunnerKind {
|
||||
return "test262";
|
||||
}
|
||||
|
||||
public enumerateTestFiles() {
|
||||
// see also: `enumerateTestFiles` in tests/webTestServer.ts
|
||||
return ts.map(this.enumerateFiles(Test262BaselineRunner.basePath, Test262BaselineRunner.testFileExtensionRegex, { recursive: true }), ts.normalizePath);
|
||||
}
|
||||
|
||||
public initializeTests() {
|
||||
// this will set up a series of describe/it blocks to run between the setup and cleanup phases
|
||||
if (this.tests.length === 0) {
|
||||
const testFiles = this.getTestFiles();
|
||||
testFiles.forEach(fn => {
|
||||
this.runTest(fn);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.tests.forEach(test => this.runTest(typeof test === "string" ? test : test.file));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "./tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"types": ["node", "mocha", "chai"]
|
||||
}
|
||||
}
|
||||
-367
@@ -1,367 +0,0 @@
|
||||
declare function $FAIL(message: any): void;
|
||||
declare function $PRINT(message: any): void;
|
||||
declare function accessorPropertyAttributesAreCorrect(obj: any, name: any, get: any, set: any, setVerifyHelpProp: any, enumerable: any, configurable: any): boolean;
|
||||
declare function arrayContains(arr: any, expected: any): boolean;
|
||||
declare function compareArray(aExpected: any, aActual: any): boolean;
|
||||
declare function testRun(id: any, path: any, description: any, codeString: any, result: any, error: any): void;
|
||||
declare var print: any;
|
||||
declare function dataPropertyAttributesAreCorrect(obj: any, name: any, value: any, writable: any, enumerable: any, configurable: any): boolean;
|
||||
declare var HoursPerDay: number;
|
||||
declare var MinutesPerHour: number;
|
||||
declare var SecondsPerMinute: number;
|
||||
declare var msPerDay: number;
|
||||
declare var msPerSecond: number;
|
||||
declare var msPerMinute: number;
|
||||
declare var msPerHour: number;
|
||||
declare var date_1899_end: number;
|
||||
declare var date_1900_start: number;
|
||||
declare var date_1969_end: number;
|
||||
declare var date_1970_start: number;
|
||||
declare var date_1999_end: number;
|
||||
declare var date_2000_start: number;
|
||||
declare var date_2099_end: number;
|
||||
declare var date_2100_start: number;
|
||||
declare var $LocalTZ: any, $DST_start_month: any, $DST_start_sunday: any, $DST_start_hour: any, $DST_start_minutes: any, $DST_end_month: any, $DST_end_sunday: any, $DST_end_hour: any, $DST_end_minutes: any;
|
||||
declare function Day(t: any): number;
|
||||
declare function TimeWithinDay(t: any): number;
|
||||
declare function DaysInYear(y: any): number;
|
||||
declare function DayFromYear(y: any): number;
|
||||
declare function TimeFromYear(y: any): number;
|
||||
declare function YearFromTime(t: any): number;
|
||||
declare function InLeapYear(t: any): number;
|
||||
declare function DayWithinYear(t: any): number;
|
||||
declare function MonthFromTime(t: any): number;
|
||||
declare function DateFromTime(t: any): number;
|
||||
declare function WeekDay(t: any): number;
|
||||
declare var LocalTZA: number;
|
||||
declare function DaysInMonth(m: any, leap: any): any;
|
||||
declare function GetSundayInMonth(t: any, m: any, count: any): any;
|
||||
declare function DaylightSavingTA(t: any): number;
|
||||
declare function LocalTime(t: any): any;
|
||||
declare function UTC(t: any): number;
|
||||
declare function HourFromTime(t: any): number;
|
||||
declare function MinFromTime(t: any): number;
|
||||
declare function SecFromTime(t: any): number;
|
||||
declare function msFromTime(t: any): number;
|
||||
declare function MakeTime(hour: any, min: any, sec: any, ms: any): any;
|
||||
declare function MakeDay(year: any, month: any, date: any): number;
|
||||
declare function MakeDate(day: any, time: any): any;
|
||||
declare function TimeClip(time: any): any;
|
||||
declare function ConstructDate(year: any, month: any, date: any, hours: any, minutes: any, seconds: any, ms: any): any;
|
||||
declare function __consolePrintHandle__(msg: any): void;
|
||||
declare function fnExists(): boolean;
|
||||
declare var __globalObject: any;
|
||||
declare function fnGlobalObject(): any;
|
||||
declare function testPrint(message: any): void;
|
||||
/**
|
||||
* It is not yet clear that runTestCase should pass the global object
|
||||
* as the 'this' binding in the call to testcase.
|
||||
*/
|
||||
declare var runTestCase: (testcase: any) => void;
|
||||
declare function assertTruthy(value: any): void;
|
||||
/**
|
||||
* falsy means we expect no error.
|
||||
* truthy means we expect some error.
|
||||
* A non-empty string means we expect an error whose .name is that string.
|
||||
*/
|
||||
declare var expectedErrorName: boolean;
|
||||
/**
|
||||
* What was thrown, or the string 'Falsy' if something falsy was thrown.
|
||||
* null if test completed normally.
|
||||
*/
|
||||
declare var actualError: any;
|
||||
declare function testStarted(expectedErrName: any): void;
|
||||
declare function testFinished(): void;
|
||||
declare function Presenter(): void;
|
||||
declare var presenter: any;
|
||||
declare var prec: any;
|
||||
declare function isEqual(num1: any, num2: any): boolean;
|
||||
declare function getPrecision(num: any): number;
|
||||
declare function ToInteger(p: any): any;
|
||||
declare function checkSequence<T>(arr: Promise<T>, message: string): void;
|
||||
declare var objectStore: {
|
||||
object: Object;
|
||||
};
|
||||
declare var functionStore: {
|
||||
fun: () => string;
|
||||
};
|
||||
declare function createEmulatedProxy<T>(target: T, emulatedProps: any, success?: any): T;
|
||||
declare function Section(parentSection: any, id: any, name: any): void;
|
||||
declare var NotEarlyErrorString: string;
|
||||
declare var EarlyErrorRePat: string;
|
||||
declare var NotEarlyError: Error;
|
||||
declare var $ERROR: any;
|
||||
declare function BrowserRunner(): void;
|
||||
declare function TestLoader(): void;
|
||||
declare function Controller(): void;
|
||||
declare var controller: any;
|
||||
declare function isSiteDebugMode(): boolean;
|
||||
/**
|
||||
* @description Helper handler method for tagged string templates
|
||||
*/
|
||||
declare function testHandler(literals: any): string;
|
||||
/**
|
||||
* @description Tests that obj meets the requirements for built-in objects
|
||||
* defined by the introduction of chapter 15 of the ECMAScript Language Specification.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {boolean} isFunction whether the specification describes obj as a function.
|
||||
* @param {boolean} isConstructor whether the specification describes obj as a constructor.
|
||||
* @param {String[]} properties an array with the names of the built-in properties of obj,
|
||||
* excluding length, prototype, or properties with non-default attributes.
|
||||
* @param {number} length for functions only: the length specified for the function
|
||||
* or derived from the argument list.
|
||||
* @author Norbert Lindenberg
|
||||
*/
|
||||
declare function testBuiltInObject(obj: any, isFunction: any, isConstructor: any, properties: any, length: any): boolean;
|
||||
/**
|
||||
* @description This is a helper file for testing detached typed arrays
|
||||
* @author Andrei Borodin (anborod)
|
||||
*/
|
||||
declare var lib: {
|
||||
init: () => void;
|
||||
dispose: () => void;
|
||||
detachItem: (item: any) => any;
|
||||
createDetachCallback: (arr: any, detachAfterNumIterations: any, valueToReturn: any) => (item: any) => any;
|
||||
createDetachValueOfObject: (arr: any, detachAfterNumIterations: any, value: any) => {
|
||||
valueOf: () => any;
|
||||
};
|
||||
createDetachToStringObject: (arr: any, detachAfterNumIterations: any, value: any) => {
|
||||
toString: () => string;
|
||||
};
|
||||
runTestCaseWrapper: (func: any) => void;
|
||||
expectTypeError: (func: any, reason: any) => void;
|
||||
expectRangeError: (func: any, reason: any) => void;
|
||||
expectError: (errorType: any, name: any, func: any, reason: any) => void;
|
||||
isDetached: (obj: any) => boolean;
|
||||
};
|
||||
declare function testIntlOptions(givenOptions: any, expectedOptions: any): void;
|
||||
/**
|
||||
* This file contains shared functions for the tests in the conformance test
|
||||
* suite for the ECMAScript Internationalization API.
|
||||
* @author Norbert Lindenberg
|
||||
*/
|
||||
/**
|
||||
* @description Calls the provided function for every service constructor in
|
||||
* the Intl object, until f returns a falsy value. It returns the result of the
|
||||
* last call to f, mapped to a boolean.
|
||||
* @param {Function} f the function to call for each service constructor in
|
||||
* the Intl object.
|
||||
* @param {Function} Constructor the constructor object to test with.
|
||||
* @result {Boolean} whether the test succeeded.
|
||||
*/
|
||||
declare function testWithIntlConstructors(f: any): boolean;
|
||||
/**
|
||||
* Returns the name of the given constructor object, which must be one of
|
||||
* Intl.Collator, Intl.NumberFormat, or Intl.DateTimeFormat.
|
||||
* @param {object} Constructor a constructor
|
||||
* @return {string} the name of the constructor
|
||||
*/
|
||||
declare function getConstructorName(Constructor: any): string;
|
||||
/**
|
||||
* Taints a named data property of the given object by installing
|
||||
* a setter that throws an exception.
|
||||
* @param {object} obj the object whose data property to taint
|
||||
* @param {string} property the property to taint
|
||||
*/
|
||||
declare function taintDataProperty(obj: any, property: any): void;
|
||||
/**
|
||||
* Taints a named method of the given object by replacing it with a function
|
||||
* that throws an exception.
|
||||
* @param {object} obj the object whose method to taint
|
||||
* @param {string} property the name of the method to taint
|
||||
*/
|
||||
declare function taintMethod(obj: any, property: any): void;
|
||||
/**
|
||||
* Taints the given properties (and similarly named properties) by installing
|
||||
* setters on Object.prototype that throw exceptions.
|
||||
* @param {Array} properties an array of property names to taint
|
||||
*/
|
||||
declare function taintProperties(properties: any): void;
|
||||
/**
|
||||
* Taints the Array object by creating a setter for the property "0" and
|
||||
* replacing some key methods with functions that throw exceptions.
|
||||
*/
|
||||
declare function taintArray(): void;
|
||||
declare var languages: string[];
|
||||
declare var scripts: string[];
|
||||
declare var countries: string[];
|
||||
declare var localeSupportInfo: {};
|
||||
/**
|
||||
* Gets locale support info for the given constructor object, which must be one
|
||||
* of Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat.
|
||||
* @param {object} Constructor the constructor for which to get locale support info
|
||||
* @return {object} locale support info with the following properties:
|
||||
* supported: array of fully supported language tags
|
||||
* byFallback: array of language tags that are supported through fallbacks
|
||||
* unsupported: array of unsupported language tags
|
||||
*/
|
||||
declare function getLocaleSupportInfo(Constructor: any): any;
|
||||
/**
|
||||
* @description Tests whether locale is a String value representing a
|
||||
* structurally valid and canonicalized BCP 47 language tag, as defined in
|
||||
* sections 6.2.2 and 6.2.3 of the ECMAScript Internationalization API
|
||||
* Specification.
|
||||
* @param {String} locale the string to be tested.
|
||||
* @result {Boolean} whether the test succeeded.
|
||||
*/
|
||||
declare function isCanonicalizedStructurallyValidLanguageTag(locale: any): boolean;
|
||||
/**
|
||||
* Tests whether the named options property is correctly handled by the given constructor.
|
||||
* @param {object} Constructor the constructor to test.
|
||||
* @param {string} property the name of the options property to test.
|
||||
* @param {string} type the type that values of the property are expected to have
|
||||
* @param {Array} [values] an array of allowed values for the property. Not needed for boolean.
|
||||
* @param {any} fallback the fallback value that the property assumes if not provided.
|
||||
* @param {object} testOptions additional options:
|
||||
* @param {boolean} isOptional whether support for this property is optional for implementations.
|
||||
* @param {boolean} noReturn whether the resulting value of the property is not returned.
|
||||
* @param {boolean} isILD whether the resulting value of the property is implementation and locale dependent.
|
||||
* @param {object} extra additional option to pass along, properties are value -> {option: value}.
|
||||
* @return {boolean} whether the test succeeded.
|
||||
*/
|
||||
declare function testOption(Constructor: any, property: any, type: any, values: any, fallback: any, testOptions: any): boolean;
|
||||
/**
|
||||
* Tests whether the named property of the given object has a valid value
|
||||
* and the default attributes of the properties of an object literal.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {string} property the name of the property
|
||||
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
|
||||
* an array of valid values.
|
||||
* @exception if the property has an invalid value.
|
||||
*/
|
||||
declare function testProperty(obj: any, property: any, valid: any): void;
|
||||
/**
|
||||
* Tests whether the named property of the given object, if present at all, has a valid value
|
||||
* and the default attributes of the properties of an object literal.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {string} property the name of the property
|
||||
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
|
||||
* an array of valid values.
|
||||
* @exception if the property is present and has an invalid value.
|
||||
*/
|
||||
declare function mayHaveProperty(obj: any, property: any, valid: any): void;
|
||||
/**
|
||||
* Tests whether the given object has the named property with a valid value
|
||||
* and the default attributes of the properties of an object literal.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {string} property the name of the property
|
||||
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
|
||||
* an array of valid values.
|
||||
* @exception if the property is missing or has an invalid value.
|
||||
*/
|
||||
declare function mustHaveProperty(obj: any, property: any, valid: any): void;
|
||||
/**
|
||||
* Tests whether the given object does not have the named property.
|
||||
* @param {Object} obj the object to be tested.
|
||||
* @param {string} property the name of the property
|
||||
* @exception if the property is present.
|
||||
*/
|
||||
declare function mustNotHaveProperty(obj: any, property: any): void;
|
||||
/**
|
||||
* Properties of the RegExp constructor that may be affected by use of regular
|
||||
* expressions, and the default values of these properties. Properties are from
|
||||
* https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Deprecated_and_obsolete_features#RegExp_Properties
|
||||
*/
|
||||
declare var regExpProperties: string[];
|
||||
declare var regExpPropertiesDefaultValues: any;
|
||||
/**
|
||||
* Tests that executing the provided function (which may use regular expressions
|
||||
* in its implementation) does not create or modify unwanted properties on the
|
||||
* RegExp constructor.
|
||||
*/
|
||||
declare function testForUnwantedRegExpChanges(testFunc: any): void;
|
||||
/**
|
||||
* Tests whether name is a valid BCP 47 numbering system name
|
||||
* and not excluded from use in the ECMAScript Internationalization API.
|
||||
* @param {string} name the name to be tested.
|
||||
* @return {boolean} whether name is a valid BCP 47 numbering system name and
|
||||
* allowed for use in the ECMAScript Internationalization API.
|
||||
*/
|
||||
declare function isValidNumberingSystem(name: any): boolean;
|
||||
/**
|
||||
* Provides the digits of numbering systems with simple digit mappings,
|
||||
* as specified in 11.3.2.
|
||||
*/
|
||||
declare var numberingSystemDigits: {
|
||||
arab: string;
|
||||
arabext: string;
|
||||
beng: string;
|
||||
deva: string;
|
||||
fullwide: string;
|
||||
gujr: string;
|
||||
guru: string;
|
||||
hanidec: string;
|
||||
khmr: string;
|
||||
knda: string;
|
||||
laoo: string;
|
||||
latn: string;
|
||||
mlym: string;
|
||||
mong: string;
|
||||
mymr: string;
|
||||
orya: string;
|
||||
tamldec: string;
|
||||
telu: string;
|
||||
thai: string;
|
||||
tibt: string;
|
||||
};
|
||||
/**
|
||||
* Tests that number formatting is handled correctly. The function checks that the
|
||||
* digit sequences in formatted output are as specified, converted to the
|
||||
* selected numbering system, and embedded in consistent localized patterns.
|
||||
* @param {Array} locales the locales to be tested.
|
||||
* @param {Array} numberingSystems the numbering systems to be tested.
|
||||
* @param {Object} options the options to pass to Intl.NumberFormat. Options
|
||||
* must include {useGrouping: false}, and must cause 1.1 to be formatted
|
||||
* pre- and post-decimal digits.
|
||||
* @param {Object} testData maps input data (in ES5 9.3.1 format) to expected output strings
|
||||
* in unlocalized format with Western digits.
|
||||
*/
|
||||
declare function testNumberFormat(locales: any, numberingSystems: any, options: any, testData: any): void;
|
||||
/**
|
||||
* Return the components of date-time formats.
|
||||
* @return {Array} an array with all date-time components.
|
||||
*/
|
||||
declare function getDateTimeComponents(): string[];
|
||||
/**
|
||||
* Return the valid values for the given date-time component, as specified
|
||||
* by the table in section 12.1.1.
|
||||
* @param {string} component a date-time component.
|
||||
* @return {Array} an array with the valid values for the component.
|
||||
*/
|
||||
declare function getDateTimeComponentValues(component: any): any;
|
||||
/**
|
||||
* Tests that the given value is valid for the given date-time component.
|
||||
* @param {string} component a date-time component.
|
||||
* @param {string} value the value to be tested.
|
||||
* @return {boolean} true if the test succeeds.
|
||||
* @exception if the test fails.
|
||||
*/
|
||||
declare function testValidDateTimeComponentValue(component: any, value: any): boolean;
|
||||
/**
|
||||
* Verifies that the actual array matches the expected one in length, elements,
|
||||
* and element order.
|
||||
* @param {Array} expected the expected array.
|
||||
* @param {Array} actual the actual array.
|
||||
* @return {boolean} true if the test succeeds.
|
||||
* @exception if the test fails.
|
||||
*/
|
||||
declare function testArraysAreSame(expected: any, actual: any): boolean;
|
||||
/**
|
||||
* @description Helper methods for TypedArrays
|
||||
*/
|
||||
declare function CreateTypedArrayTypes(): [typeof Int8Array, typeof Uint8Array, typeof Int16Array, typeof Uint16Array, typeof Int32Array, typeof Uint32Array, typeof Float32Array, typeof Float64Array, typeof Uint8ClampedArray];
|
||||
declare function CreateTypedArrayInstances(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
|
||||
declare function CreateIntegerTypedArrayTypes(): [typeof Int8Array, typeof Uint8Array, typeof Int16Array, typeof Uint16Array, typeof Int32Array, typeof Uint32Array, typeof Uint8ClampedArray];
|
||||
declare function CreateIntegerTypedArrays(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Uint8ClampedArray];
|
||||
declare function CreateTypedRedcuedSetOfArrayTypes(): [typeof Float64Array];
|
||||
declare function CreateTypedRedcuedSetOfArrays(obj: any): [Float64Array];
|
||||
declare function CreateTypedArraysFrom(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
|
||||
declare function CreateTypedArraysOf(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
|
||||
declare function CreateTypedArraysFromMapFn(obj: any, mapFn: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
|
||||
declare function CreateTypedArraysFromThisObj(obj: any, mapFn: any, thisArg: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
|
||||
declare function CreatestringsOf(obj: any): string[];
|
||||
declare function CreateSignedTypedArrayInstances(obj: any): [Int8Array, Int16Array, Int32Array, Float32Array, Float64Array];
|
||||
declare function CreateUnSignedTypedArrayInstances(obj: any): [Uint8Array, Uint16Array, Uint32Array, Uint8ClampedArray];
|
||||
declare var $LOG: any;
|
||||
declare var WScript: any;
|
||||
declare var $DONE: any;
|
||||
Reference in New Issue
Block a user