Change global jest setup and teardown from TS to CommonJS (#6129)

This commit is contained in:
Krzysztof Jelski 2021-09-16 11:20:15 +02:00 committed by GitHub
parent b924bbcad6
commit 59b9e7aae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 23 deletions

View File

@ -6,6 +6,6 @@ const config = require('./jest.config.cjs');
module.exports = {
...config,
displayName: 'all-tests',
globalSetup: './jest/globalSetup.ts',
globalTeardown: './jest/globalTeardown.ts'
globalSetup: './jest/globalSetup.cjs',
globalTeardown: './jest/globalTeardown.cjs'
};

View File

@ -1,11 +1,7 @@
// 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 { AlwaysPullPolicy, GenericContainer, Wait } = require('testcontainers');
const startSubstrate = async () => {
console.log('Substrate container starting...');
@ -24,6 +20,6 @@ const startSubstrate = async () => {
global.__SUBSTRATE__ = startedTestContainer;
};
export default async (): Promise<void> => {
module.exports = async () => {
await startSubstrate();
};

View File

@ -1,11 +1,7 @@
// Copyright 2017-2021 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SubstrateTestsGlobal } from './substrateTestsGlobal';
declare const global: SubstrateTestsGlobal;
export default async (): Promise<void> => {
module.exports = async () => {
console.log('Shutting down Substrate container...');
await global.__SUBSTRATE__.stop();

View File

@ -1,9 +0,0 @@
// Copyright 2017-2021 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { StartedTestContainer } from 'testcontainers';
export interface SubstrateTestsGlobal extends NodeJS.Global {
__SUBSTRATE__: StartedTestContainer;
// You can declare anything you need.
}

View File

@ -43,7 +43,7 @@ const renderAccounts = () => {
);
};
describe.only('--SLOW--: Account Create', () => {
describe('--SLOW--: Account Create', () => {
it('created account is added to list', async () => {
const { findByTestId, findByText, queryByText } = renderAccounts();