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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
56b18ca7bf
Коммит
9b5afb1b5f
13
.github/workflows/channels-ci.yml
поставляемый
13
.github/workflows/channels-ci.yml
поставляемый
@@ -111,7 +111,7 @@ jobs:
|
||||
- name: ci/lint
|
||||
run: |
|
||||
npm run check-types
|
||||
tests:
|
||||
test:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [check-types, check-i18n, check-lint]
|
||||
permissions:
|
||||
@@ -143,13 +143,14 @@ jobs:
|
||||
run: |
|
||||
make node_modules
|
||||
# make channels/e2e/playwright/node_modules
|
||||
- name: ci/detect-cpu-core
|
||||
id: cpu-cores
|
||||
uses: SimenB/github-actions-cpu-cores@c508d404ab007faae80a014072fd8c0e17792118 # v1.1.0
|
||||
- name: ci/test
|
||||
working-directory: webapp/channels
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=5120
|
||||
run: |
|
||||
npm run test-ci -- --maxWorkers=${{ steps.cpu-cores.outputs.count }}
|
||||
# npm run test-ci --workspace=boards
|
||||
npm run test-ci --workspace=channels
|
||||
npm run test-ci --workspace=platform/client
|
||||
npm run test-ci --workspace=playbooks
|
||||
- name: ci/publish-test-results
|
||||
uses: EnricoMi/publish-unit-test-result-action@a3caf02865c0604ad3dc1ecfcc5cdec9c41b7936 # v2.3.0
|
||||
if: always()
|
||||
|
||||
@@ -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
Обычный файл
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",
|
||||
|
||||
Ссылка в новой задаче
Block a user