Skip to content

chore: save compiled output for test suites #4251

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

Conversation

tanhauhau
Copy link
Member

@tanhauhau tanhauhau commented Jan 11, 2020

Unifying the test helper to save the compiled output for:

  • ssr
  • runtime
  • hydration

use the register.extension to also save the compiled output to filesystem.


Updated 2022-10-14

  • the output will only be saved when the test fails.
    • when compiling with register.extension in the test, we will record the compiled output in a cache
    • only write cache into the file when the test fails
    • will clear the cache for each test

@Conduitry
Copy link
Member

It'd be nice not to have another flag. Could we just generate them unless process.env.CI is set, or do they take long enough that we wouldn't want to generate them every time when running tests locally? What if we just generated them for failing tests?

@tanhauhau
Copy link
Member Author

Good suggestion for just generate it for failing test.
Probably this can replace the existing console out of the compiled code when fail

@tanhauhau
Copy link
Member Author

Right now it is compiled twice if we save the output to file. Wonder is it okay if I save to file during the require.extension?

@Conduitry
Copy link
Member

The require hook wouldn't know whether the test failed, would it?

I think removing the existing console.log of the compiled code for failing tests makes sense.

@tanhauhau
Copy link
Member Author

Yea it wouldn't know

@tanhauhau
Copy link
Member Author

The reason I added a flag, is that without the flag, it would compile the code twice, once for require extensions, once for saving to file, and probably thrice when console out for failing case

@tanhauhau tanhauhau force-pushed the tanhauhau/test-save-compiled-output branch from f3cc6b5 to 6141b2b Compare January 12, 2020 07:16
@Conduitry Conduitry marked this pull request as draft June 8, 2020 12:50
@stale
Copy link

stale bot commented Jun 26, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 27, 2021
@tanhauhau tanhauhau force-pushed the tanhauhau/test-save-compiled-output branch from 6141b2b to ac9e977 Compare October 14, 2022 07:08
@tanhauhau tanhauhau marked this pull request as ready for review October 14, 2022 14:15
@tanhauhau tanhauhau force-pushed the tanhauhau/test-save-compiled-output branch from cab6c6b to b29dcab Compare October 16, 2022 14:16
@tanhauhau tanhauhau changed the title feat save compiled output for test suites [feat] save compiled output for test suites Oct 16, 2022
@dummdidumm
Copy link
Member

With the idea of having ESM only for Svelte 4, I'm wondering how much long-livety this change this has. But all checks pass and changes seem to look good to me, so maybe it doesn't hurt. Will wait for other maintainers to chime before deciding.

@dummdidumm dummdidumm added this to the 3.x milestone Feb 22, 2023
return name[0].toUpperCase() + name.slice(1);
}

export function setCompileOptions(_compileOptions: CompileOptions) {
Copy link
Member

Choose a reason for hiding this comment

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

should these methods be named with the underscore convention like set_compile_options?

@benmccann benmccann changed the title [feat] save compiled output for test suites chore: save compiled output for test suites Apr 19, 2023
@dummdidumm dummdidumm modified the milestones: 3.x, 4.x, one day Apr 28, 2023
@Rich-Harris
Copy link
Member

Closing, as compiled output is saved to disk on the main branch

@Rich-Harris Rich-Harris closed this Apr 1, 2024
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.

6 participants