diff --git a/Directory.Build.props b/Directory.Build.props index 91fe604c50..ee8baef709 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,6 +4,19 @@ + + + + + $(MSBuildThisFileDirectory)artifacts\bin\ + $(ArtifactsBinDir)$(MSBuildProjectName)\ + $(BaseOutputPath)$(Configuration)\ + + + true false diff --git a/src/polyglot-notebooks-browser/package.json b/src/polyglot-notebooks-browser/package.json index 597c02d3e2..8a6193fe81 100644 --- a/src/polyglot-notebooks-browser/package.json +++ b/src/polyglot-notebooks-browser/package.json @@ -6,11 +6,11 @@ "dist" ], "scripts": { - "compile": "npm run rollup", + "compile": "tsc -p ./ && npm run rollup", "compile-ci": "rollup -c rollup.config.js --bundleConfigAsCjs", "test": "mocha tests/**/*.test.ts", "ciTest": "node ../ensure-testresults-directory.js && npm test -- --reporter mocha-multi-reporters --reporter-options configFile=testConfig.json", - "rollup": "npm run compile-ci -- -i src/index.ts -o dist/dotnet-interactive.js", + "rollup": "npm run compile-ci -- -i dist/index.js -o dist/dotnet-interactive.js", "watch": "tsc -watch -p ./" }, "repository": { diff --git a/src/polyglot-notebooks/package.json b/src/polyglot-notebooks/package.json index 9f3c0c1a96..c8f5892f9c 100644 --- a/src/polyglot-notebooks/package.json +++ b/src/polyglot-notebooks/package.json @@ -11,8 +11,8 @@ "url": "https://github.com/dotnet/interactive" }, "scripts": { - "compile-es-module": "rollup -c rollup.es.config.js -i ./src/webview/activation.ts -o ./dist/activation.js", - "compile-library": "rollup -c rollup.library.config.js -i src/index.ts -o lib/polyglot-notebooks.js", + "compile-es-module": "rollup -c rollup.es.config.js -i ./dist/webview/activation.js -o ./dist/activation.js", + "compile-library": "rollup -c rollup.library.config.js -i dist/index.js -o lib/polyglot-notebooks.js", "compile": "npm run lint && tsc -p ./ && npm run compile-library && npm run compile-es-module", "lint": "eslint src --ext ts", "watch": "tsc -watch -p ./", diff --git a/test-retry-runner.ps1 b/test-retry-runner.ps1 index bb6d91ad0c..bff64757a6 100644 --- a/test-retry-runner.ps1 +++ b/test-retry-runner.ps1 @@ -9,7 +9,7 @@ $ErrorActionPreference = "Stop" if ($IsWindows) { $projectsToSkip = @( - ) + ) } else { @@ -17,11 +17,23 @@ else "Microsoft.DotNet.Interactive.NetFramework.Tests", "Microsoft.DotNet.Interactive.NamedPipeConnector.Tests", "Microsoft.DotNet.Interactive.VisualStudio.Tests" - ) + ) } -function ExecuteTestDirectory([string]$testDirectory, [string]$extraArgs = "") { - $testCommand = "dotnet test $testDirectory/ $extraArgs -l trx --no-restore --no-build --blame-hang-timeout 10m --blame-hang-dump-type full --blame-crash -c $buildConfig --results-directory $repoRoot/artifacts/TestResults/$buildConfig" +function Get-SafeFilePart([string]$value) { + if ([string]::IsNullOrWhiteSpace($value)) { return "unknown" } + # Replace characters invalid in filenames and trim long names + $safe = ($value -replace '[<>:"/\\|?*\x00-\x1F]', '_') + if ($safe.Length -gt 120) { $safe = $safe.Substring(0,120) } + return $safe +} + +function ExecuteTestDirectory([string]$testDirectory, [string]$extraArgs = "", [string]$trxFileName) { + $resultsDir = Join-Path $repoRoot "artifacts/TestResults/$buildConfig" + New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null + + $trxArg = "--logger `"trx;LogFileName=$trxFileName`"" + $testCommand = "dotnet test `"$testDirectory/`" $extraArgs $trxArg --no-restore --no-build --blame-hang-timeout 10m --blame-hang-dump-type full --blame-crash -c $buildConfig --results-directory `"$resultsDir`"" Write-Host "Executing $testCommand" Invoke-Expression $testCommand } @@ -32,9 +44,9 @@ try { "Microsoft.DotNet.Interactive.Tests", "Microsoft.DotNet.Interactive.App.Tests", "Microsoft.DotNet.Interactive.Browser.Tests" - ) - - $normalTestAssemblyDirectories = Get-ChildItem -Path "$repoRoot/src" -Directory -Filter *.Tests -Recurse | Where-Object { !$flakyTestAssemblyDirectories.contains($_.Name)} + ) + + $normalTestAssemblyDirectories = Get-ChildItem -Path "$repoRoot/src" -Directory -Filter *.Tests -Recurse | Where-Object { !$flakyTestAssemblyDirectories.contains($_.Name) } foreach ($testAssemblyDirectory in $normalTestAssemblyDirectories) { $projectName = $testAssemblyDirectory.Name @@ -43,8 +55,9 @@ try { continue } for ($i = 1; $i -le $retryCount; $i++) { - Write-Host "Testing project $projectName, attempt $i" - ExecuteTestDirectory -testDirectory $testAssemblyDirectory + $trxFile = "{0}.attempt{1}.trx" -f (Get-SafeFilePart $projectName), $i + Write-Host "Testing project $projectName, attempt $i (TRX: $trxFile)" + ExecuteTestDirectory -testDirectory $testAssemblyDirectory.FullName -trxFileName $trxFile if ($LASTEXITCODE -eq 0) { break } @@ -61,9 +74,11 @@ try { $distinctTestClasses = $testClasses | Get-Unique foreach ($testClass in $distinctTestClasses) { + $safeClass = Get-SafeFilePart $testClass for ($i = 1; $i -le $retryCount; $i++) { - Write-Host "Testing class $testClass, attempt $i" - ExecuteTestDirectory -testDirectory "$repoRoot/src/$flakyTestAssemblyDirectory" -extraArgs "--filter `"FullyQualifiedName~$testClass&Category!=Skip`"" + $trxFile = "{0}.{1}.attempt{2}.trx" -f (Get-SafeFilePart $flakyTestAssemblyDirectory), $safeClass, $i + Write-Host "Testing class $testClass, attempt $i (TRX: $trxFile)" + ExecuteTestDirectory -testDirectory "$repoRoot/src/$flakyTestAssemblyDirectory" -extraArgs "--filter `"FullyQualifiedName~$testClass&Category!=Skip`"" -trxFileName $trxFile if ($LASTEXITCODE -eq 0) { break }