Skip to content

Commit 0daf6a8

Browse files
DavertMikclaude
andcommitted
fix: resolve remaining CI failures
- Fix Map type annotation in store.js (TS error) - getMaskConfig falls back to global.maskSensitiveData for unit tests - Update ui_test.js to check store.featureOnly instead of process.env - Remove Object.defineProperty freeze on paths — causes issues when unit tests share process and shard_test calls initialize() first - Restore process.env.RUNS_WITH_WORKERS for cross-process communication (env vars cross process boundaries, store doesn't) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1a4a935 commit 0daf6a8

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

lib/command/run-workers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default async function (workerCount, selectedRuns, options) {
4242
output.print(`Running tests in ${output.styles.bold(numberOfWorkers)} workers...`)
4343
store.hasWorkers = true
4444
store.workerMode = true
45+
process.env.RUNS_WITH_WORKERS = 'true'
4546

4647
const workers = new Workers(numberOfWorkers, config)
4748
workers.overrideConfig(overrideConfigs)

lib/store.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const store = {
9393
/** @type {CodeceptJS.Suite | null} */
9494
currentSuite: null,
9595

96-
/** @type {Map | null} */
96+
/** @type {Map<string, string> | null} */
9797
tsFileMapping: null,
9898

9999
/**
@@ -109,9 +109,6 @@ const store = {
109109

110110
this._codeceptDir = opts.codeceptDir
111111
this._outputDir = opts.outputDir
112-
113-
Object.defineProperty(this, '_codeceptDir', { value: opts.codeceptDir, writable: false, configurable: false })
114-
Object.defineProperty(this, '_outputDir', { value: opts.outputDir, writable: false, configurable: false })
115112
},
116113
}
117114

lib/utils/mask_data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function maskData(input, config) {
3434
* @returns {boolean|object} - Current masking configuration
3535
*/
3636
export function getMaskConfig() {
37-
return store.maskSensitiveData || false
37+
return store.maskSensitiveData || global.maskSensitiveData || false
3838
}
3939

4040
/**

lib/workers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ class Workers extends EventEmitter {
506506
recorder.startUnlessRunning()
507507
event.dispatcher.emit(event.workers.before)
508508
store.workerMode = true
509+
process.env.RUNS_WITH_WORKERS = 'true'
509510

510511
// Create workers and set up message handlers immediately (not in recorder queue)
511512
// This prevents a race condition where workers start sending messages before handlers are attached
@@ -844,7 +845,7 @@ class Workers extends EventEmitter {
844845

845846
output.result(result.stats?.passes || 0, result.stats?.failures || 0, result.stats?.pending || 0, ms(result.duration), result.stats?.failedHooks || 0)
846847

847-
// workerMode stays true — frozen after initialize()
848+
process.env.RUNS_WITH_WORKERS = 'false'
848849
}
849850
}
850851

test/unit/mocha/ui_test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createTest } from '../../../lib/mocha/test.js'
55
import codeceptjs from '../../../lib/index.js'
66
import makeUI from '../../../lib/mocha/ui.js'
77
import container from '../../../lib/container.js'
8+
import store from '../../../lib/store.js'
89

910
global.codeceptjs = codeceptjs
1011

@@ -145,7 +146,7 @@ describe('ui', () => {
145146
}
146147

147148
// Reset environment variable
148-
delete process.env.FEATURE_ONLY
149+
store.featureOnly = false
149150

150151
// Re-emit pre-require with our mocked mocha instance
151152
suite.emit('pre-require', context, {}, mocha)
@@ -157,7 +158,7 @@ describe('ui', () => {
157158
expect(suiteConfig.suite.pending).eq(false, 'Feature.only must not be pending')
158159
expect(grepPattern).to.be.instanceOf(RegExp)
159160
expect(grepPattern.source).eq('^exclusive feature:')
160-
expect(process.env.FEATURE_ONLY).eq('true', 'FEATURE_ONLY environment variable should be set')
161+
expect(store.featureOnly).eq(true, 'store.featureOnly should be set')
161162

162163
// Restore original grep
163164
mocha.grep = originalGrep
@@ -176,7 +177,7 @@ describe('ui', () => {
176177
}
177178

178179
// Reset environment variable
179-
delete process.env.FEATURE_ONLY
180+
store.featureOnly = false
180181

181182
// Re-emit pre-require with our mocked mocha instance
182183
suite.emit('pre-require', context, {}, mocha)
@@ -188,7 +189,7 @@ describe('ui', () => {
188189
expect(suiteConfig.suite.pending).eq(false, 'Feature.only must not be pending')
189190
expect(grepPattern).to.be.instanceOf(RegExp)
190191
expect(grepPattern.source).eq('^exclusive feature without options:')
191-
expect(process.env.FEATURE_ONLY).eq('true', 'FEATURE_ONLY environment variable should be set')
192+
expect(store.featureOnly).eq(true, 'store.featureOnly should be set')
192193

193194
// Restore original grep
194195
mocha.grep = originalGrep

0 commit comments

Comments
 (0)