Fix: Running Test with a comment fails test on Understand The immediately invoked function expression iife (#39347)
* Update Regex to test if it's an IIFE instead of checking for a parenthases at the end. * Second Test will now pass the test * Escape One Parenthese * Update Regex to be more structured Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Missing regex ending literal Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
@ -33,7 +33,7 @@ tests:
|
|||||||
- text: The function should be anonymous.
|
- text: The function should be anonymous.
|
||||||
testString: assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, "")));
|
testString: assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, "")));
|
||||||
- text: Your function should have parentheses at the end of the expression to call it immediately.
|
- text: Your function should have parentheses at the end of the expression to call it immediately.
|
||||||
testString: assert(/}?\)\(\)$|}\(\)\)$/.test(code.replace(/[\s;]/g, "")));
|
testString: assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, "")));
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user