add chained tests
For https://github.com/anti-work/shortest/issues/123, I thought of adding chained tests just like a testA inside testB to let testA depends on testB, but with this approach testA cannot depend on another testC unless testC is between testA and testB. As a solution we can let the tests seperated but it can depend on multiple tests no matter the position.
Please let me know your thoughts and feedback.
@crabest is attempting to deploy a commit to the Antiwork Team on Vercel.
A member of the Team first needs to authorize it.
for less confusion, I named it afterTest() that can accept more than one shortest variables
I prefer "after", as it's... shorter!
I said for less confusion because we have after() method for shortest for callback functions
what do you think
Hm where's that coming from, if it's not being imported. But good point, I'll think on it
Could we overload it? So you could use both?
we can use both, the "less confusion" just for us humans
Let's go with after. I think the simple language is critical for adoption.
renamed to "after", now it should be good!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| shortest | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Dec 30, 2024 8:32pm |
ideas from internal discussion:
const login = shortest('user can login with email and password')
shortest(login).shortest('user can modify their account-level refund policy from the default of 30-days to no refunds allowed')
const loginAsLawyer = shortest('...')
const loginAsContractor = shortest('...')
const allAppActions = [shortest('send invoice to company'), shortest('view invoices')];
shortest(loginAsLawyer.allAppActions)
shortest(loginAsContractor.allAppActions)
This would make it even shorter.
let me in those discussions (: for the array part, this would be shorter and more readable.
const allAppActions = shortest(['send invoice to company', 'view invoices'])
agreed! sorry, just a daily catchup call we do for our products; I do want to move them to being public! next week! 10am EST Friday
10am EST Friday, sadly I would still be at work. for those changes, let's iterate in the same pull request? what do you think
yep sounds good!
with those changes, I think let's drop that after()
using your example, this is how it will look like now:
const login = 'user can login with email and password'
shortest([login, 'user can modify their account-level refund policy from the default of 30-days to no refunds allowed'])
const loginAsLawyer = '...'
const loginAsContractor = '...'
const allAppActions = ['send invoice to company', 'view invoices'];
shortest([loginAsLawyer, ...allAppActions])
shortest([loginAsContractor, ...allAppActions])
Neato! @rmarescu @m2rads et al, happy w/ that?
my vision is to be like that:
const login = shortest('user can login with email and password')
shortest(login).shortest('user can modify their account-level refund policy from the default of 30-days to no refunds allowed')
const loginAsLawyer = shortest('...')
const loginAsContractor = shortest('...')
const allAppActions = ['send invoice to company', 'view invoices']
shortest(loginAsLawyer).shortest(allAppActions)
shortest(loginAsContractor).shortest(allAppActions)
let me know what do you think
I like the shorter one, without the many "shortest"s personally. I was convinced! I can send you the recording of the call if you wish
i would love to, how
DM me on X or email me [email protected] and will send!
DMed on X
Seems like your new changes are not resolving properly.
Here's how you can fix it:
When making changes to src/index.ts you'd need to update index.d.ts as well.
We have been dealing with some issues when generating index.d.ts when bundling the package so we implement it manually. Please make sure your new changes are reflected in that file as well.
Here's why this issue happens:
src/index.ts is our source file that contains the actual implementation and gets compiled to JavaScript.
index.d.ts is our declaration file that only contains type definitions and Is used by TypeScript for type checking. It also defines the public API types for consumers.
We need both because the compiled JavaScript (dist/index.js) doesn't contain type information and external users of our package need type definitions for TypeScript support.
I created a new issue: https://github.com/anti-work/shortest/issues/205 to fix it. Please let me know if you have any questions regarding this part.
Would be good to have a demo using this new feature when you have finished your implementation.
const login = 'user can login with email and password' shortest([login, 'user can modify their account-level refund policy from the default of 30-days to no refunds allowed']) const loginAsLawyer = '...' const loginAsContractor = '...' const allAppActions = ['send invoice to company', 'view invoices']; shortest([loginAsLawyer, ...allAppActions]) shortest([loginAsContractor, ...allAppActions])
the example you used is not implemented, only the example above ^
Looks good to me. Would be nice to write some new tests using the new chained tests.
To prepare for release please update your branch and bump the version to 0.3.1. I think this version is appropriate as this PR is a major feature. Also please update changelogs to add your changes.
0.3.0 imo
Can we export a test and use it in another test file?