Skip to content

Commit 5ab8507

Browse files
Copilotkobenguyent
andcommitted
Fix syntax errors and restore missing functions in workers implementation
- Fixed corrupted filterTestById function in runTests.js - Restored missing createGroupsOfSuites function in workers.js - Fixed syntax error caused by misplaced code - Worker tests now pass successfully Co-authored-by: kobenguyent <[email protected]>
1 parent 2cd479d commit 5ab8507

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

lib/command/workers/runTests.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,13 @@ async function runPoolTests() {
144144
}
145145

146146
function filterTestById(testUid) {
147-
// Clear previous tests
147+
// Find and filter to only the specific test
148148
for (const suite of mocha.suite.suites) {
149-
suite.tests = []
150-
}
151-
152-
// Add only the specific test
153-
for (const suite of mocha.suite.suites) {
154-
const originalTests = suite.tests
155149
suite.tests = suite.tests.filter(test => test.uid === testUid)
156-
157-
// If we found the test, break out
158-
if (suite.tests.length > 0) {
159-
break
160-
}
161-
162-
// Restore original tests for next iteration
163-
suite.tests = originalTests
164150
}
165151
}
152+
153+
function filterTests() {
166154
const files = codecept.testFiles
167155
mocha.files = files
168156
mocha.loadFiles()

lib/workers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ class Workers extends EventEmitter {
343343
getNextTest() {
344344
return this.testPool.shift() || null
345345
}
346+
347+
/**
348+
* @param {Number} numberOfWorkers
349+
*/
350+
createGroupsOfSuites(numberOfWorkers) {
346351
const files = this.codecept.testFiles
347352
const groups = populateGroups(numberOfWorkers)
348353

0 commit comments

Comments
 (0)