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
@ -3,6 +3,7 @@ id: bd7123c9c441eddfaeb4bdef
|
||||
title: 给代码添加注释
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/c7ynnTp'
|
||||
removeComments: false
|
||||
forumTopicId: 16783
|
||||
dashedName: comment-your-javascript-code
|
||||
---
|
||||
|
@ -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)
|
||||
)
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
```
|
||||
|
||||
|
@ -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*\(.+\)/)
|
||||
);
|
||||
```
|
||||
|
||||
|
@ -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*\(.+\)/)
|
||||
);
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user