Run tests for all web app packages in CI (#22579)

* Run tests for all web app packages in CI

* Test specific packages instead of all of them

* Revert back to using test-ci scripts and rely on Jest to count the number of CPU cores

* Revert more changes made to the web app CI tests

* Fix path to client package tests
Этот коммит содержится в:
Harrison Healey
2023-03-23 14:23:56 -04:00
коммит произвёл GitHub
родитель 56b18ca7bf
Коммит 9b5afb1b5f
6 изменённых файлов: 29 добавлений и 9 удалений

Просмотреть файл

@@ -22,7 +22,7 @@
"test": "jest --forceExit --detectOpenHandles --verbose",
"test:watch": "jest --watch",
"test:updatesnapshot": "jest --updateSnapshot",
"test-ci": "jest --forceExit --detectOpenHandles --maxWorkers=2",
"test-ci": "jest --ci --forceExit --detectOpenHandles --maxWorkers=100%",
"clean": "rm -rf node_modules .eslintcache"
},
"dependencies": {

Просмотреть файл

@@ -224,7 +224,7 @@
"run": "webpack --progress --watch",
"dev-server": "webpack serve --mode development",
"test": "cross-env TZ=Etc/UTC jest --maxWorkers=50%",
"test-ci": "cross-env NODE_OPTIONS=--max_old_space_size=5120 TZ=Etc/UTC jest --ci",
"test-ci": "cross-env TZ=Etc/UTC jest --ci --maxWorkers=100%",
"clean": "rm -rf dist node_modules .eslintcache .stylelintcache tsconfig.tsbuildinfo",
"stats": "cross-env NODE_ENV=production webpack --profile --json > webpack_stats.json",
"updatesnapshot": "cross-env TZ=Etc/UTC jest --updateSnapshot",

Просмотреть файл

@@ -39,6 +39,7 @@
"build": "tsc --build --verbose",
"run": "tsc --watch --preserveWatchOutput",
"test": "jest",
"test-ci": "jest --ci --forceExit --detectOpenHandles --maxWorkers=100%",
"clean": "rm -rf lib node_modules tsconfig.tsbuildinfo"
}
}

18
webapp/playbooks/jest.config.js Обычный файл
Просмотреть файл

@@ -0,0 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/** @type {import('jest').Config} */
const config = {
moduleDirectories: ['src', 'node_modules'],
moduleNameMapper: {
'^@mattermost/(components)$': '<rootDir>/../platform/$1/src',
'^@mattermost/(client)$': '<rootDir>/../platform/$1/src',
'^@mattermost/(types)/(.*)$': '<rootDir>/../platform/$1/src/$2',
'^reselect$': '<rootDir>/../channels/src/packages/reselect/src',
'^src/(.*)$': '<rootDir>/src/$1',
},
testEnvironment: 'jsdom',
};
module.exports = config;

Просмотреть файл

@@ -126,7 +126,7 @@
"fix": "eslint --ignore-pattern node_modules --ignore-pattern dist --ext .js --ext .jsx --ext tsx --ext ts . --quiet --fix --cache",
"test": "jest --forceExit --detectOpenHandles --verbose",
"test:watch": "jest --watch",
"test-ci": "jest --forceExit --detectOpenHandles --maxWorkers=2",
"test-ci": "jest --ci --forceExit --detectOpenHandles --maxWorkers=100%",
"check-types": "tsc -b",
"extract": "formatjs extract 'src/**/*.{ts,tsx}' --out-file i18n/temp.json --id-interpolation-pattern '[sha512:contenthash:base64:6]' && formatjs compile 'i18n/temp.json' --out-file i18n/en.json && rm i18n/temp.json",
"graphql": "graphql-codegen --config graphql_gen.ts",