From e62295e744c7ea9a9be02aeff057669984ac2213 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Mon, 31 Oct 2022 11:45:04 -0700 Subject: [PATCH] Test error matcher text --- lib/error-matcher.js | 2 +- lib/error-matcher.js.map | 2 +- lib/error-matcher.test.js | 3 +-- lib/error-matcher.test.js.map | 2 +- src/error-matcher.test.ts | 3 +-- src/error-matcher.ts | 4 +++- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/error-matcher.js b/lib/error-matcher.js index 07d5e7157..5a7c6b64b 100644 --- a/lib/error-matcher.js +++ b/lib/error-matcher.js @@ -8,7 +8,7 @@ exports.namedMatchersForTesting = { */ noSourceCodeFound: { exitCode: 32, - outputRegex: new RegExp("No JavaScript or TypeScript code found\\."), + outputRegex: new RegExp("Only found JavaScript or TypeScript files that were empty or contained syntax errors\\."), message: "No code found during the build. Please see:\n" + "https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning#no-code-found-during-the-build", }, diff --git a/lib/error-matcher.js.map b/lib/error-matcher.js.map index 8d87726bb..23c0c3031 100644 --- a/lib/error-matcher.js.map +++ b/lib/error-matcher.js.map @@ -1 +1 @@ -{"version":3,"file":"error-matcher.js","sourceRoot":"","sources":["../src/error-matcher.ts"],"names":[],"mappings":";;;AAQA,qCAAqC;AACxB,QAAA,uBAAuB,GAAoC;IACtE;;MAEE;IACF,iBAAiB,EAAE;QACjB,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,IAAI,MAAM,CAAC,2CAA2C,CAAC;QACpE,OAAO,EACL,+CAA+C;YAC/C,yJAAyJ;KAC5J;CACF,CAAC;AAEF,oEAAoE;AACvD,QAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,+BAAuB,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"error-matcher.js","sourceRoot":"","sources":["../src/error-matcher.ts"],"names":[],"mappings":";;;AAQA,qCAAqC;AACxB,QAAA,uBAAuB,GAAoC;IACtE;;MAEE;IACF,iBAAiB,EAAE;QACjB,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,IAAI,MAAM,CACrB,yFAAyF,CAC1F;QACD,OAAO,EACL,+CAA+C;YAC/C,yJAAyJ;KAC5J;CACF,CAAC;AAEF,oEAAoE;AACvD,QAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,+BAAuB,CAAC,CAAC"} \ No newline at end of file diff --git a/lib/error-matcher.test.js b/lib/error-matcher.test.js index 198b00c03..d0098749d 100644 --- a/lib/error-matcher.test.js +++ b/lib/error-matcher.test.js @@ -11,8 +11,7 @@ NB We test the regexes for all the matchers against example log output snippets. (0, ava_1.default)("noSourceCodeFound matches against example javascript output", async (t) => { t.assert(testErrorMatcher("noSourceCodeFound", ` 2020-09-07T17:39:53.9050522Z [2020-09-07 17:39:53] [build] Done extracting /opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/data/externs/web/ie_vml.js (3 ms) - 2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found. - 2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found. + 2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-stderr] Only found JavaScript or TypeScript files that were empty or contained syntax errors. 2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh]) `)); }); diff --git a/lib/error-matcher.test.js.map b/lib/error-matcher.test.js.map index 09ad756c7..0e7b7f254 100644 --- a/lib/error-matcher.test.js.map +++ b/lib/error-matcher.test.js.map @@ -1 +1 @@ -{"version":3,"file":"error-matcher.test.js","sourceRoot":"","sources":["../src/error-matcher.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,mDAA0D;AAE1D;;EAEE;AAEF,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,CAAC,CAAC,MAAM,CACN,gBAAgB,CACd,mBAAmB,EACnB;;;;;GAKH,CACE,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,IAAI,CAAC,CAAC,WAAW,IAAI,uCAAuB,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CAAC,mBAAmB,WAAW,EAAE,CAAC,CAAC;KACnD;IACD,MAAM,KAAK,GAAG,uCAAuB,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC;IAC/D,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,kBAAkB,CAAC,CAAC;KACvE;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file +{"version":3,"file":"error-matcher.test.js","sourceRoot":"","sources":["../src/error-matcher.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,mDAA0D;AAE1D;;EAEE;AAEF,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,CAAC,CAAC,MAAM,CACN,gBAAgB,CACd,mBAAmB,EACnB;;;;GAIH,CACE,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,IAAI,CAAC,CAAC,WAAW,IAAI,uCAAuB,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CAAC,mBAAmB,WAAW,EAAE,CAAC,CAAC;KACnD;IACD,MAAM,KAAK,GAAG,uCAAuB,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC;IAC/D,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,kBAAkB,CAAC,CAAC;KACvE;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/src/error-matcher.test.ts b/src/error-matcher.test.ts index 9d8e8a257..43e8f0a85 100644 --- a/src/error-matcher.test.ts +++ b/src/error-matcher.test.ts @@ -12,8 +12,7 @@ test("noSourceCodeFound matches against example javascript output", async (t) => "noSourceCodeFound", ` 2020-09-07T17:39:53.9050522Z [2020-09-07 17:39:53] [build] Done extracting /opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/data/externs/web/ie_vml.js (3 ms) - 2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found. - 2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found. + 2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-stderr] Only found JavaScript or TypeScript files that were empty or contained syntax errors. 2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh]) ` ) diff --git a/src/error-matcher.ts b/src/error-matcher.ts index ebbc5484d..8cf1c3608 100644 --- a/src/error-matcher.ts +++ b/src/error-matcher.ts @@ -13,7 +13,9 @@ export const namedMatchersForTesting: { [key: string]: ErrorMatcher } = { */ noSourceCodeFound: { exitCode: 32, - outputRegex: new RegExp("No JavaScript or TypeScript code found\\."), + outputRegex: new RegExp( + "Only found JavaScript or TypeScript files that were empty or contained syntax errors\\." + ), message: "No code found during the build. Please see:\n" + "https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning#no-code-found-during-the-build",