|
1 | 1 | import path from 'node:path'; |
2 | 2 | import * as fs from 'node:fs'; |
| 3 | +import * as os from 'node:os'; |
3 | 4 | import * as fsp from 'node:fs/promises'; |
4 | 5 | import ansis from 'ansis'; |
5 | 6 | import {CodeAnalyzerConfig} from "@salesforce/code-analyzer-core"; |
@@ -252,19 +253,19 @@ describe('ConfigAction tests', () => { |
252 | 253 | {prop: 'log_folder'} |
253 | 254 | ])(`When derivable property $prop input is non-null and non-default, it is rendered as-is`, async ({prop}) => { |
254 | 255 | // ==== SETUP ==== |
255 | | - // Make the config root and log folder both be the folder above this one. |
256 | | - const parentOfCurrentDirectory = path.resolve(__dirname, '..'); |
257 | | - stubConfigFactory.dummyConfigRoot = parentOfCurrentDirectory; |
258 | | - stubConfigFactory.dummyLogFolder = parentOfCurrentDirectory; |
| 256 | + // Make the config root and log folder both a non-default temp folder |
| 257 | + const nonDefaultFolder: string = fs.mkdtempSync(path.join(os.tmpdir(), 'my-temp-')); |
| 258 | + stubConfigFactory.dummyConfigRoot = nonDefaultFolder; |
| 259 | + stubConfigFactory.dummyLogFolder = nonDefaultFolder; |
259 | 260 |
|
260 | 261 | // ==== TESTED BEHAVIOR ==== |
261 | 262 | // Just select all rules for this test, since we don't care about the rules here. |
262 | 263 | const output = await runActionAndGetDisplayedConfig(dependencies, ['all']); |
263 | 264 |
|
264 | 265 | // ==== ASSERTIONS ==== |
265 | 266 | const goldFileContents = (await readGoldFile(path.join(PATH_TO_COMPARISON_DIR, 'derivables-as-non-defaults', `${prop}.yml.goldfile`))) |
266 | | - .replace('__DUMMY_CONFIG_ROOT__', parentOfCurrentDirectory) |
267 | | - .replace('__DUMMY_LOG_FOLDER__', parentOfCurrentDirectory) |
| 267 | + .replace('__DUMMY_CONFIG_ROOT__', nonDefaultFolder) |
| 268 | + .replace('__DUMMY_LOG_FOLDER__', nonDefaultFolder) |
268 | 269 | .replace('__DUMMY_DEFAULT_CONFIG_ROOT__', 'null') |
269 | 270 | .replace('__DUMMY_DEFAULT_LOG_FOLDER__', 'null') |
270 | 271 | expect(output).toContain(goldFileContents); |
|
0 commit comments