Skip to content
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

build(jest): Use jest-circus as test runner #17681

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ env:
- DJANGO_VERSION=">=1.11,<1.12"
# node's version is pinned by .nvmrc and is autodetected by `nvm install`.
- NODE_DIR="${HOME}/.nvm/versions/node/v$(< .nvmrc)"
- NODE_OPTIONS=--max-old-space-size=4096
- NODE_OPTIONS=--max-old-space-size=6144
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circus seems to require for memory :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- PYTEST_SENTRY_DSN=https://[email protected]/2423079
- SENTRY_KAFKA_HOSTS=localhost:9092
- SENTRY_ZOOKEEPER_HOSTS=localhost:2181
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
'<rootDir>/tests/fixtures/integration-docs/_platforms.json',
},
modulePaths: ['<rootDir>/src/sentry/static/sentry'],
modulePathIgnorePatterns: ['<rootDir>/src/sentry/static/sentry/dist'],
setupFiles: [
'<rootDir>/src/sentry/static/sentry/app/utils/silence-react-unsafe-warnings.js',
'<rootDir>/tests/js/throw-on-react-error.js',
Expand All @@ -25,6 +26,8 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/tests/js/setupFramework.js'],
testMatch: ['<rootDir>/tests/js/**/*(*.)@(spec|test).js?(x)'],
testPathIgnorePatterns: ['<rootDir>/tests/sentry/lang/javascript/'],
testRunner: 'jest-circus/runner',

unmockedModulePathPatterns: [
'<rootDir>/node_modules/react',
'<rootDir>/node_modules/reflux',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
"eslint-plugin-emotion": "^10.0.14",
"jest": "24.9.0",
"jest-canvas-mock": "^2.2.0",
"jest-circus": "^25.1.0",
"jest-junit": "^9.0.0",
"mockdate": "2.0.5",
"object.fromentries": "^2.0.0",
Expand Down
21 changes: 0 additions & 21 deletions tests/js/spec/api.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import $ from 'jquery';
import * as Sentry from '@sentry/browser';

import {Client, Request, paramsToQueryArgs} from 'app/api';
import GroupActions from 'app/actions/groupActions';
Expand Down Expand Up @@ -260,24 +259,4 @@ describe('api', function() {
);
});
});

