Hello, I’ve decided to start contributing to the open source code base, I picked an issue, wrote my first line of code, ran the rest for it, and it failed one of the tests. Here is the error:
916 passing (19s)
1 failing
1) Check challenges
Check challenges (english)
basic-javascript
Iterate Through an Array with a For Loop
Check tests against solutions
Solution 1 must pass the tests:
Test text: <p>You should be using the elements of <code>myArr</code> to update <code>total</code>.</p>
AssertionError: Unspecified AssertionError
at eval (eval at _callee$ (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:224375), <anonymous>:33:1)
at _callee$ (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:224375)
at f (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:197111)
at Generator._invoke (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:196899)
at Generator.next (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:197540)
at n (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:217790)
at s (http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:217993)
at http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:218052
at new Promise (<anonymous>)
at http://127.0.0.1:8080/js/test-evaluator.721fcd3ab20c7625dd0d.js:2:217933
Here is the content under the # --hints--
heading:
# --hints--
`total` should be declared and initialized to 0.
```js
assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
```
`total` should equal 20.
```js
assert(total === 20);
```
You should use a `for` loop to iterate through `myArr`.
```js
assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code));
```
You should not attempt to directly assign the value 20 to `total`.
```js
assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
```
You should be using the elements of `myArr` to update `total`.
```js
assert(!__helpers.removeWhiteSpace(code).match(/total[+=-]+\S*myArr\[\w[\w\d]*\]/gm));
```
The last assertion and the hint above it is what I added:
You should be using the elements of `myArr` to update `total`.
```js
assert(!__helpers.removeWhiteSpace(code).match(/total[+=-]+\S*myArr\[\w[\w\d]*\]/gm));
```
It seems like the lines I added are formatted the same way as the other assertions, so I’m not sure why that test failed.
Note: the issue this is supposed to be for is Challenge: Iterate through an array with a for loop (Make test and requirements stricter) #45041 (I know there is already a PR for this issue, that happened while I was still trying to figure out how this all works, but I still want to work through this problem in order to understand what’s going on before moving on to a different issue.)