avajs/ava

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!

posted by Jolo510 about 7 years ago

@Jolo510 awesome, go for it!

posted by novemberborn about 7 years ago

Hey, @novemberborn, I'd like to work on this task

posted by amslv over 6 years ago

@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

posted by novemberborn over 6 years ago

@issuehunt has funded $40.00 to this issue.


posted by IssueHuntBot almost 6 years ago

@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?

posted by stavalfi about 5 years ago

@stavalfi I'm not sure what your question is. Could you rephrase it?

posted by novemberborn about 5 years ago

@novemberborn Is anyone working on this issue? Can I give it a try?

posted by niteshsarode almost 5 years ago

@niteshsarode please do!

posted by novemberborn almost 5 years ago

@novemberborn I would like to give this a try if no-one's working on it

posted by OmLakshmi over 4 years ago

@OmLakshmi yes, that'd be great, thanks.

@niteshsarode please do let us know if you are about to submit a pull request 😄

posted by novemberborn over 4 years ago

Hi @novemberborn I would like to give it a try. Will let u know If I am able to solve this issue.

Thanks

posted by webobite over 4 years ago

@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 ?

posted by webobite over 4 years ago

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.

posted by novemberborn over 4 years ago

Hi, @novemberborn

Can I work on this issue? I would like to give it a try.

Thanks

posted by yliu481 about 4 years ago

@yliu481 of course, thanks!

posted by novemberborn about 4 years ago

@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?

posted by yliu481 about 4 years ago

No, you need to change how the require array is processed here:

https://github.com/avajs/ava/blob/32c5425353cc58422f0a196bb0c06a4095a33825/lib/worker/subprocess.js#L217-L218

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)).

posted by novemberborn about 4 years ago

Hi @novemberborn, I would like to give this issue a try. Thanks

posted by abhnvgupta over 3 years ago

Go for it @abhnvgupta.

posted by novemberborn over 3 years ago

hi @novemberborn, if no one is working on shall I try

posted by basker26 over 3 years ago

@novemberborn please de-assign me, I'm not able to find the time. Sorry about that

posted by abhnvgupta over 3 years ago

@abhnvgupta thanks for letting us know @abhnvgupta, better luck next time! 😄

posted by novemberborn over 3 years ago

is it still possible to work on this?

posted by thyrhone about 3 years ago

@thyrhone all yours.

posted by novemberborn about 3 years ago

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?

posted by sculpt0r about 2 years ago

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: @.***>

posted by Avelas1234 about 2 years ago

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: @.***>

posted by Avelas1234 about 2 years ago

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: @.***>

posted by Avelas1234 about 2 years ago

@sculpt0r yep. No I don't think there's anything special about it.

posted by novemberborn about 2 years ago

So @novemberborn - could you assign me to to this ticket?

posted by sculpt0r about 2 years ago

@sculpt0r just start the work, I doubt anybody will jump in before you.

posted by novemberborn about 2 years ago

@novemberborn could you assign me to this ticket

posted by 1shubhankar9 almost 2 years ago

Can i try this task?

posted by BT616 almost 2 years ago

This will land in #3184.

posted by novemberborn almost 2 years ago

Hi is this issue still open

posted by utkarsh-shrivastav77 almost 2 years ago

No, this will land in #3184.

posted by novemberborn almost 2 years ago

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

sculpt0r was rewarded by novemberborn for avajs/ava# 1666
almost 2 years ago
sculpt0r submitted an output to  avajs/ ava# 1666
about 2 years ago