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

feat(testlib): add enable/disable test debug utils #1315

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

LNSD
Copy link
Contributor

@LNSD LNSD commented Oct 28, 2022

Following Javascript's Jest idea of disabling a test by adding an 'x' before/after the test keyword (see Jest docs):

When you are maintaining a large codebase, you may sometimes find a test that is temporarily broken for some reason. If you want to skip running this test, but you don't want to delete this code, you can use test.skip to specify some tests to skip.

So in our case this is how to use the new test debug utils:

  1. Import the ./testlib/testutils module in your test suite file
  2. Add a 'x' either before or after the test case/suite keyword: xtest, xasyncTest, xsuite, xprocSuite, etc.
  3. Run the test suite. The tests you marked with an ✖️ won't be executed.

IMPORTANT: Do not forget to re-enable the test cases disabled during your debugging session before committing your changes.

@LNSD LNSD self-assigned this Oct 28, 2022
Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Yes, great feature, thanks! Shall we add this in a README.md somewhere? (And perhaps the coding guide?)

@LNSD
Copy link
Contributor Author

LNSD commented Oct 28, 2022

Yes, great feature, thanks! Shall we add this in a README.md somewhere? (And perhaps the coding guide?)

Agree. We need to document it with all the test development good practices I have been gathering. I add it to my documentation TO-DO list. I'll try to tackle it next week 😁

@status-im-auto
Copy link
Collaborator

status-im-auto commented Oct 28, 2022

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ dd001d3 #1 2022-10-28 12:47:30 ~17 min linux 📦bin
dd001d3 #1 2022-10-28 12:49:38 ~19 min macos 📄log

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

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

Great! +1 to documenting it.

Fun fact I just learned that nim allows for comments inside comments, which C does't. Helpful for commenting the tests also.

#[


let x = 3
# comments
echo x
#[
long comment
]#


#[

Slightly related. Is someone looking into running specific tests or testsuites?

@LNSD
Copy link
Contributor Author

LNSD commented Oct 28, 2022

Slightly related. Is someone looking into running specific tests or testsuites?

From our documentation: https://github.com/status-im/nwaku/blob/16c85db43ca492fb762e6acf61888e16812f883a/waku/v1/README.md#L51:~:text=You%20can%20also%20run%20a%20specific%20test%20(and%20alter%20compile%20options%20as%20you%20want)%3A`

You can also run a specific test (and alter compile options as you want):

@LNSD
Copy link
Contributor Author

LNSD commented Oct 28, 2022

Merging this without waiting for checks to pass since the module is not imported, there is no risk.

@LNSD LNSD merged commit 979f1d3 into master Oct 28, 2022
@LNSD LNSD deleted the feat-testlib-testutils branch October 28, 2022 13:04
@alrevuelta
Copy link
Contributor

@LNSD #1302?

@jm-clius
Copy link
Contributor

@alrevuelta 🤣 go ahead and merge #1302 by bypassing the checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants