-
Notifications
You must be signed in to change notification settings - Fork 1
Add self-signed option to allow configure with private gitlab instances #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b4ffada
d48649c
2b19b2a
1ac4ac3
aef29ed
e45afa6
28a1440
64da3d0
44f309e
89fdc01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| const {logger} = require('../../utils/logger'); | ||
|
|
||
| const disableCertificateVerification = async() => { | ||
| logger.warn('Disabling certificate verification. This is unsafe and should only be used as last resort.'); | ||
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | ||
| return; | ||
| }; | ||
|
|
||
| module.exports = { | ||
| disableCertificateVerification | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,22 @@ | ||
| const chalk = require('chalk'); | ||
|
|
||
| const getLogger = function(transport){ | ||
| return { | ||
| log : (...args) =>{ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting can be a little prettier: |
||
| transport.log(...args); | ||
| }, | ||
|
|
||
| warn : (...args) =>{ | ||
| transport.log('⚠️', chalk.yellow.bold(...args)); | ||
| }, | ||
|
|
||
| err : (...args) =>{ | ||
| transport.log('🙀', chalk.red.bold(...args)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| module.exports = { | ||
| logger: console | ||
| }; | ||
| logger: getLogger(console), | ||
| getLogger: getLogger | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| const {getLogger} = require('./index'); | ||
|
|
||
| describe('utils/logger', () => { | ||
| let mockConsole; | ||
| let logger; | ||
|
|
||
| beforeAll(() => { | ||
| mockConsole = { | ||
| content: '', | ||
|
|
||
| log: function(...args) { | ||
| this.content = [...args]; | ||
| }, | ||
| } | ||
| logger = getLogger(mockConsole); | ||
| }); | ||
|
|
||
| test('Testing normal log message', () => { | ||
|
|
||
| logger.log('test', 'plop'); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use mock functions from Jest? Then you could const mockConsole = {
log: jest.fn(),
};
logger = getLogger(mockConsole);
logger.log('Pizza')
expect(mockConsole.log.mock.results[0].value).toBe('Pizza') |
||
|
|
||
| expect(mockConsole.content).toHaveLength(2); | ||
| expect(mockConsole.content).toEqual(['test', 'plop']); | ||
| }); | ||
|
|
||
| test('Testing warning log message', () => { | ||
|
|
||
| logger.warn('test', 'plop'); | ||
|
|
||
| expect(mockConsole.content).toHaveLength(2); | ||
| expect(mockConsole.content[0]).toEqual('⚠️'); | ||
| }); | ||
|
|
||
| test('Testing error log message', () => { | ||
|
|
||
| logger.err('test', 'plop'); | ||
|
|
||
| expect(mockConsole.content).toHaveLength(2); | ||
| expect(mockConsole.content[0]).toEqual('🙀'); | ||
| }); | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put whitespace around deconstruction arguments?