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

loadScript in the Node executor shouldn't always use path.resolve #788

Closed
jason0x43 opened this issue Aug 31, 2017 · 1 comment
Closed
Assignees
Milestone

Comments

@jason0x43
Copy link
Member

In Node#loadScript, modules are loaded with require(path.resolve(script)). This allows script paths in the intern config to be relative to the project root. However, it breaks resolution for normal Node modules (e.g., if script were something in node_modules). Intern should handle this situation, as well. The naive solution would be to just do something like:

try {
    require(path.resolve(script));
} catch (error) {
    require(script);
}
@jason0x43 jason0x43 added this to the Intern 4.0 milestone Aug 31, 2017
@jason0x43
Copy link
Member Author

jason0x43 commented Aug 31, 2017

Intern may also need to take the path of the intern.json file itself into account. This could allow it to load modules relative to the config, which would be relevant if the config were itself contained in a node module that had a nested node_modules directory.

project
    node_modules/
        tester/
            intern.json        <--- requires 'test-extras'
            node_modules/
                test-extras/

@jason0x43 jason0x43 self-assigned this Sep 12, 2017
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

1 participant