-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmock-for-chalk.js
More file actions
43 lines (35 loc) · 1.24 KB
/
mock-for-chalk.js
File metadata and controls
43 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint no-console:0 */
console.log('running with mocked Github calls')
var la = require('lazy-ass')
var R = require('ramda')
var Promise = require('bluebird')
var mockCommits = require('./mock-chalk-ids.json')
var mockComments = require('./mock-chalk-comments.json')
require = require('really-need') // eslint-disable-line
function mockGetCommitsFromTags (info) {
console.log('mock get commits from tags', info)
la(info.repo === 'chalk', 'got unexpected request', info)
return Promise.resolve(mockCommits)
}
function mockGetComments (info) {
console.log('mock get comments between commits', info)
la(info.repo === 'chalk', 'got unexpected request', info)
return Promise.resolve(mockComments)
}
require('../src/get-commits-from-tags', {
post: R.always(mockGetCommitsFromTags)
})
require('../src/get-commits-between', {
post: R.always(mockGetComments)
});
(function adjustProcessArgs () {
process.argv.splice(1, 1)
console.log('removed this filename from process arguments')
process.argv[1] = require('path').resolve(process.argv[1])
console.log('resolved the name of the next script to load')
}())
console.log('loading the real script from %s', process.argv[1])
/* eslint no-undefined:0 */
require(process.argv[1], {
parent: undefined
})