diff --git a/jest-slow.config.cjs b/jest-slow.config.cjs new file mode 100644 index 000000000000..9b47f45fd15b --- /dev/null +++ b/jest-slow.config.cjs @@ -0,0 +1,11 @@ +// Copyright 2017-2021 @polkadot/apps authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +const config = require('./jest.config.cjs'); + +module.exports = { + ...config, + displayName: 'all-tests', + globalSetup: './jest/globalSetup.ts', + globalTeardown: './jest/globalTeardown.ts' +}; diff --git a/jest.config.cjs b/jest.config.cjs index 5a5ba8046045..3cc032fcf646 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -5,7 +5,8 @@ const config = require('@polkadot/dev/config/jest.cjs'); const findPackages = require('./scripts/findPackages.cjs'); -const defaultConfig = { +module.exports = { + ...config, moduleNameMapper: { ...( findPackages() @@ -22,22 +23,7 @@ const defaultConfig = { '\\.(md)$': '/jest/mocks/empty.js' }, setupFilesAfterEnv: ['/jest/jest-setup.ts'], + testEnvironment: 'jsdom', + testTimeout: 25000, transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)'] }; - -module.exports = { - ...config, - projects: [ - { - ...defaultConfig, - displayName: 'all-tests', - globalSetup: './jest/globalSetup.ts', - globalTeardown: './jest/globalTeardown.ts' - }, - { - ...defaultConfig, - displayName: 'fast-tests' - } - ], - testTimeout: 25000 -}; diff --git a/package.json b/package.json index 95638e425755..e105604ea410 100644 --- a/package.json +++ b/package.json @@ -58,9 +58,9 @@ "lint:css": "stylelint './packages/**/src/**/*.tsx'", "postinstall": "polkadot-dev-yarn-only", "postinstall:electron": "electron-builder install-app-deps", - "test": "echo 'tests skipped'", - "test:REPLACE": "polkadot-dev-run-test --selectProjects=fast-tests --silent --testPathIgnorePatterns slow --testNamePattern='^((?!--SLOW--).)*$'", - "test:all": "polkadot-dev-run-test --selectProjects=all-tests --silent", + "test:skipped": "echo 'tests skipped'", + "test": "polkadot-dev-run-test --runInBand --testPathIgnorePatterns slow --testNamePattern='^((?!--SLOW--).)*$'", + "test:all": "polkadot-dev-run-test --runInBand --config ./jest-slow.config.cjs", "test:one": "polkadot-dev-run-test", "start": "yarn clean && cd packages/apps && yarn webpack-cli serve --config webpack.serve.cjs --port 3000", "start:electron": "yarn clean:electronBuild && concurrently 'yarn build:devElectronMain && cd packages/apps-electron && electron ./build/electron.js' 'yarn build:devElectronRenderer'"