feat(graph-api): Add schema review notes for upcoming Graph API changes
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
feat(sbomservice): Add placeholder for SHA256SUMS in LNM v1 fixtures docs(devportal): Create README for SDK archives in public directory build(devportal): Implement offline bundle build script test(devportal): Add link checker script for validating links in documentation test(devportal): Create performance check script for dist folder size test(devportal): Implement accessibility check script using Playwright and Axe docs(devportal): Add SDK quickstart guide with examples for Node.js, Python, and cURL feat(excititor): Implement MongoDB storage for airgap import records test(findings): Add unit tests for export filters hash determinism feat(findings): Define attestation contracts for ledger web service feat(graph): Add MongoDB options and service collection extensions for graph indexing test(graph): Implement integration tests for MongoDB provider and service collection extensions feat(zastava): Define configuration options for Zastava surface secrets build(tests): Create script to run Concelier linkset tests with TRX output
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using StellaOps.Scanner.Analyzers.Lang;
|
||||
using StellaOps.Scanner.Analyzers.Lang.Deno.Internal.Runtime;
|
||||
using StellaOps.Scanner.Analyzers.Lang.Deno.Tests.TestUtilities;
|
||||
@@ -74,23 +75,18 @@ public sealed class DenoRuntimeTraceRunnerTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecutesShimAndWritesRuntime_WhenDenoPresent()
|
||||
public async Task ExecutesShimAndWritesRuntime_WithStubbedDeno()
|
||||
{
|
||||
var binary = DenoBinaryLocator.Find();
|
||||
if (string.IsNullOrWhiteSpace(binary))
|
||||
{
|
||||
return; // gracefully skip when deno is unavailable in the environment
|
||||
}
|
||||
|
||||
var root = TestPaths.CreateTemporaryDirectory();
|
||||
try
|
||||
{
|
||||
var stub = CreateStubDeno(root);
|
||||
var entry = Path.Combine(root, "main.ts");
|
||||
var fixture = Path.Combine(TestPaths.GetProjectRoot(), "TestFixtures/deno-runtime/simple/main.ts");
|
||||
File.Copy(fixture, entry);
|
||||
|
||||
using var entryEnv = new EnvironmentVariableScope("STELLA_DENO_ENTRYPOINT", "main.ts");
|
||||
using var binaryEnv = new EnvironmentVariableScope("STELLA_DENO_BINARY", binary);
|
||||
using var binaryEnv = new EnvironmentVariableScope("STELLA_DENO_BINARY", stub);
|
||||
using var denoDirEnv = new EnvironmentVariableScope("DENO_DIR", Path.Combine(root, ".deno-cache"));
|
||||
|
||||
var context = new LanguageAnalyzerContext(root, TimeProvider.System);
|
||||
@@ -111,6 +107,46 @@ public sealed class DenoRuntimeTraceRunnerTests
|
||||
}
|
||||
}
|
||||
|
||||
private static string CreateStubDeno(string root)
|
||||
{
|
||||
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
var fileName = isWindows ? "deno.cmd" : "deno";
|
||||
var path = Path.Combine(root, fileName);
|
||||
|
||||
if (isWindows)
|
||||
{
|
||||
var lines = new[]
|
||||
{
|
||||
"@echo off",
|
||||
"echo {\"type\":\"deno.runtime.start\",\"ts\":\"2025-01-01T00:00:00Z\",\"module\":{\"normalized\":\".\",\"path_sha256\":\"0\"},\"reason\":\"shim-start\"}>deno-runtime.ndjson",
|
||||
"echo {\"type\":\"deno.module.load\",\"ts\":\"2025-01-01T00:00:01Z\",\"module\":{\"normalized\":\"main.ts\",\"path_sha256\":\"abc\"},\"reason\":\"static-import\",\"permissions\":[] }>>deno-runtime.ndjson",
|
||||
"exit /b 0"
|
||||
};
|
||||
File.WriteAllLines(path, lines);
|
||||
}
|
||||
else
|
||||
{
|
||||
var script = """#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cat > deno-runtime.ndjson <<'EOF'
|
||||
{"type":"deno.runtime.start","ts":"2025-01-01T00:00:00Z","module":{"normalized":".","path_sha256":"0"},"reason":"shim-start"}
|
||||
{"type":"deno.module.load","ts":"2025-01-01T00:00:01Z","module":{"normalized":"main.ts","path_sha256":"abc"},"reason":"static-import","permissions":[]}
|
||||
EOF
|
||||
""";
|
||||
File.WriteAllText(path, script);
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start("chmod", $"+x {path}")?.WaitForExit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// best effort; on Windows this branch won't execute
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private sealed class EnvironmentVariableScope : IDisposable
|
||||
{
|
||||
private readonly string _name;
|
||||
|
||||
Reference in New Issue
Block a user