Ensure existing context errors don't prevent parsing workflows

This commit is contained in:
Josh Gross
2023-02-09 18:50:05 -05:00
parent ff0e9ba6e2
commit e25500b8e4
4 changed files with 38 additions and 7 deletions
@@ -5,6 +5,7 @@ import {ContextProviderConfig} from "./context-providers/config";
import {registerLogger} from "./log";
import {getPositionFromCursor} from "./test-utils/cursor-position";
import {TestLogger} from "./test-utils/logger";
import {testFileProvider} from "./test-utils/test-file-provider";
const contextProviderConfig: ContextProviderConfig = {
getContext: async (context: string) => {
@@ -1130,4 +1131,24 @@ jobs:
expect(result.find(x => x.label === "toJson")!.insertText).toBe("toJson");
});
it("Parsing errors don't prevent reusable workflows from being loaded", async () => {
const input = `
on: push
jobs:
a:
uses: ./reusable-workflow-with-outputs.yaml
b:
needs: [a]
runs-on: ubuntu-latest
steps:
- run: echo "hello \${{ needs.a.outputs.| }}"
`;
const result = await complete(...getPositionFromCursor(input), {
contextProviderConfig,
fileProvider: testFileProvider
});
expect(result.map(x => x.label)).toEqual(["build_id"]);
});
});