Skip to content

Commit 8926fb4

Browse files
fix: move tests to github dir
1 parent 5aec532 commit 8926fb4

File tree

7 files changed

+26
-29
lines changed

7 files changed

+26
-29
lines changed

src/github/__tests__/bundle.test.ts renamed to .github/workflows/scripts/__tests__/bundle.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
generateBundleSizeSection,
3-
getBundleInfo,
4-
} from '../../../.github/workflows/scripts/utils/bundle';
1+
import {generateBundleSizeSection, getBundleInfo} from '../utils/bundle';
52

63
describe('bundle utils', () => {
74
describe('generateBundleSizeSection', () => {

src/github/__tests__/format.test.ts renamed to .github/workflows/scripts/__tests__/format.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
formatSize,
3-
generateTestChangesSummary,
4-
} from '../../../.github/workflows/scripts/utils/format';
1+
import {formatSize, generateTestChangesSummary} from '../utils/format';
52

63
describe('format utils', () => {
74
describe('formatSize', () => {

src/github/__tests__/results.test.ts renamed to .github/workflows/scripts/__tests__/results.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs';
22

3-
import {getTestStatus, readTestResults} from '../../../.github/workflows/scripts/utils/results';
4-
import type {TestResults, TestResultsInfo, TestStatusInfo} from '../types';
3+
import {getTestStatus, readTestResults} from '../utils/results';
4+
import type {TestResults, TestResultsInfo, TestStatusInfo} from './types';
55

66
jest.mock('fs');
77

src/github/__tests__/test.test.ts renamed to .github/workflows/scripts/__tests__/test.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import {
2-
compareTests,
3-
extractTestsFromSuite,
4-
isTestSkipped,
5-
} from '../../../.github/workflows/scripts/utils/test';
6-
import type {Spec, Suite, TestInfo} from '../types';
1+
import {compareTests, extractTestsFromSuite, isTestSkipped} from '../utils/test';
2+
import type {Spec, Suite, TestInfo} from './types';
73

84
describe('test utils', () => {
95
describe('isTestSkipped', () => {
File renamed without changes.

src/github/__tests__/update-pr-description.test.ts renamed to .github/workflows/scripts/__tests__/update-pr-description.test.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
import updatePRDescription from '../../../.github/workflows/scripts/update-pr-description';
2-
import {
3-
generateBundleSizeSection,
4-
getBundleInfo,
5-
} from '../../../.github/workflows/scripts/utils/bundle';
6-
import {generateTestChangesSummary} from '../../../.github/workflows/scripts/utils/format';
7-
import {getTestStatus, readTestResults} from '../../../.github/workflows/scripts/utils/results';
8-
import {compareTests} from '../../../.github/workflows/scripts/utils/test';
9-
import type {TestResultsInfo} from '../types';
1+
import updatePRDescription from '../update-pr-description';
2+
import {generateBundleSizeSection, getBundleInfo} from '../utils/bundle';
3+
import {generateTestChangesSummary} from '../utils/format';
4+
import {getTestStatus, readTestResults} from '../utils/results';
5+
import {compareTests} from '../utils/test';
6+
import type {TestResultsInfo} from './types';
107

118
// Mock dependencies
12-
jest.mock('../../../.github/workflows/scripts/utils/results', () => ({
9+
jest.mock('../utils/results', () => ({
1310
readTestResults: jest.fn(),
1411
getTestStatus: jest.fn(),
1512
}));
16-
jest.mock('../../../.github/workflows/scripts/utils/test');
17-
jest.mock('../../../.github/workflows/scripts/utils/format');
18-
jest.mock('../../../.github/workflows/scripts/utils/bundle');
13+
jest.mock('../utils/test');
14+
jest.mock('../utils/format');
15+
jest.mock('../utils/bundle');
1916
jest.mock('fs');
2017

2118
describe('updatePRDescription', () => {

config-overrides.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ module.exports = {
6060
// see https://github.com/timarney/react-app-rewired/issues/241
6161
config.transformIgnorePatterns = ['node_modules/(?!(@gravity-ui)/)'];
6262

63+
// Add .github directory to roots
64+
config.roots = ['<rootDir>/src', '<rootDir>/.github'];
65+
66+
// Update testMatch to include .github directory
67+
config.testMatch = [
68+
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
69+
'<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
70+
'<rootDir>/.github/**/*.{spec,test}.{js,jsx,ts,tsx}',
71+
];
72+
6373
return config;
6474
},
6575
};

0 commit comments

Comments
 (0)