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

global setup and global teardown now gets globalConfig as a parameter #6486

Merged
merged 3 commits into from
Jun 20, 2018

Conversation

ranyitz
Copy link
Contributor

@ranyitz ranyitz commented Jun 17, 2018

Summary

This PR fixes #5957.

globalSetup and globalTeardown functions will receive Jest's globalConfig object as a parameter.

Test plan

Pass a specific parameter to the configuration, console.log it from the globalSetup/globalTeardown functions and verify it shows up in the stdout.

@SimenB
Copy link
Member

SimenB commented Jun 18, 2018

CI fails on windows, mind taking a look?

`--testPathPattern=${testPathPattern}`,
]);

expect(result.stdout).toBe(testPathPattern);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe pass through slash to fix the os inconsistencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the advice, I realized that I can test it without giving a path to the testPathPattern so we won't have to deal with the inconsistency in the first place.

@codecov-io
Copy link

Codecov Report

Merging #6486 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6486   +/-   ##
=======================================
  Coverage   63.48%   63.48%           
=======================================
  Files         227      227           
  Lines        8697     8697           
  Branches        4        4           
=======================================
  Hits         5521     5521           
  Misses       3175     3175           
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-cli/src/run_jest.js 69.41% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47d4370...d66f59b. Read the comment docs.

@cpojer cpojer merged commit 15e63b2 into jestjs:master Jun 20, 2018
@ranyitz ranyitz deleted the global-setup-teardown-config-param branch June 20, 2018 19:35
calebeby pushed a commit to Pigmice2733/scouting-frontend that referenced this pull request Jun 30, 2018
This Pull Request updates dependency [jest](https://github.com/facebook/jest) from `v23.1.0` to `v23.2.0`



<details>
<summary>Release Notes</summary>

### [`v23.2.0`](https://github.com/facebook/jest/blob/master/CHANGELOG.md#&#8203;2320)
[Compare Source](jestjs/jest@v23.1.0...v23.2.0)
##### Features

- `[jest-each]` Add support for keyPaths in test titles ([#&#8203;6457](`jestjs/jest#6457))
- `[jest-cli]` Add `jest --init` option that generates a basic configuration file with a short description for each option ([#&#8203;6442](`jestjs/jest#6442))
- `[jest.retryTimes]` Add `jest.retryTimes()` option that allows failed tests to be retried n-times when using jest-circus. ([#&#8203;6498](`jestjs/jest#6498))
##### Fixes

- `[jest-cli]` Add check to make sure one or more tests have run before notifying when using `--notify` ([#&#8203;6495](`jestjs/jest#6495))
- `[jest-cli]` Pass `globalConfig` as a parameter to `globalSetup` and `globalTeardown` functions ([#&#8203;6486](`jestjs/jest#6486))
- `[jest-config]` Add missing options to the `defaults` object ([#&#8203;6428](`jestjs/jest#6428))
- `[expect]` Using symbolic property names in arrays no longer causes the `toEqual` matcher to fail ([#&#8203;6391](`jestjs/jest#6391))
- `[expect]` `toEqual` no longer tries to compare non-enumerable symbolic properties, to be consistent with non-symbolic properties. ([#&#8203;6398](`jestjs/jest#6398))
- `[jest-util]` `console.timeEnd` now properly log elapsed time in milliseconds. ([#&#8203;6456](`jestjs/jest#6456))
- `[jest-mock]` Fix `MockNativeMethods` access in react-native `jest.mock()` ([#&#8203;6505](`jestjs/jest#6505))
##### Chore & Maintenance

- `[docs]` Add jest-each docs for 1 dimensional arrays ([#&#8203;6444](`jestjs/jest#6444))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
@backflip
Copy link
Contributor

backflip commented Sep 18, 2018

@SimenB, @cpojer: Since testEnvironmentOptions is not part of globalOptions, the globalSetup/globalTeardown don't have access to it. Could we move it from projectConfig to globalConfig? Apparently you were discussing the general config situation in #5176 (comment), however, I can't find a documented outcome.

Or could it be specified in both places, analogous to globalSetup/globalTeardown in #6865?

@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 12, 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.

Proposal: pass config to globalSetup and globalTeardown
6 participants