-
-
Notifications
You must be signed in to change notification settings - Fork 670
Update asinit #982
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
Update asinit #982
Conversation
Not sure about this naive tests. What about just add stub command like {
"test": "echo \"visit https://docs.assemblyscript.org/community/built-with-assemblyscript#testing\""
} ? |
My thinking is that it's just four lines of code and does the job. Can ofc include a comment inside of that file for anyone interested in more elaborate testing :) |
This tests will be unnecessary for general (complex) testings and users will install jest/ava or as-pest anyway. But first they are need to remove "default" test files |
Of course that's super simple, but that's the point of scaffolding to me. My expectation is that someone will look at the file, see how simple it actually is, and either go with it if that's all they need (like, I would totally do that for simple modules) or replace it with whatever they fancy, learning something in the process. |
To add to that: I'd even go as far as not to endorse let's say jest over as-pect or vice-versa as different projects have different requirements. Like, ideally someone would start with their very own piece of testing code, getting used to the loader this way and only pick something else once it benefits them. As such I'd not even link somewhere that favors one solution over another. |
All this once again gives me a reminder that it would be nice to have the built-in in langusge testing capabilities like in Go, Rust or Kotlin |
You mean something like a |
Yes. Something like: export function add(a: i32, b: i32): i32 {
return a + b;
}
// this removed by DCE (in debug/release) but not during `npx asc --test`
@test
function testAdd1() {
assert.notEqual(add(1, 1), 0);
}
@test("should 1 + 2 == 3 ")
function testAdd3() {
assert.equal(add(1, 2), 3);
} |
The sarcastic jerk in me is screaming about undoing a years worth of my work. Sure. There's also a part of me that would wholeheartedly endorse a Jest worked really well for as2d because it requires specialized bootstrapping. Aspect works well for libraries written in nothing but assemblyscript.
|
Wouldn't say that such a mechanism replaces as-pect. If I understood this correctly it'd rather provide a common entry point one can opt to use, and there'll still be benefits in using a testing framework to actually implement tests. Goes out of scope of this PR, though, so suggesting to continue in a separate issue :) |
This PR updates
asinit
tofixes #919
fixes #977