From 15f67e0b482faf9f6a3ab9965f3c11196bf3e99b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 26 Jun 2024 09:41:01 -0700 Subject: [PATCH] =?UTF-8?q?Option=20to=20skipSysTests=20since=20they=20don?= =?UTF-8?q?t=20change=20branch=20to=20branch=20and=20ca=E2=80=A6=20(#59025?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/build/options.mjs | 1 + scripts/build/tests.mjs | 9 ++++++--- src/testRunner/runner.ts | 5 +++++ src/testRunner/unittests/sys/symlinkWatching.ts | 8 +++++++- src/testRunner/unittests/tsserver/findAllReferences.ts | 2 +- src/testRunner/unittests/tsserver/goToDefinition.ts | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/build/options.mjs b/scripts/build/options.mjs index c4cb9c47233..0d3a2093359 100644 --- a/scripts/build/options.mjs +++ b/scripts/build/options.mjs @@ -68,6 +68,7 @@ export default options; * @property {boolean} fix * @property {string} browser * @property {string} tests + * @property {boolean} skipSysTests * @property {string | boolean} break * @property {string | boolean} inspect * @property {string} runners diff --git a/scripts/build/tests.mjs b/scripts/build/tests.mjs index d247694dcb3..d5a273aa41d 100644 --- a/scripts/build/tests.mjs +++ b/scripts/build/tests.mjs @@ -31,6 +31,7 @@ export const coverageDir = "coverage"; export async function runConsoleTests(runJs, defaultReporter, runInParallel, options = {}) { const testTimeout = cmdLineOptions.timeout; const tests = cmdLineOptions.tests; + const skipSysTests = cmdLineOptions.skipSysTests; const inspect = cmdLineOptions.break || cmdLineOptions.inspect; const runners = cmdLineOptions.runners; const light = cmdLineOptions.light; @@ -74,8 +75,8 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt console.log(chalk.yellowBright(`[watch] running tests...`)); } - if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) { - writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId); + if (tests || skipSysTests || runners || light || testTimeout || taskConfigsFolder || keepFailed || shards || shardId) { + writeTestConfigFile(tests, skipSysTests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId); } const colors = cmdLineOptions.colors; @@ -180,6 +181,7 @@ export async function cleanTestDirs() { /** * used to pass data from command line directly to run.js * @param {string} tests + * @param {boolean} skipSysTests * @param {string} runners * @param {boolean} light * @param {string} [taskConfigsFolder] @@ -190,9 +192,10 @@ export async function cleanTestDirs() { * @param {number | undefined} [shards] * @param {number | undefined} [shardId] */ -export function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) { +export function writeTestConfigFile(tests, skipSysTests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) { const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, + skipSysTests: skipSysTests ? skipSysTests : undefined, runners: runners ? runners.split(",") : undefined, light, workerCount, diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index 12fc1308ecb..b460ab810c5 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -88,6 +88,7 @@ const testConfigContent = customConfig && IO.fileExists(customConfig) export let taskConfigsFolder: string; export let workerCount: number; export let runUnitTests: boolean | undefined; +export let skipSysTests: boolean | undefined; export let stackTraceLimit: number | "full" | undefined; export let noColors = false; export let keepFailed = false; @@ -101,6 +102,7 @@ export interface TestConfig { test?: string[]; runners?: string[]; runUnitTests?: boolean; + skipSysTests?: boolean; noColors?: boolean; timeout?: number; keepFailed?: boolean; @@ -143,6 +145,9 @@ function handleTestConfig() { if (testConfig.shards) { setShards(testConfig.shards); } + if (testConfig.skipSysTests) { + skipSysTests = true; + } if (testConfig.stackTraceLimit === "full") { (Error as any).stackTraceLimit = Infinity; diff --git a/src/testRunner/unittests/sys/symlinkWatching.ts b/src/testRunner/unittests/sys/symlinkWatching.ts index 142c02fb215..f4bf768d046 100644 --- a/src/testRunner/unittests/sys/symlinkWatching.ts +++ b/src/testRunner/unittests/sys/symlinkWatching.ts @@ -1,6 +1,9 @@ import * as fs from "fs"; -import { IO } from "../../_namespaces/Harness.js"; +import { + IO, + skipSysTests, +} from "../../_namespaces/Harness.js"; import * as ts from "../../_namespaces/ts.js"; import { defer, @@ -30,6 +33,7 @@ describe("unittests:: sys:: symlinkWatching::", () => { watchOptions: Pick, getFileName?: (file: string) => string, ) { + if (skipSysTests) return; it(scenario, async () => { const fileResult = watchFile(file); const linkResult = watchFile(link); @@ -191,6 +195,7 @@ describe("unittests:: sys:: symlinkWatching::", () => { link: string, osFlavor: TestServerHostOsFlavor, ) { + if (skipSysTests) return; it(`watchDirectory using fsEvents ${osFlavorToString(osFlavor)}`, async () => { const tableOfEvents: FsEventsForWatchDirectory = osFlavor === TestServerHostOsFlavor.MacOs ? { @@ -355,6 +360,7 @@ describe("unittests:: sys:: symlinkWatching::", () => { link: string, osFlavor: TestServerHostOsFlavor.Windows | TestServerHostOsFlavor.MacOs, ) { + if (skipSysTests) return; const tableOfEvents: RecursiveFsEventsForWatchDirectory = osFlavor === TestServerHostOsFlavor.MacOs ? { fileCreate: [ diff --git a/src/testRunner/unittests/tsserver/findAllReferences.ts b/src/testRunner/unittests/tsserver/findAllReferences.ts index 3ed4ee78ed4..729f1cf5ac9 100644 --- a/src/testRunner/unittests/tsserver/findAllReferences.ts +++ b/src/testRunner/unittests/tsserver/findAllReferences.ts @@ -8,7 +8,7 @@ import { File, } from "../helpers/virtualFileSystemWithWatch.js"; -describe("unittests:: services:: findAllReferences", () => { +describe("unittests:: tsserver:: services:: findAllReferences", () => { it("does not try to open a file in a project that was updated and no longer has the file", () => { const files: File[] = [ { diff --git a/src/testRunner/unittests/tsserver/goToDefinition.ts b/src/testRunner/unittests/tsserver/goToDefinition.ts index 2ffbde53847..be9af814930 100644 --- a/src/testRunner/unittests/tsserver/goToDefinition.ts +++ b/src/testRunner/unittests/tsserver/goToDefinition.ts @@ -8,7 +8,7 @@ import { File, } from "../helpers/virtualFileSystemWithWatch.js"; -describe("unittests:: services:: goToDefinition", () => { +describe("unittests:: tsserver:: services:: goToDefinition", () => { it("does not issue errors on jsdoc in TS", () => { const files: File[] = [ {