New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ci): Balance frontend tests #30949
Merged
Merged
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6f2c4c3
feat(ci): Balance frontend tests\
billyvg fa6adcf
style(lint): Auto commit lint changes
getsantry[bot] 22b6d83
oops
billyvg 990bf90
fix test paths
billyvg 898bcf5
fix for real
billyvg cc4e09d
remove console log
billyvg b269d83
Update jest.config.ts
billyvg 057628a
fix jest snapshots?
billyvg f92a8e3
style(lint): Auto commit lint changes
getsantry[bot] f38d2a4
style(lint): Auto commit lint changes
getsantry[bot] 381398d
style(lint): Auto commit lint changes
getsantry[bot] 8b499be
style(lint): Auto commit lint changes
getsantry[bot] bca6d60
style(lint): Auto commit lint changes
getsantry[bot] e207d1b
style(lint): Auto commit lint changes
getsantry[bot] 9d2ccdb
mount global modal before clicking button to open modal
billyvg f998e28
fix tag deprecated
billyvg 24e1285
style(lint): Auto commit lint changes
getsantry[bot] aade7e9
fix name
billyvg 78ad50e
style(lint): Auto commit lint changes
getsantry[bot] 4a7c9e1
Merge branch 'master' into feat/ci/jest-reporter-for-test-times
billyvg edde211
userEvent + more ticks
billyvg File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import {mountWithTheme} from 'sentry-test/reactTestingLibrary'; | ||
import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import Checkbox from 'sentry/components/checkbox'; | ||
|
||
describe('Checkbox', function () { | ||
it('renders', function () { | ||
it('renders', async function () { | ||
const {container} = mountWithTheme(<Checkbox onChange={() => {}} />); | ||
|
||
expect(await screen.findByRole('checkbox')).toBeInTheDocument(); | ||
expect(container).toSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import {mountWithTheme} from 'sentry-test/reactTestingLibrary'; | ||
import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import CircleIndicator from 'sentry/components/circleIndicator'; | ||
|
||
describe('CircleIndicator', function () { | ||
it('renders', function () { | ||
const {container} = mountWithTheme(<CircleIndicator />); | ||
it('renders', async function () { | ||
const {container} = mountWithTheme( | ||
<CircleIndicator data-test-id="circleIndicator" /> | ||
); | ||
|
||
expect(await screen.findByTestId('circleIndicator')).toBeInTheDocument(); | ||
expect(container).toSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import {mountWithTheme} from 'sentry-test/reactTestingLibrary'; | ||
import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import ReturnButton from 'sentry/views/settings/components/forms/returnButton'; | ||
|
||
describe('returnButton', function () { | ||
it('renders', function () { | ||
const {container} = mountWithTheme(<ReturnButton />); | ||
it('renders', async function () { | ||
const {container} = mountWithTheme(<ReturnButton data-test-id="returnButton" />); | ||
expect(await screen.findByTestId('returnButton')).toBeInTheDocument(); | ||
expect(container).toSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-env node */ | ||
/* eslint import/no-nodejs-modules:0 */ | ||
const fs = require('fs/promises'); | ||
|
||
class TestBalancer { | ||
constructor(globalConfig, options) { | ||
this._globalConfig = globalConfig; | ||
this._options = options; | ||
|
||
this.results = new Map(); | ||
} | ||
|
||
onTestFileResult(test) { | ||
const path = test.path.replace(this._globalConfig.rootDir, ''); | ||
this.results.set(path, test.duration); | ||
} | ||
|
||
onRunComplete(_contexts, results) { | ||
// results.success always returns false for me? | ||
if ( | ||
results.numTotalTests === 0 || | ||
results.numFailedTests > 0 || | ||
!this._options.enabled || | ||
!this._options.resultsPath | ||
) { | ||
return; | ||
} | ||
|
||
const data = JSON.stringify(Object.fromEntries(this.results), null, 2); | ||
fs.writeFile(this._options.resultsPath, data); | ||
} | ||
} | ||
|
||
module.exports = TestBalancer; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write this in typescript as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible unfortunately: jestjs/jest#8810