Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae752db

Browse files
committedOct 8, 2024·
Don't make temp test files in bin directory
1 parent 1cbbcfc commit ae752db

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed
 

‎test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.IO;
66
using System.Linq;
7-
using System.Reflection;
87
using System.Runtime.InteropServices;
98
using System.Text;
109
using System.Threading;
@@ -21,11 +20,8 @@ namespace PowerShellEditorServices.Test.E2E
2120
[Trait("Category", "DAP")]
2221
public class DebugAdapterProtocolMessageTests : IAsyncLifetime, IDisposable
2322
{
24-
private const string TestOutputFileName = "__dapTestOutputFile.txt";
2523
private static readonly bool s_isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
26-
private static readonly string s_binDir =
27-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
28-
private static readonly string s_testOutputPath = Path.Combine(s_binDir, TestOutputFileName);
24+
private static readonly string s_testOutputPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(), "__dapTestOutputFile.txt");
2925

3026
private readonly ITestOutputHelper _output;
3127
private DebugAdapterClient PsesDebugAdapterClient;
@@ -116,7 +112,7 @@ public void Dispose()
116112
private static string NewTestFile(string script, bool isPester = false)
117113
{
118114
string fileExt = isPester ? ".Tests.ps1" : ".ps1";
119-
string filePath = Path.Combine(s_binDir, Path.GetRandomFileName() + fileExt);
115+
string filePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + fileExt);
120116
File.WriteAllText(filePath, script);
121117

122118
return filePath;

‎test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ public void FindsSymbolsInFile()
832832
Assert.True(symbol.IsDeclaration);
833833

834834
// There should be no region symbols unless the provider has been registered.
835-
Assert.Empty(symbols.Where(i => i.Type == SymbolType.Region));
835+
Assert.DoesNotContain(symbols, i => i.Type == SymbolType.Region);
836836
}
837837

838838
[Fact]

0 commit comments

Comments
 (0)
Please sign in to comment.