Browse Source

js: fix missing variable

pull/766/head
Clement Denis 4 years ago
parent
commit
7737d99668
  1. 4
      js/tests/test.mjs

4
js/tests/test.mjs

@ -134,7 +134,7 @@ const loadAndSanitizeSolution = async name => {
// it's not that important if it doesn't work 100% of the time. // it's not that important if it doesn't work 100% of the time.
const code = rawCode.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, "").trim() const code = rawCode.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, "").trim()
if (code.includes("import")) fatal("import keyword not allowed") if (code.includes("import")) fatal("import keyword not allowed")
return { code, rawCode } return { code, rawCode, path }
} }
const runTests = async ({ url, path, code }) => { const runTests = async ({ url, path, code }) => {
@ -174,7 +174,7 @@ const main = async () => {
if (mode === "node") return runTests(await testNode({ test, name })) if (mode === "node") return runTests(await testNode({ test, name }))
if (mode === "inline") return runInlineTests({ json: test, name }) if (mode === "inline") return runInlineTests({ json: test, name })
const { rawCode, code } = await loadAndSanitizeSolution(name) const { rawCode, code, path } = await loadAndSanitizeSolution(name)
const parts = test.split("// /*/ // ⚡") const parts = test.split("// /*/ // ⚡")
const [inject, testCode] = parts.length < 2 ? ["", test] : parts const [inject, testCode] = parts.length < 2 ? ["", test] : parts
const combined = `${inject.trim()}\n${rawCode const combined = `${inject.trim()}\n${rawCode

Loading…
Cancel
Save