Skip to content
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

Module name collides with k6/execution #10

Closed
sarasensible opened this issue Jan 23, 2023 · 2 comments
Closed

Module name collides with k6/execution #10

sarasensible opened this issue Jan 23, 2023 · 2 comments

Comments

@sarasensible
Copy link

The name of this module collides with exec from k6/execution.

Attempted workaround (does not work)

import exec from 'k6/execution';
import { exec as execer } from 'k6/x/exec';
console.log(execer.command("pwd"))

Results in

TypeError: Cannot read property 'command' of undefined or null
@mstoykov
Copy link
Contributor

Hi @sarasensible,

There is no collision - both export are a default ones and you can do a default import and when doing that you can name them w/e.

import exec from 'k6/execution'andimport something from 'k6/execution'will just bind the same thing toexecorsomething`. In both cases the module has no way of knowing or caring how the default export it provided is imported.

So in your case you can do import execer from 'k6/x/exec' or if you want you can also do import { default as execer } from 'k6/x/exec'.

If you only need the command import { command } from 'k6/x/exec' and then use it directly as command instead of execer.command.

I will be closing this issue, but if you have more question you might try the community forum

@sarasensible
Copy link
Author

Yes both options you gave work for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants