зеркало из https://github.com/electron/trop.git
Fix dem tests
This commit is contained in:
Родитель
c62da68eb5
Коммит
3d7b142da0
|
@ -1,2 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
lib
|
lib
|
||||||
|
working
|
|
@ -8,6 +8,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prestart": "tsc",
|
"prestart": "tsc",
|
||||||
"start": "probot run ./lib/index.js",
|
"start": "probot run ./lib/index.js",
|
||||||
|
"pretest": "tsc",
|
||||||
"test": "jest && standard"
|
"test": "jest && standard"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
jest.mock('request')
|
jest.mock('request')
|
||||||
|
jest.mock('../lib/backport/utils.js', () => ({
|
||||||
|
ensureElectronUpToDate: async () => {},
|
||||||
|
backportPR: async () => {}
|
||||||
|
}))
|
||||||
const {createRobot} = require('probot')
|
const {createRobot} = require('probot')
|
||||||
const issueBoardTracker = require('../index.js')
|
const issueBoardTracker = require('../lib/index.js')
|
||||||
|
|
||||||
const pushEventPayload = require('./fixtures/push.json')
|
const pushEventPayload = require('./fixtures/push.json')
|
||||||
const issueLabeledEventPayload = require('./fixtures/issues.labeled.json')
|
const issueLabeledEventPayload = require('./fixtures/issues.labeled.json')
|
||||||
|
@ -9,9 +13,9 @@ const prLabeledEventPayload = require('./fixtures/pull_request.labeled.json')
|
||||||
describe('issue-board-tracker', () => {
|
describe('issue-board-tracker', () => {
|
||||||
let robot, github
|
let robot, github
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
robot = createRobot()
|
robot = createRobot()
|
||||||
issueBoardTracker(robot)
|
await issueBoardTracker(robot)
|
||||||
|
|
||||||
github = {
|
github = {
|
||||||
repos: {
|
repos: {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as simpleGit from 'simple-git';
|
||||||
import { Probot, ProbotContext, Label, PullRequestEvent } from './Probot';
|
import { Probot, ProbotContext, Label, PullRequestEvent } from './Probot';
|
||||||
import queue from './Queue';
|
import queue from './Queue';
|
||||||
|
|
||||||
const dir = path.resolve(__dirname, '..', 'working');
|
const dir = path.resolve(__dirname, '..', '..', 'working');
|
||||||
const getGit = () => simpleGit(dir);
|
const getGit = () => simpleGit(dir);
|
||||||
|
|
||||||
export const ensureElectronUpToDate = async () => {
|
export const ensureElectronUpToDate = async () => {
|
||||||
|
|
12
src/index.js
12
src/index.js
|
@ -1,7 +1,11 @@
|
||||||
import randomColor from 'randomcolor'
|
import * as randomColor from 'randomcolor'
|
||||||
import { backportPR, ensureElectronUpToDate } from './backport/utils'
|
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
|
// get watched board and create labels based on column names
|
||||||
robot.on('push', async context => {
|
robot.on('push', async context => {
|
||||||
const config = await context.config('config.yml')
|
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 => {
|
robot.on('pull_request.closed', context => {
|
||||||
const payload = context.payload
|
const payload = context.payload
|
||||||
if (payload.pull_request.merged) {
|
if (payload.pull_request.merged) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es2018",
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6"
|
"es6"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче