-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explore gxformat2 schema support
- Loading branch information
Showing
46 changed files
with
6,037 additions
and
2,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
import * as vscode from "vscode"; | ||
import * as path from "path"; | ||
import * as assert from "assert"; | ||
import { beforeEach } from "mocha"; | ||
import { | ||
activateAndOpenInEditor, | ||
getDocUri, | ||
closeAllEditors, | ||
openDocument, | ||
sleep, | ||
assertDiagnostics, | ||
updateSettings, | ||
resetSettings, | ||
waitForDiagnostics, | ||
} from "./helpers"; | ||
|
||
suite("Native (JSON) Workflows", () => { | ||
teardown(closeAllEditors); | ||
suite("Commands Tests", () => { | ||
test("Clean workflow command removes non-essential properties", async () => { | ||
const dirtyDocUri = getDocUri(path.join("json", "clean", "wf_01_dirty.ga")); | ||
const cleanDocUri = getDocUri(path.join("json", "clean", "wf_01_clean.ga")); | ||
const { document } = await activateAndOpenInEditor(dirtyDocUri); | ||
await sleep(500); // Wait for extension to fully activate... yes Windows CI I'm looking at you... | ||
const dirtyDoc = document.getText(); | ||
await vscode.commands.executeCommand("galaxy-workflows.cleanWorkflow"); | ||
await sleep(500); // Wait for command to apply changes | ||
const actualCleanJson = document.getText(); | ||
assert.notEqual(dirtyDoc, actualCleanJson); | ||
const expectedCleanDocument = await openDocument(cleanDocUri); | ||
const expectedCleanJson = expectedCleanDocument.getText(); | ||
assert.strictEqual(actualCleanJson, expectedCleanJson); | ||
}); | ||
}); | ||
|
||
suite("Validation Tests", () => { | ||
beforeEach(async () => { | ||
await resetSettings(); | ||
}); | ||
test("Changing validation profile shows custom diagnostics", async () => { | ||
const docUri = getDocUri(path.join("json", "validation", "test_wf_03.ga")); | ||
await activateAndOpenInEditor(docUri); | ||
await assertDiagnostics(docUri, []); // Expect no issues | ||
|
||
// Change to stricter validation profile | ||
await updateSettings("validation.profile", "iwc"); | ||
await waitForDiagnostics(docUri); | ||
await assertDiagnostics(docUri, [ | ||
{ | ||
message: 'Missing property "release".', | ||
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 1)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
{ | ||
message: "Missing label in workflow output.", | ||
range: new vscode.Range(new vscode.Position(16, 16), new vscode.Position(19, 17)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
{ | ||
message: "Missing label in workflow output.", | ||
range: new vscode.Range(new vscode.Position(20, 16), new vscode.Position(23, 17)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
]); | ||
|
||
await resetSettings(); | ||
await waitForDiagnostics(docUri); | ||
await assertDiagnostics(docUri, []); // Expect no issues | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
import * as vscode from "vscode"; | ||
import * as path from "path"; | ||
import * as assert from "assert"; | ||
import { beforeEach } from "mocha"; | ||
import { | ||
activateAndOpenInEditor, | ||
getDocUri, | ||
closeAllEditors, | ||
assertDiagnostics, | ||
resetSettings, | ||
waitForDiagnostics, | ||
} from "./helpers"; | ||
|
||
suite("Format2 (YAML) Workflows", () => { | ||
teardown(closeAllEditors); | ||
suite("Validation Tests", () => { | ||
beforeEach(async () => { | ||
await resetSettings(); | ||
}); | ||
test("Missing required fields return diagnostics", async () => { | ||
const docUri = getDocUri(path.join("yaml", "validation", "test_wf_00.gxwf.yml")); | ||
await activateAndOpenInEditor(docUri); | ||
await waitForDiagnostics(docUri); | ||
await assertDiagnostics(docUri, [ | ||
{ | ||
message: "The 'steps' field is required.", | ||
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 21)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
{ | ||
message: "The 'inputs' field is required.", | ||
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 21)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
{ | ||
message: "The 'outputs' field is required.", | ||
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 21)), | ||
severity: vscode.DiagnosticSeverity.Error, | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
// For a detailed explanation regarding each configuration property, visit: | ||
// https://jestjs.io/docs/en/configuration.html | ||
|
||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { pathsToModuleNameMapper } = require("ts-jest"); | ||
const { compilerOptions } = require("./tsconfig.json"); | ||
|
||
module.exports = { | ||
preset: "ts-jest", | ||
globals: { | ||
"ts-jest": { | ||
tsconfig: "tsconfig.json", | ||
tsconfig: compilerOptions, | ||
}, | ||
}, | ||
// The glob patterns Jest uses to detect test files | ||
testMatch: ["**/__tests__/*.+(ts|tsx|js)", "**/unit/*.test.ts"], | ||
testMatch: ["**/__tests__/*.+(ts|tsx|js)", "**/*.test.ts"], | ||
|
||
// An array of file extensions your modules use | ||
moduleFileExtensions: ["ts", "tsx", "js"], | ||
moduleFileExtensions: ["ts", "tsx", "js", "yaml"], | ||
transform: { | ||
// ... other transforms ... | ||
"\\.yaml$": "jest-transform-yaml", | ||
}, | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: "<rootDir>/" }), | ||
}; |
Oops, something went wrong.