diff --git a/packages/reveal-test/dist/reveal-test.cjs b/packages/reveal-test/dist/reveal-test.cjs index 0ed9431..d372a14 100644 --- a/packages/reveal-test/dist/reveal-test.cjs +++ b/packages/reveal-test/dist/reveal-test.cjs @@ -63,10 +63,9 @@ const compile = async (info, retryOptions = {}) => { const failureMismatch = (output) => { return new compilerExplorerDirectives.CompileError(-1, error(`should have failed with '${info.failReason}'${output.length > 0 ? `\nactual output is:\n${output}` : ''}`)); }; - const resultPromise = compilerExplorerDirectives.compile(info, retryOptions); if (info.failReason) { try { - const result = await resultPromise; + const result = await compilerExplorerDirectives.compile(info, retryOptions); throw failureMismatch(result); } catch (err) { if (!err.message.includes(info.failReason)) { @@ -77,7 +76,7 @@ const compile = async (info, retryOptions = {}) => { } else { const result = await (async () => { try { - return await resultPromise; + return await compilerExplorerDirectives.compile(info, retryOptions); } catch (err) { const code = err.hasOwnProperty('code') ? err.code : -2; throw new compilerExplorerDirectives.CompileError(err.code, error(err.message)); diff --git a/packages/reveal-test/dist/reveal-test.cjs.map b/packages/reveal-test/dist/reveal-test.cjs.map index 0df3039..9bad053 100644 --- a/packages/reveal-test/dist/reveal-test.cjs.map +++ b/packages/reveal-test/dist/reveal-test.cjs.map @@ -1 +1 @@ -{"version":3,"file":"reveal-test.cjs","sources":["../src/reveal-test.js"],"sourcesContent":["'use strict';\n\nimport { parseCode, compile as origCompile, CompileError } from 'compiler-explorer-directives';\nimport MarkdownIt from 'markdown-it';\nimport { promises } from 'fs';\n\nconst parseMarkdownImpl = async (markdown, path, config = {}) => {\n const md = new MarkdownIt();\n const result = md.parse(markdown, {});\n return []\n .concat\n .apply([], await Promise.all(result\n .filter(({ type, tag }) => type === 'fence' && tag === 'code')\n .flatMap(async ({ content, info, map }) => {\n const [location, error] = (() => {\n if (path) {\n return [`${path}:${map[0] + 1}`, message => new Error(`${location}:\\n${message}`)];\n }\n return [undefined, message => new Error(message)];\n })();\n config = Object.assign(config, {\n directives: [\n ['fails=(.*)', (matches, info) => matches.slice(1).forEach(match => {\n if (info.hasOwnProperty('expectedOutput')) {\n throw error('cannot have \"fails\" and \"output\" together');\n }\n info.failReason = match;\n })],\n ['output=(.*)', (matches, info) => matches.slice(1).forEach(match => {\n if (info.hasOwnProperty('failReason')) {\n throw error('cannot have \"fails\" and \"output\" together');\n }\n info.expectedOutput = matches[1].replace(/\\\\n/g, '\\n');\n })]\n ]\n });\n const parsed = await parseCode(content.replace(//g, ''), info.replace(/(\\w+).*/, '$1'), config);\n if (!parsed) {\n return []\n }\n if (parsed && location) {\n parsed.path = location;\n }\n return [parsed];\n })));\n};\n\nconst parseMarkdown = async (path, config = {}) => {\n const markdown = await promises.readFile(path, 'utf-8');\n return await parseMarkdownImpl(markdown, path, config);\n}\n\nconst compile = async (info, retryOptions = {}) => {\n const error = (text) => {\n return `${info.path}:\\n${text}`;\n };\n const failureMismatch = (output) => {\n return new CompileError(-1, error(`should have failed with '${info.failReason}'${output.length > 0 ? `\\nactual output is:\\n${output}` : ''}`));\n };\n const resultPromise = origCompile(info, retryOptions)\n if (info.failReason) {\n try {\n const result = await resultPromise;\n throw failureMismatch(result);\n } catch (err) {\n if (!err.message.includes(info.failReason)) {\n throw failureMismatch(err.message);\n }\n return err.message;\n }\n } else {\n const result = await (async () => {\n try {\n return await resultPromise;\n } catch (err) {\n const code = err.hasOwnProperty('code') ? err.code : -2;\n throw new CompileError(err.code, error(err.message));\n }\n })();\n\n if (info.hasOwnProperty('expectedOutput') && !result.includes(info.expectedOutput)) {\n throw new CompileError(-3, error(`output mismatch:\\nactual: ${result}\\nexpected: ${info.expectedOutput}`));\n }\n\n return result;\n }\n};\n\nexport { parseMarkdown, compile, CompileError };\n"],"names":["MarkdownIt","parseCode","promises","CompileError","origCompile"],"mappings":";;;;;;;;;;;;AAMA,MAAM,iBAAiB,GAAG,OAAO,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,KAAK;AACjE,EAAE,MAAM,EAAE,GAAG,IAAIA,8BAAU,EAAE,CAAC;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AG,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7D,OAAO;AACP,KAAK,GAAG,CAAC;AACT;AACA,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;AACxF,MAAM,MAAM,IAAIA,uCAAY,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,0BAA0B,EAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,KAAK;AACL;AACA,IAAI,OAAO,MAAM,CAAC;AAClB,GAAG;AACH;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"reveal-test.cjs","sources":["../src/reveal-test.js"],"sourcesContent":["'use strict';\n\nimport { parseCode, compile as origCompile, CompileError } from 'compiler-explorer-directives';\nimport MarkdownIt from 'markdown-it';\nimport { promises } from 'fs';\n\nconst parseMarkdownImpl = async (markdown, path, config = {}) => {\n const md = new MarkdownIt();\n const result = md.parse(markdown, {});\n return []\n .concat\n .apply([], await Promise.all(result\n .filter(({ type, tag }) => type === 'fence' && tag === 'code')\n .flatMap(async ({ content, info, map }) => {\n const [location, error] = (() => {\n if (path) {\n return [`${path}:${map[0] + 1}`, message => new Error(`${location}:\\n${message}`)];\n }\n return [undefined, message => new Error(message)];\n })();\n config = Object.assign(config, {\n directives: [\n ['fails=(.*)', (matches, info) => matches.slice(1).forEach(match => {\n if (info.hasOwnProperty('expectedOutput')) {\n throw error('cannot have \"fails\" and \"output\" together');\n }\n info.failReason = match;\n })],\n ['output=(.*)', (matches, info) => matches.slice(1).forEach(match => {\n if (info.hasOwnProperty('failReason')) {\n throw error('cannot have \"fails\" and \"output\" together');\n }\n info.expectedOutput = matches[1].replace(/\\\\n/g, '\\n');\n })]\n ]\n });\n const parsed = await parseCode(content.replace(//g, ''), info.replace(/(\\w+).*/, '$1'), config);\n if (!parsed) {\n return []\n }\n if (parsed && location) {\n parsed.path = location;\n }\n return [parsed];\n })));\n};\n\nconst parseMarkdown = async (path, config = {}) => {\n const markdown = await promises.readFile(path, 'utf-8');\n return await parseMarkdownImpl(markdown, path, config);\n}\n\nconst compile = async (info, retryOptions = {}) => {\n const error = (text) => {\n return `${info.path}:\\n${text}`;\n };\n const failureMismatch = (output) => {\n return new CompileError(-1, error(`should have failed with '${info.failReason}'${output.length > 0 ? `\\nactual output is:\\n${output}` : ''}`));\n };\n if (info.failReason) {\n try {\n const result = await origCompile(info, retryOptions);\n throw failureMismatch(result);\n } catch (err) {\n if (!err.message.includes(info.failReason)) {\n throw failureMismatch(err.message);\n }\n return err.message;\n }\n } else {\n const result = await (async () => {\n try {\n return await origCompile(info, retryOptions);\n } catch (err) {\n const code = err.hasOwnProperty('code') ? err.code : -2;\n throw new CompileError(err.code, error(err.message));\n }\n })();\n\n if (info.hasOwnProperty('expectedOutput') && !result.includes(info.expectedOutput)) {\n throw new CompileError(-3, error(`output mismatch:\\nactual: ${result}\\nexpected: ${info.expectedOutput}`));\n }\n\n return result;\n }\n};\n\nexport { parseMarkdown, compile, CompileError };\n"],"names":["MarkdownIt","parseCode","promises","CompileError","origCompile"],"mappings":";;;;;;;;;;;;AAMA,MAAM,iBAAiB,GAAG,OAAO,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,KAAK;AACjE,EAAE,MAAM,EAAE,GAAG,IAAIA,8BAAU,EAAE,CAAC;AAC9B,EAAE,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACxC,EAAE,OAAO,EAAE;AACX,KAAK,MAAM;AACX,KAAK,KAAK,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM;AACvC,OAAO,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,KAAK,OAAO,IAAI,GAAG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CAAC,CAAC,0BAA0B,EAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,KAAK;AACL;AACA,IAAI,OAAO,MAAM,CAAC;AAClB,GAAG;AACH;;;;;;;;;;;"} \ No newline at end of file diff --git a/packages/reveal-test/src/reveal-test.js b/packages/reveal-test/src/reveal-test.js index 58b7ac0..aabad29 100644 --- a/packages/reveal-test/src/reveal-test.js +++ b/packages/reveal-test/src/reveal-test.js @@ -57,10 +57,9 @@ const compile = async (info, retryOptions = {}) => { const failureMismatch = (output) => { return new CompileError(-1, error(`should have failed with '${info.failReason}'${output.length > 0 ? `\nactual output is:\n${output}` : ''}`)); }; - const resultPromise = origCompile(info, retryOptions) if (info.failReason) { try { - const result = await resultPromise; + const result = await origCompile(info, retryOptions); throw failureMismatch(result); } catch (err) { if (!err.message.includes(info.failReason)) { @@ -71,7 +70,7 @@ const compile = async (info, retryOptions = {}) => { } else { const result = await (async () => { try { - return await resultPromise; + return await origCompile(info, retryOptions); } catch (err) { const code = err.hasOwnProperty('code') ? err.code : -2; throw new CompileError(err.code, error(err.message));