forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalSetup.ts
29 lines (21 loc) · 963 Bytes
/
globalSetup.ts
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
// Copyright 2017-2021 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AlwaysPullPolicy, GenericContainer, Wait } from 'testcontainers';
import { SubstrateTestsGlobal } from './substrateTestsGlobal';
declare const global: SubstrateTestsGlobal;
const startSubstrate = async () => {
console.log('Substrate container starting...');
const startedTestContainer = await new GenericContainer('parity/substrate')
.withPullPolicy(new AlwaysPullPolicy())
.withName('polkadot-apps-test-substrate')
.withExposedPorts(9944)
.withCmd(['--dev', '--ws-port=9944', '--unsafe-ws-external'])
.withWaitStrategy(Wait.forLogMessage('New epoch 0 launching'))
.start();
console.log('Done.');
process.env.TEST_SUBSTRATE_PORT = startedTestContainer.getMappedPort(9944)?.toString() || '';
global.__SUBSTRATE__ = startedTestContainer;
};
export default async (): Promise<void> => {
await startSubstrate();
};