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
@ -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
|
||||
)
|
||||
);
|
||||
|
@ -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
|
||||
)
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ const person = {
|
||||
不应使用传统的函数定义方法。
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/));
|
||||
(getUserInput) => assert(!code.match(/function/));
|
||||
```
|
||||
|
||||
`setGear` 应是一个声明函数。
|
||||
|
Reference in New Issue
Block a user