Skip to content

ref(dev): Centralize jest config #4907

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

Merged
merged 6 commits into from
Apr 11, 2022
Merged

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Apr 10, 2022

Currently, we configure jest using a mix of package.json entries and jest.config.js files, and there's a great deal of repetition between configs. To make things DRYer and easier to update (as will happen in future PRs), this aims to fix that by creating a centralized jest config from which all others can inherit. To facilitate this inheritance, all config has been removed from package.json files and moved into jest.config.js files.

For ease of review, this has been broken down into a few distinct stages, each represented by a commit:

  • Extracting the config which was identical across many packages into a central config file, and fixing a mistake they all contained, namely that they were using the regular tsconfig file rather than the test-specific one.
  • In the packages which were using exactly that config, creating a new jest.config.js file and inheriting directly from the central jest config with no changes.
  • In the packages whose config varied only slightly from the boilerplate config, creating a new jest.config.js file and inheriting from the central file with small changes. This also required adding .tsx files to the central config.
  • In the browser package, moving the existing jest.config.js for the unit tests to the repo root level and refactoring it to inherit from the central file. This also required specifying a coverage directory in the central config and modifying the browser package's yarn test commands.
  • In the node integration test package, refactoring the existing jest.config.js to inherit from the central file. This also required creating a test-specific tsconfig to match the one in other packages.
  • Finally, making a small optimization (narrowing the scope of where to look for tests) in the now universally-used central config.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 10, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.06 KB (-0.38% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 64.28 KB (-0.51% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.77 KB (-0.46% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 57.67 KB (-0.52% 🔽)
@sentry/browser - Webpack (gzipped + minified) 23.05 KB (-0.82% 🔽)
@sentry/browser - Webpack (minified) 80.87 KB (-1.03% 🔽)
@sentry/react - Webpack (gzipped + minified) 23.09 KB (-0.81% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.86 KB (-0.41% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.01 KB (-0.25% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.42 KB (-0.27% 🔽)

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

cool cleanup, lgtm!

@lobsterkatie lobsterkatie force-pushed the kmclb-centralize-jest-config branch from 649be8d to 174d8bd Compare April 11, 2022 13:13
@lobsterkatie lobsterkatie marked this pull request as ready for review April 11, 2022 13:14
@lobsterkatie lobsterkatie merged commit 4f0469b into 7.x Apr 11, 2022
@lobsterkatie lobsterkatie deleted the kmclb-centralize-jest-config branch April 11, 2022 13:49
@AbhiPrasad AbhiPrasad added this to the 7.0.0 milestone Apr 11, 2022
lobsterkatie added a commit that referenced this pull request Apr 12, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
lobsterkatie added a commit that referenced this pull request Apr 13, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
Lms24 pushed a commit that referenced this pull request Apr 26, 2022
Currently, we configure jest using a mix of `package.json` entries and `jest.config.js` files, and there's a great deal of repetition between configs. To make things DRYer and easier to update (as will happen in future PRs), this aims to fix that by creating a centralized jest config from which all others can inherit. To facilitate this inheritance, all config has been removed from `package.json` files and moved into `jest.config.js` files. 

This change was done in a few distinct stages:

- Extracting the config which was identical across many packages into a central config file, and fixing a mistake they all contained, namely that they were using the regular tsconfig file rather than the test-specific one.
- In the packages which were using exactly that config, creating a new `jest.config.js` file and inheriting directly from the central jest config with no changes.
- In the packages whose config varied only slightly from the boilerplate config, creating a new `jest.config.js` file and inheriting from the central file with small changes. This also required adding `.tsx` files to the central config.
- In the browser package, moving the existing `jest.config.js` for the unit tests to the repo root level and refactoring it to inherit from the central file. This also required specifying a coverage directory in the central config and modifying the browser package's yarn test commands.
- In the node integration test package, refactoring the existing `jest.config.js` to inherit from the central file. This also required creating a test-specific tsconfig to match the one in other packages.
- Finally, making a small optimization (narrowing the scope of where to look for tests) in the now universally-used central config.
Lms24 pushed a commit that referenced this pull request Apr 26, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
Currently, we configure jest using a mix of `package.json` entries and `jest.config.js` files, and there's a great deal of repetition between configs. To make things DRYer and easier to update (as will happen in future PRs), this aims to fix that by creating a centralized jest config from which all others can inherit. To facilitate this inheritance, all config has been removed from `package.json` files and moved into `jest.config.js` files. 

This change was done in a few distinct stages:

- Extracting the config which was identical across many packages into a central config file, and fixing a mistake they all contained, namely that they were using the regular tsconfig file rather than the test-specific one.
- In the packages which were using exactly that config, creating a new `jest.config.js` file and inheriting directly from the central jest config with no changes.
- In the packages whose config varied only slightly from the boilerplate config, creating a new `jest.config.js` file and inheriting from the central file with small changes. This also required adding `.tsx` files to the central config.
- In the browser package, moving the existing `jest.config.js` for the unit tests to the repo root level and refactoring it to inherit from the central file. This also required specifying a coverage directory in the central config and modifying the browser package's yarn test commands.
- In the node integration test package, refactoring the existing `jest.config.js` to inherit from the central file. This also required creating a test-specific tsconfig to match the one in other packages.
- Finally, making a small optimization (narrowing the scope of where to look for tests) in the now universally-used central config.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
Currently, we configure jest using a mix of `package.json` entries and `jest.config.js` files, and there's a great deal of repetition between configs. To make things DRYer and easier to update (as will happen in future PRs), this aims to fix that by creating a centralized jest config from which all others can inherit. To facilitate this inheritance, all config has been removed from `package.json` files and moved into `jest.config.js` files. 

This change was done in a few distinct stages:

- Extracting the config which was identical across many packages into a central config file, and fixing a mistake they all contained, namely that they were using the regular tsconfig file rather than the test-specific one.
- In the packages which were using exactly that config, creating a new `jest.config.js` file and inheriting directly from the central jest config with no changes.
- In the packages whose config varied only slightly from the boilerplate config, creating a new `jest.config.js` file and inheriting from the central file with small changes. This also required adding `.tsx` files to the central config.
- In the browser package, moving the existing `jest.config.js` for the unit tests to the repo root level and refactoring it to inherit from the central file. This also required specifying a coverage directory in the central config and modifying the browser package's yarn test commands.
- In the node integration test package, refactoring the existing `jest.config.js` to inherit from the central file. This also required creating a test-specific tsconfig to match the one in other packages.
- Finally, making a small optimization (narrowing the scope of where to look for tests) in the now universally-used central config.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
Currently, we configure jest using a mix of `package.json` entries and `jest.config.js` files, and there's a great deal of repetition between configs. To make things DRYer and easier to update (as will happen in future PRs), this aims to fix that by creating a centralized jest config from which all others can inherit. To facilitate this inheritance, all config has been removed from `package.json` files and moved into `jest.config.js` files. 

This change was done in a few distinct stages:

- Extracting the config which was identical across many packages into a central config file, and fixing a mistake they all contained, namely that they were using the regular tsconfig file rather than the test-specific one.
- In the packages which were using exactly that config, creating a new `jest.config.js` file and inheriting directly from the central jest config with no changes.
- In the packages whose config varied only slightly from the boilerplate config, creating a new `jest.config.js` file and inheriting from the central file with small changes. This also required adding `.tsx` files to the central config.
- In the browser package, moving the existing `jest.config.js` for the unit tests to the repo root level and refactoring it to inherit from the central file. This also required specifying a coverage directory in the central config and modifying the browser package's yarn test commands.
- In the node integration test package, refactoring the existing `jest.config.js` to inherit from the central file. This also required creating a test-specific tsconfig to match the one in other packages.
- Finally, making a small optimization (narrowing the scope of where to look for tests) in the now universally-used central config.
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
In #4907, all of our jest config was pulled out of `package.json` and put into `jest.config.js` files. This fixes our VSCode debug profile for unit tests to point to the new config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants