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

chore(transform): refactor API to pass an options bag around rather than multiple boolean options #10753

Merged
merged 1 commit into from
Nov 4, 2020

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Oct 31, 2020

Summary

What it says on the tin - to make it less spaghetti to pass options internally in the class. Especially after #10752 adds 2 more fields

Test plan

Green CI

@SimenB SimenB added this to the Jest 27 milestone Oct 31, 2020
@SimenB SimenB force-pushed the transform-api-refactor branch 4 times, most recently from 97b1d9a to 4ece96b Compare October 31, 2020 16:41
@@ -260,23 +262,14 @@ export default class ScriptTransformer {
this._getTransformer(filepath);
}

// TODO: replace third argument with TransformOptions in Jest 26
Copy link
Member Author

Choose a reason for hiding this comment

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

😅

@@ -520,9 +502,7 @@ export default class ScriptTransformer {
try {
transforming = true;
return (
// we might wanna do `supportsDynamicImport` at some point
Copy link
Member Author

Choose a reason for hiding this comment

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

allowing consumers of this API to decide seems best

supportsStaticESM,
} = options;
const content = stripShebang(
fileSource || fs.readFileSync(filename, 'utf8'),
Copy link
Member Author

@SimenB SimenB Oct 31, 2020

Choose a reason for hiding this comment

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

jest-runtime already sends in the source, seemed like a good time to remove this fallback

Copy link
Member Author

Choose a reason for hiding this comment

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

ugh, too painful to fix the tests, can circle back to it later. I pushed WIP stuff here: SimenB@31d67e2

@ahnpnl
Copy link
Contributor

ahnpnl commented Nov 1, 2020

Lovely, looking forward to this. Is it possible to have alpha/beta version to adopt earlier than waiting for official release ?

@SimenB
Copy link
Member Author

SimenB commented Nov 1, 2020

Yeah, I'll be landing a whole bunch of the breaking changes we have lined up (see the milestone) next week and release an alpha

@SimenB SimenB merged commit ab5bd0f into jestjs:master Nov 4, 2020
@SimenB SimenB deleted the transform-api-refactor branch November 4, 2020 17:26
jeysal added a commit to mmkal/jest that referenced this pull request Nov 8, 2020
* master: (398 commits)
  chore(breaking): remove undocumented `enabledTestsMap` config (jestjs#10787)
  Change expect.not.objectContaining() to match documentation (jestjs#10708)
  chore: add name to root project (jestjs#10782)
  Added explanation on how to use custom @jest-environment to docs (jestjs#10783)
  fix: remove deprecated functions from the jest object (jestjs#9853)
  chore: convert jest-runtime to ESM (jestjs#10325)
  fix(resolve): use escalade to find package.json (jestjs#10781)
  feat(jest-runner): set exit code to 1 if test logs after teardown (jestjs#10728)
  chore: add `exports` field to all `package.json`s (jestjs#9921)
  fix: do not inject `global` variable into module wrapper (jestjs#10644)
  chore: migrate jest-resolve to ESM (jestjs#10688)
  chore(transform): refactor API to pass an options bag around rather than multiple boolean options (jestjs#10753)
  chore: default to node test env rather than browser (jestjs#9874)
  fix: drop support for node 13 (jestjs#10685)
  chore: show enhanced syntax error for all syntax errors (jestjs#10749)
  chore: update lockfile after publish
  v26.6.3
  chore: update changelog for release
  Don't throw an error if mock dependency can't be found (jestjs#10779)
  chore: bump babel core types (jestjs#10772)
  ...
@SimenB
Copy link
Member Author

SimenB commented Dec 5, 2020

@ahnpnl jest@next published now

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants