Move Jest tests to filtered GitHub Action (#23623)

main
Nick Schonning 2023-02-15 19:24:35 -05:00 committed by GitHub
parent fb8503e861
commit 418c3a4699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 26 deletions

View File

@ -217,11 +217,3 @@ workflows:
- test-two-step-migrations: - test-two-step-migrations:
requires: requires:
- build - build
- node/run:
cache-version: v1
name: test-webui
pkg-manager: yarn
requires:
- build
version: '16.19'
yarn-run: test:jest

41
.github/workflows/test-js.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: JavaScript Testing
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '**/*.js'
- '**/*.snap'
- '.github/workflows/test-js.yml'
pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '**/*.js'
- '**/*.snap'
- '.github/workflows/test-js.yml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version-file: '.nvmrc'
- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Jest testing
run: yarn test:jest --reporters github-actions summary

View File

@ -1,9 +1,7 @@
module.exports = { /** @type {import('jest').Config} */
'testEnvironment': 'jsdom', const config = {
'projects': [ testEnvironment: 'jsdom',
'<rootDir>/app/javascript/mastodon', testPathIgnorePatterns: [
],
'testPathIgnorePatterns': [
'<rootDir>/node_modules/', '<rootDir>/node_modules/',
'<rootDir>/vendor/', '<rootDir>/vendor/',
'<rootDir>/config/', '<rootDir>/config/',
@ -11,22 +9,17 @@ module.exports = {
'<rootDir>/public/', '<rootDir>/public/',
'<rootDir>/tmp/', '<rootDir>/tmp/',
], ],
'setupFiles': [ setupFiles: ['raf/polyfill'],
'raf/polyfill', setupFilesAfterEnv: ['<rootDir>/app/javascript/mastodon/test_setup.js'],
], collectCoverageFrom: [
'setupFilesAfterEnv': [
'<rootDir>/app/javascript/mastodon/test_setup.js',
],
'collectCoverageFrom': [
'app/javascript/mastodon/**/*.js', 'app/javascript/mastodon/**/*.js',
'!app/javascript/mastodon/features/emoji/emoji_compressed.js', '!app/javascript/mastodon/features/emoji/emoji_compressed.js',
'!app/javascript/mastodon/locales/locale-data/*.js', '!app/javascript/mastodon/locales/locale-data/*.js',
'!app/javascript/mastodon/service_worker/entry.js', '!app/javascript/mastodon/service_worker/entry.js',
'!app/javascript/mastodon/test_setup.js', '!app/javascript/mastodon/test_setup.js',
], ],
'coverageDirectory': '<rootDir>/coverage', coverageDirectory: '<rootDir>/coverage',
'moduleDirectories': [ moduleDirectories: ['<rootDir>/node_modules', '<rootDir>/app/javascript'],
'<rootDir>/node_modules',
'<rootDir>/app/javascript',
],
}; };
module.exports = config;