Add GitHub Actions (#5522)

* add .github/workflows/nodejs.yml

* fix

* GitHub Actions: Node.js 8.xはサポートしない

* add .github/workflows/docker.yml

* Dockerビルドをキャッシュするように

* Run test in github actions

* 同リポジトリ内からのプルリクだと無駄に二回走るのを抑制

* 6925c00のdocker.ymlへの適応忘れ

* fix .circleci/misskey/test.yml

* test実行時にDBとかredisとか動かすように

* fix

* fix tests (#5544)

* fix test

* fix compile errors

* PATH引き継ぎでchild_process.spawn時のENOENTを修正

*  サーバー起動処理を共通化

* fix coding style

* fd=4をipcに使うように

* fix port

* fix

* fix ws port

* #4033 にテストケースを追従

* fix?

* fix??

* fix

* fix

* fix

* maybe fix

* fix

* node 10.xサポートしてなかった

* 11.10じゃないとだめだった

* fix

* remove chart test

* fix

* chart test復活

* fix

* 一回一回コネクションを閉じる

* Revert "一回一回コネクションを閉じる"

This reverts commit 56e35cf4f83070744c8dd852f1a7075011d88828.

* 一回一回sync→dropしてるのをやめてみる

* fix

* fix

* …

* キャッシュを切ってみる

* add ts to require target

* omg fix

* Revert "キャッシュを切ってみる"

This reverts commit 88161c59d2ea769ddf87143ba4fd4660a06afdf2.

* done呼び忘れ

* 実際の文字数リミットと違ってたので対応

* テストケースがバグってたので修正

* Revert "一回一回sync→dropしてるのをやめてみる"

This reverts commit a9e543ba2eef790ac7a14ae8799b898765748e35.

* fix

* fix

* fix

* fix?

* fix

* chartのconnectionを分離する

* fix

* fix

* fix tsconfig?

* Revert "fix tsconfig?"

This reverts commit ba9269eaf65507ff97ec1dd2e27260fb2cf0510b.

* fix

* TS_NODE_FILES を scripts の方で指定

* Windowsェ

* Circle CIの実行条件をmasterへのpushのみに

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
rinsuki 2020-01-09 14:35:04 +09:00 committed by syuilo
parent 16fb7c4557
commit 3ecb0ab161
17 changed files with 192 additions and 264 deletions

View File

@ -1,76 +1,12 @@
version: 2.1
executors:
default:
working_directory: /tmp/workspace
docker:
- image: misskey/ci:v11-node11
- image: circleci/redis:latest
- image: circleci/postgres:latest
docker:
working_directory: /tmp/workspace
docker:
- image: docker:latest
jobs:
build:
executor: default
steps:
- checkout
- run:
name: Ensure yarn.lock
command: |
touch yarn.lock
- restore_cache:
name: Restore npm package caches
keys:
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-
- yarn-v1-arch-{{ arch }}-
- yarn-v1-
- run:
name: Install Dependencies
command: |
yarn install
- run:
name: Configure
command: |
cp .circleci/misskey/default.yml .config
cp .circleci/misskey/test.yml .config
- run:
name: Build
command: |
yarn build
touch yarn.lock
- save_cache:
name: Cache npm packages
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- .
test:
parameters:
executor:
type: string
default: "default"
executor: <<parameters.executor>>
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Test
command: |
yarn test
touch yarn.lock
- save_cache:
name: Cache npm packages
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
docker:
parameters:
with_deploy:
@ -102,55 +38,8 @@ jobs:
workflows:
version: 2
nodejs:
jobs:
- hold:
name: manual-build-trigger
type: approval
filters:
branches:
ignore: master
- build:
name: manual-build
requires:
- manual-build-trigger
filters:
branches:
ignore: master
- build:
name: auto-build
filters:
branches:
only: master
- test:
name: manual-test
requires:
- manual-build
filters:
branches:
ignore: master
- test:
name: auto-test
requires:
- auto-build
filters:
branches:
only: master
docker:
jobs:
- hold:
name: manual-build-trigger
type: approval
filters:
branches:
ignore: master
- docker:
name: manual-build
requires:
- manual-build-trigger
filters:
branches:
ignore: master
- docker:
name: auto-build
with_deploy: true

View File

@ -1,12 +1,12 @@
url: 'http://misskey.local'
port: 80
mongodb:
port: 8080
db:
host: localhost
port: 27017
db: misskey
user: syuilo
port: 5432
db: test-misskey
user: postgres
pass: ''
redis:
host: localhost
port: 6379
pass: ''
id: aid

View File

@ -1,13 +1,12 @@
url: 'http://misskey.local'
port: 80
mongodb:
port: 8080
db:
host: localhost
port: 27017
port: 5432
db: test-misskey
user: admin
user: postgres
pass: ''
# __REDIS__
redis:
host: localhost
port: 6379
pass: ''
id: aid

18
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Docker build
on:
push:
branches:
- master
- develop
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Pull previous build result (for cache)
run: docker pull misskey/misskey:latest
- name: Build docker container
run: docker build --cache-from misskey/misskey:latest -t misskey/misskey .

42
.github/workflows/nodejs.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Node.js CI
on:
push:
branches:
- master
- develop
pull_request:
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [11.10.x, 12.x]
services:
postgres:
image: postgres:10-alpine
ports:
- 5432:5432
env:
POSTGRES_DB: test-misskey
redis:
image: redis:alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Copy Configure
run: cp .circleci/misskey/*.yml .config
- name: Build
run: yarn build
- name: Test
run: yarn test

View File

@ -22,7 +22,7 @@
"clean": "gulp clean",
"cleanall": "gulp cleanall",
"lint": "gulp lint",
"test": "gulp test",
"test": "cross-env TS_NODE_FILES=true gulp test",
"format": "gulp format"
},
"resolutions": {
@ -259,6 +259,7 @@
"xev": "2.0.1"
},
"devDependencies": {
"@types/fluent-ffmpeg": "2.1.12"
"@types/fluent-ffmpeg": "2.1.12",
"cross-env": "6.0.3"
}
}

View File

@ -133,11 +133,13 @@ export const entities = [
...charts as any
];
export function initDb(justBorrow = false, sync = false, log = false) {
try {
const conn = getConnection();
return Promise.resolve(conn);
} catch (e) {}
export function initDb(justBorrow = false, sync = false, log = false, forceRecreate = false) {
if (!forceRecreate) {
try {
const conn = getConnection();
return Promise.resolve(conn);
} catch (e) {}
}
return createConnection({
type: 'postgres',

View File

@ -2,6 +2,7 @@ import Chart from './core';
export const entities = Object.values(require('require-all')({
dirname: __dirname + '/charts/schemas',
filter: /^.+\.[jt]s$/,
resolve: (x: any) => {
return Chart.schemaToEntity(x.name, x.schema);
}

View File

@ -16,20 +16,12 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { async, signup, request, post } from './utils';
import { async, signup, request, post, launchServer } from './utils';
describe('API visibility', () => {
let p: childProcess.ChildProcess;
before(done => {
p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test' }
});
p.on('message', message => {
if (message === 'ok') done();
});
});
before(launchServer(g => p = g));
after(() => {
p.kill();
@ -45,6 +37,8 @@ describe('API visibility', () => {
let other: any;
/** 非フォロワーでもリプライやメンションをされた人 */
let target: any;
/** specified mentionでmentionを飛ばされる人 */
let target2: any;
/** public-post */
let pub: any;
@ -90,6 +84,7 @@ describe('API visibility', () => {
follower = await signup({ username: 'follower' });
other = await signup({ username: 'other' });
target = await signup({ username: 'target' });
target2 = await signup({ username: 'target2' });
// follow alice <= follower
await request('/following/create', { userId: alice.id }, follower);
@ -111,7 +106,7 @@ describe('API visibility', () => {
pubM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'public' });
homeM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'home' });
folM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'followers' });
speM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'specified' });
speM = await post(alice, { text: '@target2 x', replyId: tgt.id, visibility: 'specified' });
//#endregion
});
@ -376,9 +371,9 @@ describe('API visibility', () => {
assert.strictEqual(res.body.text, '@target x');
}));
it('[show] followers-mentionを非フォロワーがメンションされていても見れない', async(async () => {
it('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async(async () => {
const res = await show(folM.id, target);
assert.strictEqual(res.body.isHidden, true);
assert.strictEqual(res.body.text, '@target x');
}));
it('[show] followers-mentionをフォロワーが見れる', async(async () => {
@ -399,16 +394,16 @@ describe('API visibility', () => {
// specified
it('[show] specified-mentionを自分が見れる', async(async () => {
const res = await show(speM.id, alice);
assert.strictEqual(res.body.text, '@target x');
assert.strictEqual(res.body.text, '@target2 x');
}));
it('[show] specified-mentionを指定ユーザーが見れる', async(async () => {
const res = await show(speM.id, target);
assert.strictEqual(res.body.text, '@target x');
assert.strictEqual(res.body.text, '@target2 x');
}));
it('[show] specified-mentionをされた人が指定されてなかったら見れない', async(async () => {
const res = await show(speM.id, target);
const res = await show(speM.id, target2);
assert.strictEqual(res.body.isHidden, true);
}));

View File

@ -17,14 +17,18 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as lolex from 'lolex';
import { async } from './utils';
import { getConnection, createConnection } from 'typeorm';
const config = require('../built/config').default;
const Chart = require('../built/services/chart/core').default;
const _TestChart = require('../built/services/chart/charts/schemas/test');
const _TestGroupedChart = require('../built/services/chart/charts/schemas/test-grouped');
const _TestUniqueChart = require('../built/services/chart/charts/schemas/test-unique');
import TestChart from '../src/services/chart/charts/classes/test';
import TestGroupedChart from '../src/services/chart/charts/classes/test-grouped';
import TestUniqueChart from '../src/services/chart/charts/classes/test-unique';
import * as _TestChart from '../src/services/chart/charts/schemas/test';
import * as _TestGroupedChart from '../src/services/chart/charts/schemas/test-grouped';
import * as _TestUniqueChart from '../src/services/chart/charts/schemas/test-unique';
import { Connection, getConnection, createConnection } from 'typeorm';
import config from '../src/config';
import Chart from '../src/services/chart/core';
import { initDb } from '../src/db/postgre';
function initDb() {
function initChartDb() {
try {
const conn = getConnection();
return Promise.resolve(conn);
@ -51,37 +55,37 @@ describe('Chart', () => {
let testChart: any;
let testGroupedChart: any;
let testUniqueChart: any;
let connection: any;
let clock: lolex.InstalledClock<lolex.Clock>;
let connection: Connection;
before(done => {
initDb().then(c => {
initChartDb().then(c => {
connection = c;
done();
});
});
after(async(async () => {
await connection.close();
await initDb(true, undefined, undefined, true);
}));
beforeEach(done => {
const TestChart = require('../built/services/chart/charts/classes/test').default;
testChart = new TestChart();
const TestGroupedChart = require('../built/services/chart/charts/classes/test-grouped').default;
testGroupedChart = new TestGroupedChart();
const TestUniqueChart = require('../built/services/chart/charts/classes/test-unique').default;
testUniqueChart = new TestUniqueChart();
clock = lolex.install({
now: new Date('2000-01-01 00:00:00')
});
connection.synchronize().then(done);
done();
});
afterEach(done => {
afterEach(async(async () => {
clock.uninstall();
connection.dropDatabase().then(done);
});
await connection.dropDatabase();
await connection.synchronize();
}));
it('Can updates', async(async () => {
await testChart.increment();

View File

@ -5,7 +5,7 @@ import { parse } from '../src/mfm/parse';
describe('Extract mentions', () => {
it('simple', () => {
const ast = parse('@foo @bar @baz');
const ast = parse('@foo @bar @baz')!;
const mentions = extractMentions(ast);
assert.deepStrictEqual(mentions, [{
username: 'foo',
@ -26,7 +26,7 @@ describe('Extract mentions', () => {
});
it('nested', () => {
const ast = parse('@foo **@bar** @baz');
const ast = parse('@foo **@bar** @baz')!;
const mentions = extractMentions(ast);
assert.deepStrictEqual(mentions, [{
username: 'foo',

View File

@ -16,7 +16,7 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { async, signup, request, post, react, connectStream } from './utils';
import { async, signup, request, post, react, connectStream, launchServer } from './utils';
describe('Mute', () => {
let p: childProcess.ChildProcess;
@ -26,21 +26,11 @@ describe('Mute', () => {
let bob: any;
let carol: any;
before(done => {
p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test' }
});
p.on('message', async message => {
if (message === 'ok') {
(p.channel as any).onread = () => {};
alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' });
done();
}
});
});
before(launchServer(g => p = g, async () => {
alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' });
}));
after(() => {
p.kill();
@ -62,8 +52,8 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
}));
it('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async(async () => {
@ -131,9 +121,9 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
}));
it('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async(async () => {
@ -147,9 +137,9 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false);
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
}));
});
@ -163,8 +153,8 @@ describe('Mute', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.some(notification => notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => notification.userId === carol.id), false);
assert.strictEqual(res.body.some((notification: any) => notification.userId === bob.id), true);
assert.strictEqual(res.body.some((notification: any) => notification.userId === carol.id), false);
}));
});
});

View File

@ -16,9 +16,9 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { async, signup, request, post, uploadFile } from './utils';
import { Note } from '../built/models/entities/note';
const initDb = require('../built/db/postgre.js').initDb;
import { async, signup, request, post, uploadFile, launchServer } from './utils';
import { Note } from '../src/models/entities/note';
import { initDb } from '../src/db/postgre';
describe('Note', () => {
let p: childProcess.ChildProcess;
@ -27,23 +27,12 @@ describe('Note', () => {
let alice: any;
let bob: any;
before(done => {
p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test' }
});
p.on('message', message => {
if (message === 'ok') {
(p.channel as any).onread = () => {};
initDb(true).then(async connection => {
Notes = connection.getRepository(Note);
alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' });
done();
});
}
});
});
before(launchServer(g => p = g, async () => {
const connection = await initDb(true);
Notes = connection.getRepository(Note);
alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' });
}));
after(() => {
p.kill();

View File

@ -16,29 +16,18 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { connectStream, signup, request, post } from './utils';
import { Following } from '../built/models/entities/following';
const initDb = require('../built/db/postgre.js').initDb;
import { connectStream, signup, request, post, launchServer } from './utils';
import { Following } from '../src/models/entities/following';
import { initDb } from '../src/db/postgre';
describe('Streaming', () => {
let p: childProcess.ChildProcess;
let Followings: any;
beforeEach(done => {
p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test' }
});
p.on('message', message => {
if (message === 'ok') {
(p.channel as any).onread = () => {};
initDb(true).then(async (connection: any) => {
Followings = connection.getRepository(Following);
done();
});
}
});
});
beforeEach(launchServer(g => p = g, async () => {
const connection = await initDb(true);
Followings = connection.getRepository(Following);
}));
afterEach(() => {
p.kill();

View File

@ -16,7 +16,7 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { async, signup, request, post, uploadFile } from './utils';
import { async, signup, request, post, uploadFile, launchServer } from './utils';
describe('users/notes', () => {
let p: childProcess.ChildProcess;
@ -26,32 +26,20 @@ describe('users/notes', () => {
let pngNote: any;
let jpgPngNote: any;
before(done => {
p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test' }
before(launchServer(g => p = g, async () => {
alice = await signup({ username: 'alice' });
const jpg = await uploadFile(alice, __dirname + '/resources/Lenna.jpg');
const png = await uploadFile(alice, __dirname + '/resources/Lenna.png');
jpgNote = await post(alice, {
fileIds: [jpg.id]
});
p.on('message', async message => {
if (message === 'ok') {
(p.channel as any).onread = () => {};
alice = await signup({ username: 'alice' });
const jpg = await uploadFile(alice, __dirname + '/resources/Lenna.jpg');
const png = await uploadFile(alice, __dirname + '/resources/Lenna.png');
jpgNote = await post(alice, {
fileIds: [jpg.id]
});
pngNote = await post(alice, {
fileIds: [png.id]
});
jpgPngNote = await post(alice, {
fileIds: [jpg.id, png.id]
});
done();
}
pngNote = await post(alice, {
fileIds: [png.id]
});
});
jpgPngNote = await post(alice, {
fileIds: [jpg.id, png.id]
});
}));
after(() => {
p.kill();
@ -66,8 +54,8 @@ describe('users/notes', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.length, 2);
assert.strictEqual(res.body.some(note => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some(note => note.id === jpgPngNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true);
}));
it('ファイルタイプ指定 (jpg or png)', async(async () => {
@ -79,8 +67,8 @@ describe('users/notes', () => {
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
assert.strictEqual(res.body.length, 3);
assert.strictEqual(res.body.some(note => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some(note => note.id === pngNote.id), true);
assert.strictEqual(res.body.some(note => note.id === jpgPngNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === jpgNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === pngNote.id), true);
assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true);
}));
});

View File

@ -2,6 +2,7 @@ import * as fs from 'fs';
import * as WebSocket from 'ws';
const fetch = require('node-fetch');
import * as req from 'request';
import * as childProcess from 'child_process';
export const async = (fn: Function) => (done: Function) => {
fn().then(() => {
@ -17,7 +18,7 @@ export const request = async (endpoint: string, params: any, me?: any): Promise<
} : {};
try {
const res = await fetch('http://localhost:80/api' + endpoint, {
const res = await fetch('http://localhost:8080/api' + endpoint, {
method: 'POST',
body: JSON.stringify(Object.assign(auth, params))
});
@ -65,7 +66,7 @@ export const react = async (user: any, note: any, reaction: string): Promise<any
export const uploadFile = (user: any, path?: string): Promise<any> => new Promise((ok, rej) => {
req.post({
url: 'http://localhost:80/api/drive/files/create',
url: 'http://localhost:8080/api/drive/files/create',
formData: {
i: user.token,
file: fs.createReadStream(path || __dirname + '/resources/Lenna.png')
@ -78,7 +79,7 @@ export const uploadFile = (user: any, path?: string): Promise<any> => new Promis
export function connectStream(user: any, channel: string, listener: (message: Record<string, any>) => any, params?: any): Promise<WebSocket> {
return new Promise((res, rej) => {
const ws = new WebSocket(`ws://localhost/streaming?i=${user.token}`);
const ws = new WebSocket(`ws://localhost:8080/streaming?i=${user.token}`);
ws.on('open', () => {
ws.on('message', data => {
@ -102,3 +103,16 @@ export function connectStream(user: any, channel: string, listener: (message: Re
});
});
}
export function launchServer(callbackSpawnedProcess: (p: childProcess.ChildProcess) => void, moreProcess: () => Promise<void> = async () => {}) {
return (done: (err?: Error) => any) => {
const p = childProcess.spawn('node', [__dirname + '/../index.js'], {
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
env: { NODE_ENV: 'test', PATH: process.env.PATH }
});
callbackSpawnedProcess(p);
p.on('message', message => {
if (message === 'ok') moreProcess().then(() => done()).catch(e => done(e));
});
};
}

View File

@ -2743,6 +2743,13 @@ cropperjs@^1.5.6:
resolved "https://registry.yarnpkg.com/cropperjs/-/cropperjs-1.5.6.tgz#82faf432bec709d828f2f7a96d1179198edaf0e2"
integrity sha512-eAgWf4j7sNJIG329qUHIFi17PSV0VtuWyAu9glZSgu/KlQSrfTQOC2zAz+jHGa5fAB+bJldEnQwvJEaJ8zRf5A==
cross-env@6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-6.0.3.tgz#4256b71e49b3a40637a0ce70768a6ef5c72ae941"
integrity sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==
dependencies:
cross-spawn "^7.0.0"
cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"