-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: pipeline variables's value should be nullable (#1096)
- Loading branch information
Showing
6 changed files
with
41 additions
and
32 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 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.
24 changes: 0 additions & 24 deletions
24
tests/test-cases/invalid-variables-null/integration.invalid-variables-null.test.ts
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,9 @@ | ||
--- | ||
variables: | ||
EMPTY_GLOBAL_VAR: | ||
test-job: | ||
variables: | ||
EMPTY_JOB_VAR: | ||
script: | ||
- echo "EMPTY_GLOBAL_VAR:${EMPTY_GLOBAL_VAR}" | ||
- echo "EMPTY_JOB_VAR:${EMPTY_JOB_VAR}" |
26 changes: 26 additions & 0 deletions
26
tests/test-cases/variables-null/integration.variables-null.test.ts
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,26 @@ | ||
import {WriteStreamsMock} from "../../../src/write-streams"; | ||
import {handler} from "../../../src/handler"; | ||
import chalk from "chalk"; | ||
import {initSpawnSpy} from "../../mocks/utils.mock"; | ||
import {WhenStatics} from "../../mocks/when-statics"; | ||
|
||
beforeAll(() => { | ||
initSpawnSpy(WhenStatics.all); | ||
}); | ||
|
||
test("variable-null <test-job>", async () => { | ||
const writeStreams = new WriteStreamsMock(); | ||
await handler({ | ||
cwd: "tests/test-cases/variables-null", | ||
job: ["test-job"], | ||
}, writeStreams); | ||
|
||
const expected = [ | ||
chalk`{blueBright test-job} {green $ echo \"EMPTY_GLOBAL_VAR:\${EMPTY_GLOBAL_VAR\}\"}`, | ||
chalk`{blueBright test-job} {greenBright >} EMPTY_GLOBAL_VAR:`, | ||
chalk`{blueBright test-job} {green $ echo \"EMPTY_JOB_VAR:\${EMPTY_JOB_VAR\}\"}`, | ||
chalk`{blueBright test-job} {greenBright >} EMPTY_JOB_VAR:`, | ||
]; | ||
|
||
expect(writeStreams.stdoutLines.slice(1, -3)).toEqual(expected); | ||
}); |