Skip to content

Commit d8ba052

Browse files
kenherringCopilot
andauthored
Clear environment variable when initializationProcedure is no longer set (#565)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kenherring <3201462+kenherring@users.noreply.github.com>
1 parent cbf6c51 commit d8ba052

6 files changed

Lines changed: 35 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# [1.4.31](https://github.com/kenherring/ablunit-test-runner/releases/tag/1.4.31) - 2026-04-09 (pre-release)
1+
# [1.4.33](https://github.com/kenherring/ablunit-test-runner/releases/tag/1.4.33) - 2026-04-15 (pre-release)
22

3+
* Clear environment variable when `initializationProcedure` is no longer set (#565)
4+
* build(deps-dev): bump typescript-eslint from 8.58.0 to 8.58.1 (#563)
35
* Empty `dbConnections` array in openedge-project profile are not used (#560)
46
* Fix create-release action and a few lint errors (#559)
57
* Allow `.exe` extension in the executable field for ablunit-test-profile.json (#558)
@@ -68,7 +70,7 @@
6870
* Bump esbuild from 0.27.0 to 0.27.1 (#457)
6971
* Bump jws from 3.2.2 to 3.2.3 in the npm_and_yarn group across 1 directory (#455)
7072

71-
**Full Changelog**: [1.4.4...1.4.31](https://github.com/kenherring/ablunit-test-runner/compare/1.4.4...1.4.31)
73+
**Full Changelog**: [1.4.4...1.4.33](https://github.com/kenherring/ablunit-test-runner/compare/1.4.4...1.4.33)
7274

7375
# [1.4.4](https://github.com/kenherring/ablunit-test-runner/releases/tag/1.4.4) - 2025-11-26 (pre-release)
7476

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ablunit-test-runner",
33
"displayName": "ABLUnit Test Runner",
44
"description": "OpenEdge ABLUnit test runner for VSCode",
5-
"version": "1.4.31",
5+
"version": "1.4.33",
66
"engineStrict": true,
77
"galleryBanner": {
88
"color": "#007ACC",

resources/VSCodeTestRunner/ABLUnitCore.p

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ procedure main :
125125
define variable initializationProcedure as character no-undo.
126126
initializationProcedure = os-getenv('ABLUNIT_INITIALIZATION_PROCEDURE').
127127
if initializationProcedure <> ? and initializationProcedure > '' then
128+
do:
129+
if search(initializationProcedure) = ? then
130+
do:
131+
undo, throw new Progress.Lang.AppError('Initialization procedure ' + initializationProcedure + ' not found in PROPATH', 89).
132+
end.
133+
128134
run value(initializationProcedure).
135+
end.
129136

130137
run VSCode/ABLRunner-wrapper.p(testConfig, updateFile).
131138
if VERBOSE then message 'END main'.
@@ -166,7 +173,7 @@ catch e as Progress.Lang.Error:
166173
define variable i as integer no-undo.
167174
do i = 1 to e:NumMessages:
168175
message '[ABLRunner error]' e:GetMessage(i) view-as alert-box error.
169-
if not e:GetMessage(1) begins 'Unable to build type info' then
176+
if e:CallStack <> ? and not e:GetMessage(1) begins 'Unable to build type info' then
170177
do:
171178
message '[ABLRunner error]~t' + replace(e:CallStack, '~n', '~n[ABLRunner error]~t').
172179
end.

src/ABLUnitRun.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ function setCurrentTestItem (ablunitStatus: IABLUnitStatus) {
479479
}
480480

481481
export function getEnvVars (dlcUri: Uri | undefined, maxWait = 30000, initializationProcedure?: string) {
482-
const runenv = process.env
482+
const runenv = { ...process.env }
483483
let envConfig: Record<string, string> | undefined = undefined
484484
if (process.platform === 'win32') {
485485
envConfig = workspace.getConfiguration('terminal').get('integrated.env.windows')
@@ -503,6 +503,8 @@ export function getEnvVars (dlcUri: Uri | undefined, maxWait = 30000, initializa
503503
runenv['ABLUNIT_TEST_RUNNER_DEBUG_MAX_WAIT'] = maxWait.toString()
504504
if (initializationProcedure) {
505505
runenv['ABLUNIT_INITIALIZATION_PROCEDURE'] = initializationProcedure
506+
} else {
507+
delete runenv['ABLUNIT_INITIALIZATION_PROCEDURE']
506508
}
507509
return runenv
508510
}

test/suites/proj8.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,21 @@ suite('proj8 - Extension Test Suite', () => {
4646
})
4747
})
4848

49+
test('proj8.3 - getEnvVars does not mutate process.env for initializationProcedure', () => {
50+
const key = 'ABLUNIT_INITIALIZATION_PROCEDURE'
51+
const original = process.env[key]
52+
process.env[key] = 'original-value'
53+
try {
54+
const envVars = getEnvVars(undefined, 30000)
55+
assert.strictEqual(envVars[key], undefined)
56+
assert.strictEqual(process.env[key], 'original-value')
57+
} finally {
58+
if (original === undefined) {
59+
delete process.env.ABLUNIT_INITIALIZATION_PROCEDURE
60+
} else {
61+
process.env[key] = original
62+
}
63+
}
64+
})
65+
4966
})

0 commit comments

Comments
 (0)