diff --git a/package-lock.json b/package-lock.json index aabfa71..e7f8d1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,13 +5,14 @@ "requires": true, "packages": { "": { + "name": "typescript-error-deltas", "version": "0.3.0", "license": "MIT", "dependencies": { "@octokit/rest": "^16.43.2", "@typescript/github-link": "^0.2.1", "@typescript/server-harness": "^0.3.4", - "@typescript/server-replay": "^0.2.10", + "@typescript/server-replay": "^0.2.11", "glob": "^7.2.3", "json5": "^2.2.1", "random-seed": "^0.3.0", @@ -1276,9 +1277,9 @@ "integrity": "sha512-W5Rczlpt73htFMH3OI1+r1TkUI7VEiUTYls72oFmQKmyav06vlaqIztmXGCGYSO2lbUsI72URPFzemeLH4itWQ==" }, "node_modules/@typescript/server-replay": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/@typescript/server-replay/-/server-replay-0.2.10.tgz", - "integrity": "sha512-Kpg5XDjEA7KJeUqhVIKoNgRNx61UODHObc95DF/0uvOQ/79fkXCuIBoG6Tx8pSRrZl/ff4qz+bhO7gjo9M7X5g==", + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@typescript/server-replay/-/server-replay-0.2.11.tgz", + "integrity": "sha512-U46OltXl1piUChuCV4LAysRLWIAiA6KjNWQ+yATGu1xC2YnVw0NqSJLgmfnAY/8kvljo4l/E+I0sNcj6SCrhKg==", "dependencies": { "@typescript/server-harness": "^0.3.4", "yargs": "^16.2.0" @@ -5739,9 +5740,9 @@ "integrity": "sha512-W5Rczlpt73htFMH3OI1+r1TkUI7VEiUTYls72oFmQKmyav06vlaqIztmXGCGYSO2lbUsI72URPFzemeLH4itWQ==" }, "@typescript/server-replay": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/@typescript/server-replay/-/server-replay-0.2.10.tgz", - "integrity": "sha512-Kpg5XDjEA7KJeUqhVIKoNgRNx61UODHObc95DF/0uvOQ/79fkXCuIBoG6Tx8pSRrZl/ff4qz+bhO7gjo9M7X5g==", + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@typescript/server-replay/-/server-replay-0.2.11.tgz", + "integrity": "sha512-U46OltXl1piUChuCV4LAysRLWIAiA6KjNWQ+yATGu1xC2YnVw0NqSJLgmfnAY/8kvljo4l/E+I0sNcj6SCrhKg==", "requires": { "@typescript/server-harness": "^0.3.4", "yargs": "^16.2.0" diff --git a/package.json b/package.json index 7a42a1e..18281f5 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@octokit/rest": "^16.43.2", "@typescript/github-link": "^0.2.1", "@typescript/server-harness": "^0.3.4", - "@typescript/server-replay": "^0.2.10", + "@typescript/server-replay": "^0.2.11", "glob": "^7.2.3", "json5": "^2.2.1", "random-seed": "^0.3.0", diff --git a/src/main.ts b/src/main.ts index b7d335c..1baf1a2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -332,9 +332,10 @@ ${fs.readFileSync(replayScriptPath, { encoding: "utf-8" }).split(/\r?\n/).slice( } // The URL of the artifact can be determined via AzDO REST APIs, but not until after the artifact is published - summary += `
  • Download ${replayScriptArtifactPath} from the artifact folder
  • \n`; + summary += `
  • Back in the initial folder, download ${replayScriptArtifactPath} from the artifact folder
  • \n`; summary += `
  • npm install --no-save @typescript/server-replay
  • \n`; summary += `
  • npx tsreplay ./${repo.name} ./${replayScriptName} path/to/tsserver.js
  • \n`; + summary += `
  • npx tsreplay --help to learn about helpful switches for debugging, logging, etc
  • \n`; summary += ` diff --git a/src/postGithubIssue.ts b/src/postGithubIssue.ts index 3db1041..48e498d 100644 --- a/src/postGithubIssue.ts +++ b/src/postGithubIssue.ts @@ -51,7 +51,7 @@ const title = entrypoint === "tsserver" const description = entrypoint === "tsserver" ? `The following errors were reported by ${newTscResolvedVersion}` : `The following errors were reported by ${newTscResolvedVersion}, but not by ${oldTscResolvedVersion}`; -const header = `${description} +let header = `${description} [Pipeline that generated this bug](https://typescript.visualstudio.com/TypeScript/_build?definitionId=48) [Logs for the pipeline run](${logUri}) [File that generated the pipeline](https://github.com/microsoft/typescript-error-deltas/blob/main/azure-pipelines-gitTests.yml) @@ -59,15 +59,43 @@ const header = `${description} This run considered ${repoCount} popular TS repos from GH (after skipping the top ${repoStartIndex}).
    -Successfully analyzed ${analyzedCount} of ${totalCount} visited repos +Successfully analyzed ${analyzedCount} of ${totalCount} visited repos${totalCount < +repoCount ? ` (:warning: expected ${repoCount})` : ""} | Outcome | Count | |---------|-------| ${Object.keys(statusCounts).sort().map(status => `| ${status} | ${statusCounts[status as RepoStatus]} |\n`).join("")} -
    `; + + +## Investigation Status +| Repo | Errors | Outcome | +|------|--------|---------| +`; const resultPaths = pu.glob(resultDirPath, `**/*.${resultFileNameSuffix}`).sort((a, b) => path.basename(a).localeCompare(path.basename(b))); const outputs = resultPaths.map(p => fs.readFileSync(p, { encoding: "utf-8" }).replace(new RegExp(artifactFolderUrlPlaceholder, "g"), artifactsUri)); +for (let i = 0; i < outputs.length; i++) { + const resultPath = resultPaths[i]; + const output = outputs[i]; + + const fileName = path.basename(resultPath); + const repoString = fileName.substring(0, fileName.length - resultFileNameSuffix.length - 1); + const repoName = repoString.replace(".", "/"); // The owner *probably* doesn't have a dot in it + + let errorCount = 0; + if (entrypoint === "tsserver") { + errorCount = 1; + } + else { + const re = /^\W*error TS\d+/gm; + while (re.exec(output)) { + errorCount++; + } + } + + header += `|${repoName}|${errorCount}| |\n`; +} + + const bodyChunks = [header, ...outputs]; git.createIssue(postResult, title, bodyChunks, /*sawNewErrors*/ !!outputs.length); \ No newline at end of file diff --git a/src/utils/exerciseServer.ts b/src/utils/exerciseServer.ts index 9da8bca..ea3e027 100644 --- a/src/utils/exerciseServer.ts +++ b/src/utils/exerciseServer.ts @@ -60,7 +60,7 @@ export async function exerciseServer(testDir: string, replayScriptPath: string, async function exerciseServerWorker(testDir: string, tsserverPath: string, replayScriptHandle: fs.promises.FileHandle, requestTimes: Record, requestCounts: Record): Promise { const files = await (new Promise((resolve, reject) => { - glob("**/*.@(ts|tsx|js|jsx)", { cwd: testDir, absolute: false, ignore: ["**/node_modules/**"], nodir: true, follow: false }, (err, results) => { + glob("**/*.@(ts|tsx|js|jsx)", { cwd: testDir, absolute: false, ignore: ["**/node_modules/**", "**/*.min.js"], nodir: true, follow: false }, (err, results) => { if (err) { reject(err); }