-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add artifacts and metadata outputs (#327)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
9,793 additions
and
1,749 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as os from 'os'; | ||
import * as context from '../src/context'; | ||
|
||
describe('setOutput', () => { | ||
beforeEach(() => { | ||
process.stdout.write = jest.fn(); | ||
}); | ||
|
||
it('setOutput produces the correct command', () => { | ||
context.setOutput('some output', 'some value'); | ||
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]); | ||
}); | ||
|
||
it('setOutput handles bools', () => { | ||
context.setOutput('some output', false); | ||
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]); | ||
}); | ||
|
||
it('setOutput handles numbers', () => { | ||
context.setOutput('some output', 1.01); | ||
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]); | ||
}); | ||
}); | ||
|
||
// Assert that process.stdout.write calls called only with the given arguments. | ||
function assertWriteCalls(calls: string[]): void { | ||
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length); | ||
for (let i = 0; i < calls.length; i++) { | ||
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]); | ||
} | ||
} |
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
Oops, something went wrong.