diff --git a/client/src/redux/propTypes.js b/client/src/redux/propTypes.js index 79797deb347..1b092fdf7ee 100644 --- a/client/src/redux/propTypes.js +++ b/client/src/redux/propTypes.js @@ -38,6 +38,7 @@ export const ChallengeNode = PropTypes.shape({ helpCategory: PropTypes.string, instructions: PropTypes.string, isComingSoon: PropTypes.bool, + removeComments: PropTypes.bool, isLocked: PropTypes.bool, isPrivate: PropTypes.bool, order: PropTypes.number, diff --git a/client/src/templates/Challenges/classic/Show.js b/client/src/templates/Challenges/classic/Show.js index 501d94dbc06..45315eeee4b 100644 --- a/client/src/templates/Challenges/classic/Show.js +++ b/client/src/templates/Challenges/classic/Show.js @@ -160,6 +160,7 @@ class ShowClassic extends Component { files, fields: { tests }, challengeType, + removeComments, helpCategory } }, @@ -171,6 +172,7 @@ class ShowClassic extends Component { updateChallengeMeta({ ...challengeMeta, title, + removeComments, challengeType, helpCategory }); @@ -365,6 +367,7 @@ export const query = graphql` title description instructions + removeComments challengeType helpCategory videoUrl diff --git a/client/src/templates/Challenges/redux/execute-challenge-saga.js b/client/src/templates/Challenges/redux/execute-challenge-saga.js index 5a5ac860448..d54c17be9d1 100644 --- a/client/src/templates/Challenges/redux/execute-challenge-saga.js +++ b/client/src/templates/Challenges/redux/execute-challenge-saga.js @@ -87,6 +87,7 @@ export function* executeChallengeSaga({ const protect = isLoopProtected(challengeMeta); const buildData = yield buildChallengeData(challengeData, { preview: false, + removeComments: challengeMeta.removeComments, protect }); const document = yield getContext('document'); @@ -201,6 +202,7 @@ function* previewChallengeSaga({ flushLogs = true } = {}) { const protect = isLoopProtected(challengeMeta); const buildData = yield buildChallengeData(challengeData, { preview: true, + removeComments: challengeMeta.removeComments, protect }); // evaluate the user code in the preview frame or in the worker diff --git a/client/src/templates/Challenges/utils/build.js b/client/src/templates/Challenges/utils/build.js index 844d442f071..399ee5c0f41 100644 --- a/client/src/templates/Challenges/utils/build.js +++ b/client/src/templates/Challenges/utils/build.js @@ -13,6 +13,7 @@ import { import frameRunnerData from '../../../../../config/client/frame-runner.json'; // eslint-disable-next-line import/no-unresolved import testEvaluatorData from '../../../../../config/client/test-evaluator.json'; +import { removeJSComments } from '../../../utils/curriculum-helpers'; const { filename: runner } = frameRunnerData; const { filename: testEvaluator } = testEvaluatorData; @@ -164,16 +165,27 @@ export function buildJSChallenge({ files }, options) { .map(pipeLine); return Promise.all(finalFiles) .then(checkFilesErrors) - .then(files => ({ - challengeType: challengeTypes.js, - build: files + .then(files => { + let build = files .reduce( (body, file) => [...body, file.head, file.contents, file.tail], [] ) - .join('\n'), - sources: buildSourceMap(files) - })); + .join('\n'); + let sources = buildSourceMap(files); + if (options?.removeComments !== false) { + build = removeJSComments(build); + sources = { + ...sources, + index: removeJSComments(sources.index) + }; + } + return { + challengeType: challengeTypes.js, + build, + sources + }; + }); } export function buildBackendChallenge({ url }) { diff --git a/client/src/utils/curriculum-helpers.js b/client/src/utils/curriculum-helpers.js index 73faf754889..18d70152916 100644 --- a/client/src/utils/curriculum-helpers.js +++ b/client/src/utils/curriculum-helpers.js @@ -5,7 +5,7 @@ const removeHtmlComments = str => str.replace(/|$)/g, ''); const removeCssComments = str => str.replace(/\/\*[\s\S]+?\*\//g, ''); -const removeJSComments = codeStr => { +export const removeJSComments = codeStr => { // Note: removes trailing new lines and tailing spaces at end of lines const options = { comments: false, @@ -30,7 +30,6 @@ const removeWhiteSpace = (str = '') => { const curriculumHelpers = { removeHtmlComments, removeCssComments, - removeJSComments, removeWhiteSpace }; diff --git a/client/src/utils/curriculum-helpers.test.js b/client/src/utils/curriculum-helpers.test.js index b8c5388f2cc..78617427588 100644 --- a/client/src/utils/curriculum-helpers.test.js +++ b/client/src/utils/curriculum-helpers.test.js @@ -1,6 +1,6 @@ /* global describe it expect */ -import __testHelpers from './curriculum-helpers'; +import __testHelpers, { removeJSComments } from './curriculum-helpers'; import jsTestValues from './__fixtures/curriculum-helpers-javascript'; import cssTestValues from './__fixtures/curriculum-helpers-css'; import htmlTestValues from './__fixtures/curriculum-helpers-html'; @@ -40,7 +40,6 @@ describe('removeWhiteSpace', () => { }); describe('removeJSComments', () => { - const { removeJSComments } = __testHelpers; it('returns a string', () => { expect(typeof removeJSComments('const should = "return a string"')).toBe( 'string' diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index e8f601ffc38..6b54fa33074 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ `copyMachine` 函数中应对 `arr` 使用展开运算符(`spread operator`)。 ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 50271224d64..9f9795a3fa7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -3,6 +3,7 @@ id: bd7123c9c441eddfaeb4bdef title: 给代码添加注释 challengeType: 1 videoUrl: 'https://scrimba.com/c/c7ynnTp' +removeComments: false forumTopicId: 16783 dashedName: comment-your-javascript-code --- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 174d5521b4b..60caa1a3e77 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ assert.throws(declared, ReferenceError); ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index faf39d12716..c390f0231c5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ assert( ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index bcd774cd2dd..9c78bdb9995 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ assert( ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 438d745a964..0afaced6178 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index fb98d4921b9..d4979f0bb7a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -32,9 +32,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c ```js assert( - __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) - .match(/console.clear\(\)/) + __helpers.removeWhiteSpace(code).match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index e69a8e8618b..12e2c13314f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,9 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g ) ); @@ -44,9 +42,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 5b8ac905e55..61c73ed8544 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ const { name, age } = user; ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,9 +51,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -65,9 +61,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 384c8052178..066695ef966 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ const person = { 不应使用传统的函数定义方法。 ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` 应是一个声明函数。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 6779b2adfc0..abeda98803c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), 不应该使用 `for`、`while` 或者 `forEach`。 ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` 应该使用 `map`、`filter` 或者 `reduce`。 @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index bd83907ddf0..2e512ac3020 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( 不能使用 `for` 循环。 ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` 你的代码应使用 `map` 方法。 diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73c..df442b6fc4a 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,9 +49,7 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( + !code.match( /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ ) ); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 912149a303e..9029b1b14b3 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ The `copyMachine` function should utilize the `spread operator` with array `arr` ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 5b6a9e09cc1..a5f59ff63f0 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,6 +2,7 @@ id: bd7123c9c441eddfaeb4bdef title: Comment Your JavaScript Code challengeType: 1 +removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index ac3ac95d154..21f992cdf66 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ You should add a local `myVar` variable. ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 0c060c2bcad..b7b76c9e4f4 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ Your code should not rely on any kind of loops (`for` or `while` or higher order ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ You should use recursion to solve this problem. ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 6ccaa692544..c5e30c4680d 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ Your code should not rely on any kind of loops (`for`, `while` or higher order f ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ You should use recursion to solve this problem. ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 2e10a18bfb1..3859da1fba2 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ Your code should not use any loop syntax (`for` or `while` or higher order funct ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index d1ebf6fe827..b3ec6b24bc7 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -33,7 +33,7 @@ You should use `console.clear()` to clear the browser console. ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index f8a96679630..83fb671b57c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,11 +32,7 @@ Make the promise handle success and failure. If `responseFromServer` is `true`, ```js assert( - __helpers - .removeJSComments(code) - .match( - /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g - ) + code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -44,11 +40,7 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( - /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g - ) + code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 64232d9a25a..5d71f583488 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ You should remove the ES5 assignment syntax. ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,11 +51,7 @@ You should use destructuring to create the `today` variable. ```js assert( - __helpers - .removeJSComments(code) - .match( - /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -65,11 +59,7 @@ You should use destructuring to create the `tomorrow` variable. ```js assert( - __helpers - .removeJSComments(code) - .match( - /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 4a0beacfc1c..4c319f7bf16 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ Refactor the function `setGear` inside the object `bicycle` to use the shorthand Traditional function expression should not be used. ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` should be a declarative function. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index bc3fb9f25e2..45242aadc4c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, and `forEach` should not be used. ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` `map`, `filter`, or `reduce` should be used. @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 698e2aaef99..253dfefbd6b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( Your code should not use a `for` loop. ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` Your code should use the `map` method. diff --git a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73c..b505cac1556 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,11 +49,7 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( - /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ - ) + !code.match(/(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 7d1659f07df..70c37d9ece9 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ La función `copyMachine` debe utilizar el `spread operator` (operador de propagación) con el arreglo `arr` ```js -assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); +assert(code.match(/\.\.\.arr/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index f9a854d947b..6a1eaf5d4b5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -3,6 +3,7 @@ id: bd7123c9c441eddfaeb4bdef title: Comenta tu código de JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/c7ynnTp' +removeComments: false forumTopicId: 16783 dashedName: comment-your-javascript-code --- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index d476b946a1c..1fef0ad88cd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -45,7 +45,7 @@ Debes agregar una variable local `myVar`. ```js assert( - /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test( + /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( __helpers.removeWhiteSpace(code) ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 5a25dc7c32a..8974b3fd8b8 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,9 +66,7 @@ Tu código no debe depender de ningún tipo de bluces (`for` o `while`) o funcio ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -76,7 +74,7 @@ Debes usar recursión para resolver este problema. ```js assert( - __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1 + sum.toString().match(/sum\(.*\)/g).length > 1 ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 1db82c20b47..5f6c13ec6d6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,9 +59,7 @@ Tu código no debe depender de ningún tipo de bucles (`for`, `while` o funcione ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -69,7 +67,7 @@ Debes usar recursión para resolver este problema. ```js assert( - __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/) + countdown.toString().match(/countdown\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 26b0e42fb86..40a5b6290a3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,9 +26,7 @@ Tu código no debe utilizar bucles (`for`, `while` o funciones de orden superior ```js assert( - !__helpers - .removeJSComments(code) - .match(/for|while|forEach|map|filter|reduce/g) + !code.match(/for|while|forEach|map|filter|reduce/g) ); ``` @@ -36,9 +34,7 @@ assert( ```js assert( - __helpers - .removeJSComments(rangeOfNumbers.toString()) - .match(/rangeOfNumbers\s*\(.+\)/) + rangeOfNumbers.toString().match(/rangeOfNumbers\s*\(.+\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 784a4ace20e..50a79aba171 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -33,7 +33,7 @@ Debes utilizar `console.clear()` para limpiar la consola del navegador. ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 7a8fcad3741..13a471d703b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,11 +32,9 @@ Haz una función promesa que maneje el éxito y el fallo. Si `responseFromServer ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g - ) + ) ); ``` @@ -44,11 +42,9 @@ assert( ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g - ) + ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index f44d4395cb9..65161f25c4f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,9 +43,7 @@ Debes eliminar la sintaxis de asignación ES5. ```js assert( - !__helpers - .removeJSComments(code) - .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -53,11 +51,9 @@ Debes usar desestructuración para crear la variable `today`. ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + ) ); ``` @@ -65,11 +61,9 @@ Debes usar desestructuración para crear la variable `tomorrow`. ```js assert( - __helpers - .removeJSComments(code) - .match( + code.match( /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g - ) + ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index f582298031b..b95869da43f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,7 +39,7 @@ Refactoriza la función `setGear` dentro del objeto `bicycle` para que utilice l La expresión tradicional "function" no debe ser utilizada. ```js -(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/)); +(getUserInput) => assert(!code.match(/function/)); ``` `setGear` debe ser una función declarativa. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index f69462da130..c9e73850e76 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, y `forEach` no deben ser usados. ```js -assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); +assert(!code.match(/for|while|forEach/g)); ``` `map`, `filter`, o `reduce` deben ser usados. @@ -36,7 +36,7 @@ assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(__helpers.removeJSComments(code)) + .removeWhiteSpace(code) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 0d37aef03bb..1b0c9a55089 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,7 +52,7 @@ assert( Tu código no debe usar un bucle `for`. ```js -assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); +assert(!code.match(/for\s*?\([\s\S]*?\)/)); ``` Tu código debe usar el método `map`. diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md b/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md index 6a0ed4ec73c..4eb842f9afc 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.md @@ -49,11 +49,9 @@ You should not copy and return the array. ```js assert( - !__helpers - .removeJSComments(code) - .match( + !code.match( /(1430952867)|(1460357289)|(1406357289)|(4130952867)|(4160357289)|(4106357289)/ - ) + ) ); ``` diff --git a/curriculum/schema/challengeSchema.js b/curriculum/schema/challengeSchema.js index 6c468d1caa9..86fe38b517e 100644 --- a/curriculum/schema/challengeSchema.js +++ b/curriculum/schema/challengeSchema.js @@ -25,6 +25,7 @@ const schema = Joi.object() block: Joi.string().regex(slugRE), blockId: Joi.objectId(), challengeOrder: Joi.number(), + removeComments: Joi.bool(), challengeType: Joi.number().min(0).max(11).required(), checksum: Joi.number(), // __commentCounts is only used to test the comment replacement diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index e2d5efba305..572443c95c9 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -520,11 +520,17 @@ async function createTestRunner( files[key].editableContents = solution[key].editableContents; }); - const { build, sources, loadEnzyme } = await buildChallenge({ - files, - required, - template - }); + const { build, sources, loadEnzyme } = await buildChallenge( + { + files, + required, + template + }, + { + removeComments: challenge.removeComments + } + ); + const code = { contents: sources.index, editableContents: sources.editableContents