Skip to content

Commit 5b1bab2

Browse files
Copilotjfoshee
andcommitted
Address test file feedback: fix imports, use fs.rmSync, remove single string test
Co-authored-by: jfoshee <[email protected]>
1 parent 59454b8 commit 5b1bab2

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

extension/test/unit/testEnvFiles.test.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See LICENSE in the project root for license information.
44
*--------------------------------------------------------*/
55

6-
import * as assert from 'assert';
6+
import assert from 'assert';
77
import * as path from 'path';
88
import * as fs from 'fs';
99
import * as os from 'os';
@@ -18,21 +18,7 @@ suite('parseEnvFiles Tests', () => {
1818

1919
teardown(() => {
2020
if (tmpDir && fs.existsSync(tmpDir)) {
21-
// Use rmdir for compatibility with older Node.js versions
22-
const rimraf = (dir: string) => {
23-
if (fs.existsSync(dir)) {
24-
fs.readdirSync(dir).forEach((file) => {
25-
const curPath = path.join(dir, file);
26-
if (fs.lstatSync(curPath).isDirectory()) {
27-
rimraf(curPath);
28-
} else {
29-
fs.unlinkSync(curPath);
30-
}
31-
});
32-
fs.rmdirSync(dir);
33-
}
34-
};
35-
rimraf(tmpDir);
21+
fs.rmSync(tmpDir, { recursive: true });
3622
}
3723
});
3824

@@ -46,14 +32,6 @@ suite('parseEnvFiles Tests', () => {
4632
assert.deepStrictEqual(result, {});
4733
});
4834

49-
test('should handle single string input', () => {
50-
const envFile = path.join(tmpDir, 'single.env');
51-
fs.writeFileSync(envFile, 'SINGLE_VAR=single_value');
52-
53-
const result = parseEnvFiles(envFile);
54-
assert.strictEqual(result.SINGLE_VAR, 'single_value');
55-
});
56-
5735
test('should handle array of files', () => {
5836
const envFile1 = path.join(tmpDir, 'first.env');
5937
const envFile2 = path.join(tmpDir, 'second.env');

0 commit comments

Comments
 (0)