-
Notifications
You must be signed in to change notification settings - Fork 16
Add wasm level integration tests to function templates #334
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
ba81395 to
3b6dea4
Compare
saga-dasgupta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't tophat all the fixtures but if they were copied from #321 then they should all work because I had tophatted those.
The default.test and package.json looks good.
saga-dasgupta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should pass the entire fixture to runFunction, then if we need more components from the fixture in future to run a function, we dont have to change method signatures.
dfa9683 to
db32d7f
Compare
| "test": "vitest run" | ||
| }, | ||
| "devDependencies": { | ||
| "@shopify/shopify-function-test-helpers": "~0.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this version be something like 1.0.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be, once the package is released at 1.0.0.
For now, the package is 0.0.2, and in order to get the extension generating command and follow up test commands running smoothly, I need to target these pre-release versions. So for tophatting at the moment, this is correct.
I will leave this comment open as a reminder that this needs to be flipped over to 1.0.0 once we fully release.
2837550 to
010f643
Compare
76faa7a to
0c1a210
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the second discount target fixture and addressing all the comments, I tophatted this for both discount-js and discount-rs and sometimes the setup step for build and info commands times out for the rust function so we might wanna increase that timeout.
baa420c to
a8f02b1
Compare
a8f02b1 to
fb52ce1
Compare
saga-dasgupta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we talk about also deleting the existing unit tests? https://shopify.slack.com/archives/C0993FRHZKN/p1758555315819259?thread_ts=1758554474.911029&cid=C0993FRHZKN
| run: yarn js-typegen | ||
| - name: Test | ||
| run: yarn js-test | ||
| run: yarn js-test:unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not familiar with this command why did this have to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc this was so that CI wouldn't run the integration tests.
I dont recall what the exact errors were, but I think it had something to do with installing/using the CLI
I'll try flipping this back and seeing what comes back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, since this repo doesn't depend on the CLI (and function-runner), we can't really use the shopify commands to run the integration tests.
https://github.com/Shopify/extensions-templates/actions/runs/19898271656/job/57034488324
8199e8b to
a99d8df
Compare
|
Chatted on slack. We'll keep this PR as-is, focused on adding the new tests. |
Background
An updated version of #321
Fixes https://github.com/shop/issues-shopifyvm/issues/552 and https://github.com/shop/issues-shopifyvm/issues/550
Solution
Adds testing files to function templates in order to enable wasm-module testing out of the box.
Tophat
You can run these changes with the following setup:
infocommand.Confirm that the newly generated function has the
testsdirectory, containing a default test, and a basicfixtures/log.json.If you made a rust function, you'll need to
npm installin the root of your app so that the devDepencies from the package.json get installed. This should happen automatically for JS functions.You should just be able to run
npx vitest runfrom the root of your app, ornpm testfrom your function's directory.Checklist