|
31 | 31 | IDotnetFindPathContext, |
32 | 32 | IDotnetListVersionsContext, |
33 | 33 | IDotnetListVersionsResult, |
| 34 | + IDotnetLogResult, |
34 | 35 | IDotnetSearchContext, |
35 | 36 | IDotnetSearchResult, |
36 | 37 | IExistingPaths, |
@@ -139,6 +140,28 @@ suite('DotnetCoreAcquisitionExtension End to End', function () |
139 | 140 | assert.deepEqual((mockState as any).syncedKeys, [], 'setKeysForSync should be called with empty array to prevent syncing install state'); |
140 | 141 | }).timeout(standardTimeoutTime); |
141 | 142 |
|
| 143 | + test('dotnet.getAcquisitionLog returns the path to the current log file', async () => |
| 144 | + { |
| 145 | + const result = await vscode.commands.executeCommand<IDotnetLogResult>('dotnet.getAcquisitionLog'); |
| 146 | + assert.exists(result, 'dotnet.getAcquisitionLog returns a value'); |
| 147 | + assert.exists(result!.logPath, 'dotnet.getAcquisitionLog result contains logPath'); |
| 148 | + assert.isString(result!.logPath, 'dotnet.getAcquisitionLog returns a string logPath'); |
| 149 | + assert.isTrue(result!.logPath.length > 0, 'dotnet.getAcquisitionLog returns a non-empty path'); |
| 150 | + // The log file is named like `DotNetAcquisition-<extensionId>-<timestamp>.txt` |
| 151 | + // (see EventStreamRegistration.ts). Validate the filename shape so callers know |
| 152 | + // they are being handed the acquisition log rather than some other file. |
| 153 | + assert.include(path.basename(result!.logPath), 'DotNetAcquisition', 'Returned path points at a DotNetAcquisition log file'); |
| 154 | + assert.isTrue(result!.logPath.endsWith('.txt'), 'Returned log file has a .txt extension'); |
| 155 | + // The directory containing the log should exist after activation even if no log |
| 156 | + // lines have been flushed yet; ensureDirectory is invoked on flush. |
| 157 | + assert.isTrue(fs.existsSync(path.dirname(result!.logPath)), 'Log directory exists'); |
| 158 | + // Activation performs JSON scanning which should always produce at least one |
| 159 | + // log entry, so the file should exist and be non-empty after awaiting flush. |
| 160 | + assert.isTrue(fs.existsSync(result!.logPath), 'Log file exists on disk'); |
| 161 | + const logContents = fs.readFileSync(result!.logPath, 'utf8'); |
| 162 | + assert.isTrue(logContents.length > 0, 'Log file is non-empty after activation'); |
| 163 | + }).timeout(standardTimeoutTime); |
| 164 | + |
142 | 165 | async function installRuntime(dotnetVersion: string, installMode: DotnetInstallMode, arch?: string) |
143 | 166 | { |
144 | 167 | let context: IDotnetAcquireContext = { version: dotnetVersion, requestingExtensionId, mode: installMode }; |
|
0 commit comments