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

Allow import of layout_test into 3rd party crates #3463

Merged
merged 7 commits into from
Oct 14, 2024

Conversation

rollo-b2c2
Copy link
Contributor

@rollo-b2c2 rollo-b2c2 commented Oct 13, 2023

Description

This allows you to import layout_test into your crates as described in the docs. As you can't import things behind #[cfg(test)].

https://yew.rs/docs/more/testing

I think this was the intent of this PR

#2310

Should have no impact on the behavior of existing builds as you have to add yew/test to your build.

Fixes #3329

Checklist

  • I have reviewed my own code
  • I have added tests

Currently I can't import tests because `cfg(test)` isn't sent to sub-dependencies.   This allows you to set a `yew/test` and import into your own tests.
@github-actions
Copy link

github-actions bot commented Oct 13, 2023

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 102.800 102.800 0 0.000%
boids 175.729 175.729 0 0.000%
communication_child_to_parent 95.273 95.273 0 0.000%
communication_grandchild_with_grandparent 109.013 109.013 0 0.000%
communication_grandparent_to_grandchild 105.675 105.675 0 0.000%
communication_parent_to_child 92.751 92.751 0 0.000%
contexts 113.392 113.392 0 0.000%
counter 89.155 89.155 0 0.000%
counter_functional 89.892 89.892 0 0.000%
dyn_create_destroy_apps 92.327 92.327 0 0.000%
file_upload 103.484 103.484 0 0.000%
function_memory_game 174.717 174.717 0 0.000%
function_router 352.578 352.578 0 0.000%
function_todomvc 163.478 163.478 0 0.000%
futures 227.812 227.812 0 0.000%
game_of_life 112.235 112.235 0 0.000%
immutable 188.923 188.923 0 0.000%
inner_html 85.940 85.940 0 0.000%
js_callback 113.412 113.412 0 0.000%
keyed_list 201.050 201.050 0 0.000%
mount_point 89.146 89.146 0 0.000%
nested_list 115.820 115.820 0 0.000%
node_refs 96.251 96.251 0 0.000%
password_strength 1721.057 1721.057 0 0.000%
portals 98.349 98.349 0 0.000%
router 318.554 318.554 0 0.000%
simple_ssr 144.036 144.036 0 0.000%
ssr_router 390.321 390.321 0 0.000%
suspense 119.004 119.004 0 0.000%
timer 91.755 91.755 0 0.000%
timer_functional 100.466 100.466 0 0.000%
todomvc 143.765 143.765 0 0.000%
two_apps 89.857 89.857 0 0.000%
web_worker_fib 138.845 138.845 0 0.000%
web_worker_prime 190.343 190.343 0 0.000%
webgl 88.461 88.461 0 0.000%

✅ None of the examples has changed their size significantly.

@github-actions
Copy link

Visit the preview URL for this PR (updated for commit 5634c02):

https://yew-rs-api--pr3463-patch-1-rmiwbw8k.web.app

(expires Fri, 20 Oct 2023 11:14:27 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link

github-actions bot commented Oct 13, 2023

Benchmark - SSR

Yew Master

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 377.651 377.816 377.745 0.057
Hello World 10 641.761 650.948 645.133 2.427
Function Router 10 2131.403 2160.264 2149.425 7.917
Concurrent Task 10 1006.275 1008.135 1007.158 0.523
Many Providers 10 1535.088 1677.202 1562.241 43.074

Pull Request

Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 377.702 378.085 377.813 0.111
Hello World 10 645.637 649.784 647.344 1.316
Function Router 10 2183.205 2241.010 2210.687 15.868
Concurrent Task 10 1006.115 1008.126 1007.473 0.673
Many Providers 10 1566.677 1713.970 1589.725 44.731

Copy link
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! It can be merged once CI is green

@aDogCalledSpot
Copy link

Can we have an update on this?

ranile
ranile previously approved these changes Oct 12, 2024
@ranile
Copy link
Member

ranile commented Oct 14, 2024

test may not be the best name for the feature but I also don't have a better name and it's always possible to rename it (still 0.x release)

@ranile ranile merged commit 4025fa7 into yewstack:master Oct 14, 2024
20 checks passed
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.

Unable to use yew::tests because it is #cfg(test)
3 participants