Skip to content

Commit

Permalink
Add non-O# test leg
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Aug 19, 2023
1 parent f4b9617 commit 0532fa9
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 11 deletions.
17 changes: 17 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,25 @@ stages:
matrix:
linux:
demandsName: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open
windows:
demandsName: ImageOverride -equals 1es-windows-2022-open
pool:
name: NetCore-Public
demands: $(demandsName)
steps:
- template: azure-pipelines/test.yml

- stage: Test_Omnisharp
displayName: Test Omnisharp
dependsOn: []
jobs:
- job: Test
strategy:
matrix:
linux:
demandsName: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open
pool:
name: NetCore-Public
demands: $(demandsName)
steps:
- template: azure-pipelines/test-omnisharp.yml
26 changes: 26 additions & 0 deletions azure-pipelines/test-omnisharp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
steps:
- checkout: self
clean: true
submodules: true
fetchTags: false
fetchDepth: 1

- template: prereqs.yml

- pwsh: |
if ($IsLinux) {
Write-Host "Activating screen emulation"
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
$env:DISPLAY=':99.0'
Write-Host "Now running tests"
}
npm run omnisharptest
displayName: 🧪 Run unit and integration tests

- task: PublishPipelineArtifact@1
condition: failed()
displayName: 'Upload integration test logs'
inputs:
targetPath: '$(Build.SourcesDirectory)/.vscode-test/user-data/logs'
artifactName: 'VSCode Test Logs ($(Agent.JobName)-$(System.JobAttempt))'
2 changes: 1 addition & 1 deletion azure-pipelines/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:
Write-Host "Now running tests"
}
npm run omnisharptest
npm run test
displayName: 🧪 Run unit and integration tests

- task: PublishPipelineArtifact@1
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"compileDev": "tsc -p ./ && npx eslint ./ && webpack --mode development && npm run l10nDevGenerateLocalizationBundle",
"watch": "tsc -watch -p ./",
"tdd": "mocha --config ./.mocharc.jsonc --watch --watch-extensions ts omnisharptest/omnisharpUnitTests/**/*.test.ts*",
"test": "tsc -p ./ && gulp test",
"omnisharptest": "tsc -p ./ && gulp omnisharptest",
"omnisharptest:unit": "tsc -p ./ && gulp omnisharptest:unit",
"omnisharptest:feature": "tsc -p ./ && gulp omnisharptest:feature",
Expand Down
30 changes: 20 additions & 10 deletions tasks/testTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,8 @@ gulp.task('omnisharptest:unit', async () => {
return result;
});

gulp.task('jest:test', async () => {
const result = await spawnNode([jestPath]);

if (result.code === null || result.code > 0) {
// Ensure that gulp fails when tests fail
throw new Error(`Exit code: ${result.code} Signal: ${result.signal}`);
}

return result;
gulp.task('omnisharp:jest:test', async () => {
runJestTest(/.*omnisharpJestTests.*/);
});

const projectNames = ['singleCsproj', 'slnWithCsproj', 'slnFilterWithCsproj', 'BasicRazorApp2_1'];
Expand Down Expand Up @@ -90,9 +83,15 @@ gulp.task(
// TODO: Enable lsp integration tests once tests for unimplemented features are disabled.
gulp.task(
'omnisharptest',
gulp.series('jest:test', 'omnisharptest:feature', 'omnisharptest:unit', 'omnisharptest:integration:stdio')
gulp.series('omnisharp:jest:test', 'omnisharptest:feature', 'omnisharptest:unit', 'omnisharptest:integration:stdio')
);

gulp.task('test:unit', async () => {
runJestTest(/unitTests.*\.ts/);
});

gulp.task('test', gulp.series('test:unit'));

async function runIntegrationTest(testAssetName: string, engine: 'stdio' | 'lsp') {
const env = {
OSVC_SUITE: testAssetName,
Expand All @@ -114,3 +113,14 @@ async function runIntegrationTest(testAssetName: string, engine: 'stdio' | 'lsp'

return result;
}

async function runJestTest(testFilterRegex: RegExp) {
const result = await spawnNode([jestPath, testFilterRegex.source]);

if (result.code === null || result.code > 0) {
// Ensure that gulp fails when tests fail
throw new Error(`Exit code: ${result.code} Signal: ${result.signal}`);
}

return result;
}

0 comments on commit 0532fa9

Please sign in to comment.