diff --git a/actions-languageservice/src/validate.expressions.test.ts b/actions-languageservice/src/validate.expressions.test.ts index b914ec9..9157a0b 100644 --- a/actions-languageservice/src/validate.expressions.test.ts +++ b/actions-languageservice/src/validate.expressions.test.ts @@ -306,7 +306,7 @@ jobs: }); }); - describe("multi-line strings", () => { + describe("multi-line strings warnings", () => { it("indented |", async () => { const input = `on: push jobs: @@ -428,6 +428,124 @@ jobs: }); }); + describe("multi-line strings errors", () => { + it("indented |", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: | + first line + test \${{ fromJSON2('') }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Unrecognized function: 'fromJSON2'", + range: { + end: { + character: 35, + line: 7 + }, + start: { + character: 15, + line: 7 + } + } + } + ]); + }); + + it("indented |+", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: |+ + first line + test \${{ fromJSON2('') }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Unrecognized function: 'fromJSON2'", + range: { + end: { + character: 35, + line: 7 + }, + start: { + character: 15, + line: 7 + } + } + } + ]); + }); + + it("indented >", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: > + first line + test \${{ fromJSON2('') }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Unrecognized function: 'fromJSON2'", + range: { + end: { + character: 35, + line: 7 + }, + start: { + character: 15, + line: 7 + } + } + } + ]); + }); + + it("indented >+", async () => { + const input = `on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: >+ + first line + test \${{ fromJSON2('') }} + test2`; + const result = await validate(createDocument("wf.yaml", input)); + + expect(result).toEqual([ + { + message: "Unrecognized function: 'fromJSON2'", + range: { + end: { + character: 35, + line: 7 + }, + start: { + character: 15, + line: 7 + } + } + } + ]); + }); + }); + describe("matrix context", () => { it("reference within a matrix job", async () => { const input = ` diff --git a/actions-languageservice/src/validate.ts b/actions-languageservice/src/validate.ts index 8d2938e..d913a26 100644 --- a/actions-languageservice/src/validate.ts +++ b/actions-languageservice/src/validate.ts @@ -209,8 +209,6 @@ async function validateExpression( severity: DiagnosticSeverity.Warning, range: mapRange(expression.range) }); - } else { - throw e; } } } diff --git a/package-lock.json b/package-lock.json index 5106819..bccbc21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -698,9 +698,9 @@ "link": true }, "node_modules/@github/actions-workflow-parser": { - "version": "0.0.31", - "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.31/ebc46956b91ed1a8c45efd41a3256ae818722557", - "integrity": "sha512-3k+MBWG7Gn86aHeLdJTiYUTGm53npEelzleCbq/8Ir51xVkRINsyNe4HuGJizXxZ2WoTxAkLeZ6qpO1oCucSIg==", + "version": "0.0.34", + "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.34/e369bdaca17cde594ad7420cd0df0efcd2804dc0", + "integrity": "sha512-ttjYUoO2bvi5v/SR267QpDhWJ+I4tXQlSMnscjqUp76IDLxS73I7nCD3KP7g4VxzHmT5j8AxSdjEE25UWpl43g==", "license": "MIT", "dependencies": { "@github/actions-expressions": "*", @@ -13533,9 +13533,9 @@ } }, "@github/actions-workflow-parser": { - "version": "0.0.31", - "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.31/ebc46956b91ed1a8c45efd41a3256ae818722557", - "integrity": "sha512-3k+MBWG7Gn86aHeLdJTiYUTGm53npEelzleCbq/8Ir51xVkRINsyNe4HuGJizXxZ2WoTxAkLeZ6qpO1oCucSIg==", + "version": "0.0.34", + "resolved": "https://npm.pkg.github.com/download/@github/actions-workflow-parser/0.0.34/e369bdaca17cde594ad7420cd0df0efcd2804dc0", + "integrity": "sha512-ttjYUoO2bvi5v/SR267QpDhWJ+I4tXQlSMnscjqUp76IDLxS73I7nCD3KP7g4VxzHmT5j8AxSdjEE25UWpl43g==", "requires": { "@github/actions-expressions": "*", "yaml": "^2.0.0-8"