Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
571 changes: 289 additions & 282 deletions packages/typescript/test/async/api.test.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/typescript/test/async/astnav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
test,
} from "node:test";
import { fileURLToPath } from "node:url";
import { areTestsFiltered } from "../testUtils.ts";

// ---------------------------------------------------------------------------
// Go JSON baseline format
Expand Down Expand Up @@ -76,7 +77,7 @@ const baselineDir = resolve(repoRoot, "tsc/testdata/baselines/reference/astnav")
// Tests
// ---------------------------------------------------------------------------

describe("astnav", () => {
describe("astnav", { concurrency: areTestsFiltered() }, () => {
let fileText: string;

try {
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript/test/diagnosticFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
describe,
test,
} from "node:test";
import { areTestsFiltered } from "./testUtils.ts";

describe("diagnosticFormatter", () => {
describe("diagnosticFormatter", { concurrency: areTestsFiltered() }, () => {
test("formats diagnostics with a configured program host", async () => {
const source = `const x: number = "oops";\n`;
const api = spawnAPI({
Expand Down
9 changes: 6 additions & 3 deletions packages/typescript/test/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import {
NODE_OFFSET_DATA,
} from "../src/api/node/protocol.ts";
import { Wtf8Decoder } from "../src/api/node/wtf8.ts";
import { areTestsFiltered } from "./testUtils.ts";

const concurrency = areTestsFiltered();

function makeSF(text: string, fileName: string, statements: readonly Statement[]): SourceFile {
const endOfFileToken = createToken(SyntaxKind.EndOfFile);
Expand All @@ -57,7 +60,7 @@ function decode(data: Uint8Array): RemoteSourceFile {
return new RemoteSourceFile(data, new Wtf8Decoder());
}

describe("Encoder", () => {
describe("Encoder", { concurrency }, () => {
test("encodes empty source file", () => {
const sf = makeSF("", "/test.ts", []);

Expand Down Expand Up @@ -348,7 +351,7 @@ describe("Encoder", () => {
});
});

describe("UTF-8 vs UTF-16 position encoding", () => {
describe("UTF-8 vs UTF-16 position encoding", { concurrency }, () => {
// Positions in the encoded AST must be UTF-16 code unit offsets so that
// file.text.slice(node.pos, node.end) works correctly on JS strings.
// This is the same convention TypeScript uses.
Expand Down Expand Up @@ -409,7 +412,7 @@ describe("UTF-8 vs UTF-16 position encoding", () => {
});
});

describe("Line and character mapping", () => {
describe("Line and character mapping", { concurrency }, () => {
function makeSourceFile(text: string): RemoteSourceFile {
return decode(encodeSourceFile(makeSF(text, "/test.ts", [])));
}
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript/test/spanMap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
describe,
test,
} from "node:test";
import { areTestsFiltered } from "./testUtils.ts";

describe("SpanMap", () => {
describe("SpanMap", { concurrency: areTestsFiltered() }, () => {
const map = new SpanMap([
{ virtualStart: 2, virtualEnd: 6, originalStart: 10, originalEnd: 14, kind: SpanMapKind.Verbatim },
{ virtualStart: 8, virtualEnd: 11, originalStart: 20, originalEnd: 27, kind: SpanMapKind.Atom },
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript/test/sync/api-generators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
type APIRequestGenerator,
executeRequestGenerators,
} from "../../src/api/sync/generatorSupport.ts";
import { areTestsFiltered } from "../testUtils.ts";
import { spawnAPI } from "./api.testUtils.ts";

const parityFiles = {
Expand Down Expand Up @@ -415,7 +416,7 @@ function assertPublicGeneratorCoverage(owners: readonly { readonly name: string;
assert.deepEqual(missing, [], `Uncovered public generator getters: ${missing.join(", ")}`);
}

describe("API - generator batching", () => {
describe("API - generator batching", { concurrency: areTestsFiltered() }, () => {
test("batches source file requests", context => {
const api = spawnAPI(parityFiles);
context.after(() => api.close());
Expand Down
Loading
Loading