This commit is contained in:
Samuel Attard 2018-03-12 16:53:12 +09:00
Родитель c62da68eb5
Коммит 3d7b142da0
6 изменённых файлов: 18 добавлений и 12 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -1,2 +1,3 @@
node_modules
lib
lib
working

Просмотреть файл

@ -8,6 +8,7 @@
"scripts": {
"prestart": "tsc",
"start": "probot run ./lib/index.js",
"pretest": "tsc",
"test": "jest && standard"
},
"dependencies": {

Просмотреть файл

@ -1,6 +1,10 @@
jest.mock('request')
jest.mock('../lib/backport/utils.js', () => ({
ensureElectronUpToDate: async () => {},
backportPR: async () => {}
}))
const {createRobot} = require('probot')
const issueBoardTracker = require('../index.js')
const issueBoardTracker = require('../lib/index.js')
const pushEventPayload = require('./fixtures/push.json')
const issueLabeledEventPayload = require('./fixtures/issues.labeled.json')
@ -9,9 +13,9 @@ const prLabeledEventPayload = require('./fixtures/pull_request.labeled.json')
describe('issue-board-tracker', () => {
let robot, github
beforeEach(() => {
beforeEach(async () => {
robot = createRobot()
issueBoardTracker(robot)
await issueBoardTracker(robot)
github = {
repos: {

Просмотреть файл

@ -6,7 +6,7 @@ import * as simpleGit from 'simple-git';
import { Probot, ProbotContext, Label, PullRequestEvent } from './Probot';
import queue from './Queue';
const dir = path.resolve(__dirname, '..', 'working');
const dir = path.resolve(__dirname, '..', '..', 'working');
const getGit = () => simpleGit(dir);
export const ensureElectronUpToDate = async () => {

Просмотреть файл

@ -1,7 +1,11 @@
import randomColor from 'randomcolor'
import * as randomColor from 'randomcolor'
import { backportPR, ensureElectronUpToDate } from './backport/utils'
module.exports = (robot) => {
module.exports = async (robot) => {
robot.log('initializing working directory')
await ensureElectronUpToDate()
robot.log('working directory ready')
// get watched board and create labels based on column names
robot.on('push', async context => {
const config = await context.config('config.yml')
@ -70,10 +74,6 @@ module.exports = (robot) => {
}
})
robot.log('initializing working directory')
await ensureElectronUpToDate()
robot.log('working directory ready')
robot.on('pull_request.closed', context => {
const payload = context.payload
if (payload.pull_request.merged) {

Просмотреть файл

@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"target": "es2018",
"outDir": "lib",
"lib": [
"es6"