Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
RELNOTES: Fix edge-case in TestCase autodiscovery.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 329396478
  • Loading branch information
12wrigja authored and shicks committed Sep 3, 2020
1 parent fb4ad0e commit d4df5d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion closure/goog/testing/testcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ goog.testing.TestCase.prototype.addTestObj_ = function(obj, name, objChain) {
var fullTestName = name + (testName && name ? '_' : '') + testName;
if (goog.isFunction(testProperty)) {
this.addNewTest(fullTestName, testProperty, obj, objChain);
} else if (goog.isObject(testProperty)) {
} else if (goog.isObject(testProperty) && !Array.isArray(testProperty)) {
// To prevent infinite loops.
if (!goog.array.contains(objChain, testProperty)) {
goog.asserts.assertObject(testProperty);
Expand Down
14 changes: 14 additions & 0 deletions closure/goog/testing/testcase_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ goog.global.mockTestName = function() {
return failGoogPromise();
};

/**
* A variable with the same autodiscovery prefix, used by
* `testInitializeTestCase`. TestCase does not support auto-discovering tests
* within Arrays, either as functions added to the array object or as a value
* within the array (as it never recurses into the content of the array).
*/
goog.global.mockTestNameValues = ['hello', 'world'];
/**
* @return {!GoogPromise<?>}
*/
goog.global.mockTestNameValues.mockTestNameTestShouldNotBeRun = function() {
return failGoogPromise();
};

testSuite({
setUp() {
events = [];
Expand Down

0 comments on commit d4df5d4

Please sign in to comment.