Skip to content

Commit a6082db

Browse files
committed
Run npm test in headless mode
1 parent 10f5e47 commit a6082db

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

.build/Build.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public sealed partial class Solution : NukeBuild,
4949
.DependsOn(Restore)
5050
.DependsOn(Build)
5151
.DependsOn(Test)
52-
.DependsOn(Pack)
53-
.DependsOn(TestVscodeTestExtension);
52+
.DependsOn(Pack);
5453

5554
public Target Build => _ => _.Inherit<ICanBuildWithDotNetCore>(x => x.CoreBuild);
5655

@@ -69,7 +68,7 @@ public sealed partial class Solution : NukeBuild,
6968
NpmTasks.NpmCi(s => s
7069
.SetProcessWorkingDirectory(VscodeTestExtensionProjectDirectory)));
7170

72-
public Target TestVscodeTestExtension => _ => _
71+
public Target TestVscodeExtension => _ => _
7372
.DependsOn(NpmInstall)
7473
.Executes(() =>
7574
NpmTasks.NpmRun(s => s

.build/Solution.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,32 @@ RocketSurgeonGitHubActionsConfiguration configuration
102102
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
103103
.UseDotNetSdks("3.1", "7.0")
104104
.AddNuGetCache()
105+
.AddVscodeExtensionTests()
105106
.PublishLogs<Solution>()
106107
.PublishArtifacts<Solution>()
107108
.FailFast = false;
108109

109110
return configuration;
110111
}
111112
}
113+
114+
public static class Extensions
115+
{
116+
public static RocketSurgeonsGithubActionsJob AddVscodeExtensionTests(this RocketSurgeonsGithubActionsJob job)
117+
{
118+
return job
119+
.AddStep(new RunStep("Npm install") {
120+
Run = string.Join(Environment.NewLine, [
121+
"cd vscode-testextension",
122+
"npm ci",
123+
"cd .."
124+
])
125+
})
126+
.AddStep(new UsingStep("Vscode extension tests") {
127+
Uses = "coactions/setup-xvfb@v1",
128+
With = {
129+
["run"] = "npm run test",
130+
["working-directory"] = "vscode-testextension"
131+
}});
132+
}
133+
}

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,20 @@ jobs:
113113
id: test
114114
run: |
115115
dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip
116-
- name: Npm Install
117-
id: npmInstall
118-
run: |
119-
dotnet nuke NpmInstall --skip
120-
- name: 🚦 Test Vscode Test Extension
121-
id: testVscodeTestExtension
122-
run: |
123-
dotnet nuke TestVscodeTestExtension --skip
124116
- name: 📦 Pack
125117
id: pack
126118
run: |
127119
dotnet nuke Pack --skip
120+
- name: Npm install
121+
run: |
122+
cd vscode-testextension
123+
npm ci
124+
cd ..
125+
- name: 🚦 Vscode extension tests
126+
uses: coactions/setup-xvfb@v1
127+
with:
128+
run: 'npm run test'
129+
working-directory: 'vscode-testextension'
128130
- name: 🏺 Publish coverage data
129131
if: always()
130132
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)