fix(client): remove JS comments from user code for tests (#41873)
* Removes comments in js challanges by default * fix local-scope-and-functions test regex * fix all languages * revert language changes * removed unnecessary removeJSComments from challenges * fix challanges in other languages * removed removeJSComments from all challanges
This commit is contained in:
committed by
GitHub
parent
ebe8f99345
commit
db369fbed1
@ -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
|
||||
|
@ -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)
|
||||
)
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
```
|
||||
|
||||
|
@ -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*\(.+\)/)
|
||||
);
|
||||
```
|
||||
|
||||
|
@ -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*\(.+\)/)
|
||||
);
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user