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

jest-circus test utilities #5636

Merged
merged 1 commit into from
Feb 27, 2018
Merged

jest-circus test utilities #5636

merged 1 commit into from
Feb 27, 2018

Conversation

aaronabramov
Copy link
Contributor

utility function that runs a test using jest-circus and logs every event that goes through the event handler. (see snapshot test)

This is useful to test the definition and execution flow and make sure future work won't break the flow. (e.g. beforeEach suddenly isn't invoked before test)

@@ -13,8 +13,7 @@
"graceful-fs": "^4.1.11",
"is-ci": "^1.0.10",
"jest-message-util": "^22.4.0",
"mkdirp": "^0.5.1",
"source-map": "^0.6.0"
"mkdirp": "^0.5.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure why this and yarn.lock got messed up. am i using an old yarn version on something? or is master currently out of sync?

Copy link
Member

Choose a reason for hiding this comment

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

this is weird - source-map was just added in #5594. Maybe you need a rebase?

running yarn on master for me does not change the lockfile either

@cpojer
Copy link
Member

cpojer commented Feb 22, 2018

Nice!

const CIRCUS_RUN_PATH = path.resolve(__dirname, '../../build/run');
const CIRCUS_STATE_PATH = path.resolve(__dirname, '../../build/state');
const TEST_EVENT_HANDLER_PATH = path.resolve(__dirname, './test_event_handler');
const BABEL_REGISTER_PATH = path.resolve(
Copy link
Member

Choose a reason for hiding this comment

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

can you use require.resolve or require.main.resolve here?

@aaronabramov aaronabramov force-pushed the circus-1 branch 3 times, most recently from ee8bc8c to cc8d701 Compare February 27, 2018 01:46
@aaronabramov
Copy link
Contributor Author

replaced path.resolve with require.resolve and fixed the lock file. seems like a had an ancient version of yarn that updated all packages an yarn add

@aaronabramov aaronabramov force-pushed the circus-1 branch 2 times, most recently from a5f6621 to 20093b0 Compare February 27, 2018 02:41
@aaronabramov
Copy link
Contributor Author

i'm going to skip this test suite on windows, because it seems like it has a problem with resolving some paths. This test utils should not be platform specific anyway

screen shot 2018-02-26 at 6 37 37 pm

@aaronabramov
Copy link
Contributor Author

it might also be just a cache that i can't reset :/
screen shot 2018-02-26 at 6 42 52 pm

@codecov-io
Copy link

Codecov Report

Merging #5636 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5636   +/-   ##
=======================================
  Coverage   63.16%   63.16%           
=======================================
  Files         216      216           
  Lines        7913     7913           
  Branches        3        4    +1     
=======================================
  Hits         4998     4998           
  Misses       2914     2914           
  Partials        1        1

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 e12cab6...4859724. Read the comment docs.

add_hook: beforeEach
add_test: one
add_test: two
start_describe_definition: 2nd level describe
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test would be even better if it had the depth represented with indents. Would you mind adding that?

@cpojer cpojer merged commit 158a76f into jestjs:master Feb 27, 2018
@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.

6 participants