mirror of
https://github.com/actions/runner.git
synced 2025-12-12 23:37:35 +00:00
Filter NODE_OPTIONS from env for file output (#2775)
Copies logic that used to be in ::set::env before its deprecation
This commit is contained in:
@@ -183,6 +183,47 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Worker")]
|
||||
public void SetEnvFileCommand_BlockListItemsFiltered()
|
||||
{
|
||||
using (var hostContext = Setup())
|
||||
{
|
||||
var stateFile = Path.Combine(_rootDirectory, "simple");
|
||||
var content = new List<string>
|
||||
{
|
||||
"NODE_OPTIONS=asdf",
|
||||
};
|
||||
WriteContent(stateFile, content);
|
||||
_setEnvFileCommand.ProcessCommand(_executionContext.Object, stateFile, null);
|
||||
Assert.Equal(1, _issues.Count);
|
||||
Assert.Equal(0, _executionContext.Object.Global.EnvironmentVariables.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Worker")]
|
||||
public void SetEnvFileCommand_BlockListItemsFiltered_Heredoc()
|
||||
{
|
||||
using (var hostContext = Setup())
|
||||
{
|
||||
var stateFile = Path.Combine(_rootDirectory, "simple");
|
||||
var content = new List<string>
|
||||
{
|
||||
"NODE_OPTIONS<<EOF",
|
||||
"asdf",
|
||||
"EOF",
|
||||
};
|
||||
WriteContent(stateFile, content);
|
||||
_setEnvFileCommand.ProcessCommand(_executionContext.Object, stateFile, null);
|
||||
Assert.Equal(1, _issues.Count);
|
||||
Assert.Equal(0, _executionContext.Object.Global.EnvironmentVariables.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Worker")]
|
||||
|
||||
Reference in New Issue
Block a user