ghost-portal/jest.config.js
Krzysztof Jelski 8b50b1b28c
A proof of concept for frontend test with substrate in docker (#3371)
* React tests PoC.

* Globally start and stop substrate for all tests.

* Fix compilation problem.

* Another attempt to make both compilation and tests work.

* Apply suggestions from code review

* Run slow tests with docker only nightly.

* Update yarn.lock.

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-08-19 11:27:52 +02:00

44 lines
1.2 KiB
JavaScript

// Copyright 2017-2020 @polkadot/apps authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
const config = require('@polkadot/dev/config/jest');
const findPackages = require('./scripts/findPackages');
const internalModules = findPackages()
.filter(({ name }) => !['@polkadot/apps'].includes(name))
.reduce((modules, { dir, name }) => {
modules[`${name}(.*)$`] = `<rootDir>/packages/${dir}/src/$1`;
return modules;
}, {});
const defaultConfig = {
moduleNameMapper: {
...internalModules,
'\\.(css|less)$': 'empty/object',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object',
'\\.(md)$': '<rootDir>/__mocks__/fileMock.js'
},
testTimeout: 25000,
transformIgnorePatterns: [
'<rootDir>/node_modules'
]
};
module.exports = Object.assign({}, config, {
projects: [
{
...defaultConfig,
displayName: 'all-tests',
globalSetup: './jest/globalSetup.ts',
globalTeardown: './jest/globalTeardown.ts'
},
{
...defaultConfig,
displayName: 'fast-tests'
}
]
});