Support arguments in "require" configuration #1666
novemberborn posted onGitHub
Prompted by #1665 and inspired by Babel's plugin / preset configuration, it'd be neat to do this:
"ava": {
"require": [
["@babel/register", {
"ignore": ["test/*"]
}]
]
}
If an array is provided we'd require the module, resolve any __esModules
/ default
shenanigans, and invoke .apply()
with the remaining values. We should support any number of arguments.
Hey @novemberborn, I'd like to take on this task!
@Jolo510 awesome, go for it!
Hey, @novemberborn, I'd like to work on this task
@amslv awesome, thanks!
Since this issue was opened, we added support for ava.config.js
files. We need to make sure the arguments can be stringified as JSON and then parsed in the worker processes.
We could do the stringifying and the parsing in the main process first, and then use our "deep equal" logic to make sure the values are the same: https://github.com/avajs/ava/blob/6d12abfdff4478a1b6f4e87237764b89eb05f18d/lib/assert.js#L282
@issuehunt has funded $40.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
@novemberborn
I don't understand your comment. are you proposing a way to solve this issue? if yes, can you explain in different way?
@amslv awesome, thanks!
Since this issue was opened, we added support for
ava.config.js
files. We need to make sure the arguments can be stringified as JSON and then parsed in the worker processes.We could do the stringifying and the parsing in the main process first, and then use our "deep equal" logic to make sure the values are the same:
https://github.com/avajs/ava/blob/6d12abfdff4478a1b6f4e87237764b89eb05f18d/lib/assert.js#L282
I did some research and it seems that i must create a temp-js-file that will contain the call to @babel/register
with all it's options and add it to the ava.require
section.
do you think my idea is ok?
@stavalfi I'm not sure what your question is. Could you rephrase it?
@novemberborn Is anyone working on this issue? Can I give it a try?
@niteshsarode please do!
@novemberborn I would like to give this a try if no-one's working on it
@OmLakshmi yes, that'd be great, thanks.
@niteshsarode please do let us know if you are about to submit a pull request 😄
Hi @novemberborn I would like to give it a try. Will let u know If I am able to solve this issue.
Thanks
@amslv awesome, thanks!
Since this issue was opened, we added support for
ava.config.js
files. We need to make sure the arguments can be stringified as JSON and then parsed in the worker processes.We could do the stringifying and the parsing in the main process first, and then use our "deep equal" logic to make sure the values are the same:
https://github.com/avajs/ava/blob/6d12abfdff4478a1b6f4e87237764b89eb05f18d/lib/assert.js#L282
I would like to ask you about this comment. As in this Comment You stated about the main process One need to compare the JSON(arguments) and then use the deepEqual from assert.js (Correct me If I am wrong). As I am new to this repo Can You let me know where exactly the main process
code block is there. I tried to trace it from index,js --> worker/main.js --> and then it goes on to chain () call ...
I am new to openSource community.
So Is their any documentation resource (You can point out if available) to understand the specifically workflow of the AVA testing framework
which can be used here ?
The main process is what loads the configuration. Essentially we can add a validation step before this return: https://github.com/avajs/ava/blob/b71f396df7b9d74ef24262b6840df1593cad3798/lib/load-config.js#L163
You wouldn't use assert.js
itself. Load Concordance instead and use the compare()
function. I don't think you'd need to pass any options.
Hi, @novemberborn
Can I work on this issue? I would like to give it a try.
Thanks
@yliu481 of course, thanks!
@novemberborn Before starting, I want to make sure we are on the same pages, so I checked 06-configuration.md and understand that ava can load configuration from either package.json or an ava.config.* file.
I checked the load-config.js, these codes will load the ava.config.* https://github.com/avajs/ava/blob/32c5425353cc58422f0a196bb0c06a4095a33825/lib/load-config.js#L204-L206
And in the https://github.com/avajs/ava/blob/32c5425353cc58422f0a196bb0c06a4095a33825/lib/load-config.js#L45 usually, this will call evaluateJsConfig and run ava.config.js https://github.com/avajs/ava/blob/32c5425353cc58422f0a196bb0c06a4095a33825/lib/load-config.js#L20-L21
This is how to load ava.config.js right now.
Could you please tell me if I am right?
Also, it is the evaluateJsConfig function that I need to improve, am I right?
No, you need to change how the require
array is processed here:
The array could contain just a ref
string, or another array [ref, ...args]
. In that case, after loading the module, we'd invoked the result with those arguments (mod(...args)
).
Hi @novemberborn, I would like to give this issue a try. Thanks
Go for it @abhnvgupta.
hi @novemberborn, if no one is working on shall I try
@novemberborn please de-assign me, I'm not able to find the time. Sorry about that
@abhnvgupta thanks for letting us know @abhnvgupta, better luck next time! 😄
is it still possible to work on this?
@thyrhone all yours.
Hey @novemberborn , I assume this issue is free to take now? Could you tell me if there is anything special here - since there is a lot of people resign from doing this?
Idk but someone is framing me, took my password and profile for like 20 years or more
On Sat, Feb 25, 2023 at 11:52 AM Bartłomiej Kalemba < @.***> wrote:
Hey @novemberborn https://github.com/novemberborn , I assume this issue is free to take now? Could you tell me if there is anything special here - since there is a lot of people resign of doing this?
— Reply to this email directly, view it on GitHub https://github.com/avajs/ava/issues/1666#issuecomment-1445191484, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52PLFPUUF7XKMSAXSIXC53WZJPJBANCNFSM4EN7DF5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
There’s someone on my profile it has all my information. It has my Gmail account and all my social media accounts and I’ll be trying to login but faster than me logging in.
On Sat, Feb 25, 2023 at 7:00 PM The Old Man 559 @.***> wrote:
Idk but someone is framing me, took my password and profile for like 20 years or more
On Sat, Feb 25, 2023 at 11:52 AM Bartłomiej Kalemba < @.***> wrote:
Hey @novemberborn https://github.com/novemberborn , I assume this issue is free to take now? Could you tell me if there is anything special here - since there is a lot of people resign of doing this?
— Reply to this email directly, view it on GitHub https://github.com/avajs/ava/issues/1666#issuecomment-1445191484, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52PLFPUUF7XKMSAXSIXC53WZJPJBANCNFSM4EN7DF5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I have the right back to you it’s not going to be mean here’s my personal number 559-356-1564
On Sat, Feb 25, 2023 at 7:00 PM The Old Man 559 @.***> wrote:
There’s someone on my profile it has all my information. It has my Gmail account and all my social media accounts and I’ll be trying to login but faster than me logging in.
On Sat, Feb 25, 2023 at 7:00 PM The Old Man 559 @.***> wrote:
Idk but someone is framing me, took my password and profile for like 20 years or more
On Sat, Feb 25, 2023 at 11:52 AM Bartłomiej Kalemba < @.***> wrote:
Hey @novemberborn https://github.com/novemberborn , I assume this issue is free to take now? Could you tell me if there is anything special here - since there is a lot of people resign of doing this?
— Reply to this email directly, view it on GitHub https://github.com/avajs/ava/issues/1666#issuecomment-1445191484, or unsubscribe https://github.com/notifications/unsubscribe-auth/A52PLFPUUF7XKMSAXSIXC53WZJPJBANCNFSM4EN7DF5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@sculpt0r yep. No I don't think there's anything special about it.
So @novemberborn - could you assign me to to this ticket?
@sculpt0r just start the work, I doubt anybody will jump in before you.
@novemberborn could you assign me to this ticket
Can i try this task?
This will land in #3184.
Hi is this issue still open
No, this will land in #3184.