describe('Sentry reporting', function() {
beforeEach(function() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty beforeEach that does nothing.

jest.spyOn($, 'ajax');

$.ajax.mockReset();
Sentry.captureException.mockClear();

$.ajax.mockImplementation(async ({error}) => {
await tick();
error({
status: 500,
statusText: 'Internal server error',
responseJSON: {detail: 'Item was not found'},
});

return {};
});
});
});
});
12 changes: 6 additions & 6 deletions tests/js/spec/components/__snapshots__/shareIssue.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ exports[`ShareIssue renders when busy 1`] = `
}
}
>
<ForwardRef(render)
<FlowLayout
center={true}
truncate={true}
>
<IndicatorDot />
Share
</ForwardRef(render)>
</FlowLayout>
</div>
}
>
Expand Down Expand Up @@ -72,15 +72,15 @@ exports[`ShareIssue renders when not shared 1`] = `
}
}
>
<ForwardRef(render)
<FlowLayout
center={true}
truncate={true}
>
<IndicatorDot
active={false}
/>
Share
</ForwardRef(render)>
</FlowLayout>
</div>
}
>
Expand Down Expand Up @@ -129,15 +129,15 @@ exports[`ShareIssue renders when shared 1`] = `
}
}
>
<ForwardRef(render)
<FlowLayout
center={true}
truncate={true}
>
<IndicatorDot
active={true}
/>
Share
</ForwardRef(render)>
</FlowLayout>
</div>
}
>
Expand Down
12 changes: 6 additions & 6 deletions tests/js/spec/components/__snapshots__/version.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,26 @@ exports[`Version renders 1`] = `
isHoverable={true}
position="top"
title={
<ForwardRef(render)
<TooltipContent
onClick={[Function]}
>
<ForwardRef(render)>
<TooltipVersionWrapper>
[email protected]+20200101
</ForwardRef(render)>
</TooltipVersionWrapper>
<Clipboard
errorMessage="Error copying to clipboard"
hideMessages={false}
successMessage="Copied to clipboard"
value="[email protected]+20200101"
>
<ForwardRef(render)>
<TooltipClipboardIconWrapper>
<ForwardRef(IconCopy)
color="white"
size="xs"
/>
</ForwardRef(render)>
</TooltipClipboardIconWrapper>
</Clipboard>
</ForwardRef(render)>
</TooltipContent>
}
>
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports[`Docs Search Modal can open help search modal and complete a search 1`]
item={
Object {
"description": "Doc result 1 description",
"resultIcon": <ForwardRef(render) />,
"resultIcon": <DocsBadge />,
"resultType": "doc",
"sourceType": "help",
"title": "Doc result 1",
Expand All @@ -53,7 +53,7 @@ exports[`Docs Search Modal can open help search modal and complete a search 1`]
item={
Object {
"description": "Doc result 1 description",
"resultIcon": <ForwardRef(render) />,
"resultIcon": <DocsBadge />,
"resultType": "doc",
"sourceType": "help",
"title": "Doc result 1",
Expand Down Expand Up @@ -179,7 +179,7 @@ exports[`Docs Search Modal can open help search modal and complete a search 1`]
item={
Object {
"description": "FAQ result 1 description",
"resultIcon": <ForwardRef(render) />,
"resultIcon": <FaqsBadge />,
"resultType": "faq",
"sourceType": "help",
"title": "FAQ result 1",
Expand All @@ -206,7 +206,7 @@ exports[`Docs Search Modal can open help search modal and complete a search 1`]
item={
Object {
"description": "FAQ result 1 description",
"resultIcon": <ForwardRef(render) />,
"resultIcon": <FaqsBadge />,
"resultType": "faq",
"sourceType": "help",
"title": "FAQ result 1",
Expand Down
8 changes: 4 additions & 4 deletions tests/js/spec/views/__snapshots__/apiTokens.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ exports[`ApiTokens renders empty result 1`] = `
<div>
<StyledSettingsPageHeading
action={
<ForwardRef
<forwardRef<Button>
data-test-id="create-token"
priority="primary"
size="small"
to="/settings/account/api/auth-tokens/new-token/"
>
Create New Token
</ForwardRef>
</forwardRef<Button>>
}
noTitleStyles={false}
title="Auth Tokens"
Expand Down Expand Up @@ -93,14 +93,14 @@ exports[`ApiTokens renders with result 1`] = `
<div>
<StyledSettingsPageHeading
action={
<ForwardRef
<forwardRef<Button>
data-test-id="create-token"
priority="primary"
size="small"
to="/settings/account/api/auth-tokens/new-token/"
>
Create New Token
</ForwardRef>
</forwardRef<Button>>
}
noTitleStyles={false}
title="Auth Tokens"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ exports[`OrganizationTeamProjects Should render 1`] = `
items={
Array [
Object {
"label": <ForwardRef(render)>
"label": <ProjectListElement>
project-slug
</ForwardRef(render)>,
</ProjectListElement>,
"searchKey": "project-slug",
"value": "2",
},
Object {
"label": <ForwardRef(render)>
"label": <ProjectListElement>
project-slug-2
</ForwardRef(render)>,
</ProjectListElement>,
"searchKey": "project-slug-2",
"value": "3",
},
Expand All @@ -105,16 +105,16 @@ exports[`OrganizationTeamProjects Should render 1`] = `
items={
Array [
Object {
"label": <ForwardRef(render)>
"label": <ProjectListElement>
project-slug
</ForwardRef(render)>,
</ProjectListElement>,
"searchKey": "project-slug",
"value": "2",
},
Object {
"label": <ForwardRef(render)>
"label": <ProjectListElement>
project-slug-2
</ForwardRef(render)>,
</ProjectListElement>,
"searchKey": "project-slug-2",
"value": "3",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ exports[`ProjectPluginDetails renders 1`] = `
<div
className="pull-right"
>
<ForwardRef
<forwardRef<Button>
disabled={false}
onClick={[Function]}
size="small"
Expand All @@ -370,13 +370,13 @@ exports[`ProjectPluginDetails renders 1`] = `
}
>
Enable Plugin
</ForwardRef>
<ForwardRef
</forwardRef<Button>>
<forwardRef<Button>
onClick={[Function]}
size="small"
>
Reset Configuration
</ForwardRef>
</forwardRef<Button>>
</div>
}
noTitleStyles={false}
Expand All @@ -387,7 +387,7 @@ exports[`ProjectPluginDetails renders 1`] = `
<div
className="pull-right"
>
<ForwardRef
<forwardRef<Button>
disabled={false}
onClick={[Function]}
size="small"
Expand All @@ -398,13 +398,13 @@ exports[`ProjectPluginDetails renders 1`] = `
}
>
Enable Plugin
</ForwardRef>
<ForwardRef
</forwardRef<Button>>
<forwardRef<Button>
onClick={[Function]}
size="small"
>
Reset Configuration
</ForwardRef>
</forwardRef<Button>>
</div>
}
className="css-xtfhnp-StyledSettingsPageHeading e1uay4fd4"
Expand Down
8 changes: 4 additions & 4 deletions tests/js/spec/views/__snapshots__/projectTeams.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ exports[`ProjectTeams renders 1`] = `
confirmLastTeamRemoveMessage="This is the last team with access to this project. Removing it will mean only organization owners and managers will be able to access the project pages. Are you sure you want to remove this team from the project project-slug?"
disabled={false}
menuHeader={
<ForwardRef(render)>
<StyledTeamsLabel>
Teams
<Tooltip
containerDisplayMode="inline-block"
disabled={true}
position="top"
title="You must be a project admin to create teams"
>
<ForwardRef(render)
<StyledCreateTeamLink
disabled={false}
onClick={[Function]}
>
Create Team
</ForwardRef(render)>
</StyledCreateTeamLink>
</Tooltip>
</ForwardRef(render)>
</StyledTeamsLabel>
}
onAddTeam={[Function]}
onRemoveTeam={[Function]}
Expand Down
Loading