-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make --require relative to where the command is run. #346
Changes from 2 commits
00a9f35
087756d
da0a040
45ed940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,9 +314,14 @@ test('test file in node_modules is ignored', function (t) { | |
test('Node.js-style --require CLI argument', function (t) { | ||
t.plan(1); | ||
|
||
var requirePath = path.relative(process.cwd(), path.join(__dirname, 'fixture', 'install-global.js')); | ||
// `path` will use \\ to seperate paths on windows, but require doesn't. | ||
requirePath = requirePath.split(path.sep).join('/'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't windows users be allowed to use Seems to me that
is the valid windows style alternative to
I would prefer it if AVA accepted either path separator and just normalized it internally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamestalmage: it's iffy, because node doesn't allow that (AFAIK), and 'require' doesn't allow that, so it would be a strange thing to do, but I'll add it if you really want. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sindresorhus: I'd say no, no you don't. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not suggesting we change the implementation. Just the line here in the test that normalizes the path to posix. We don't need to do that. And we want the test to fail if it doesn't allow windows users to use it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamestalmage Oh, ok. I misunderstood. Agree with that. @ariporad Can you update? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamestalmage, @sindresorhus: Ok, I removed that line. |
||
requirePath = './' + requirePath; | ||
|
||
var api = new Api( | ||
[path.join(__dirname, 'fixture/validate-installed-global.js')], | ||
{require: [path.join(__dirname, 'fixture', 'install-global.js')]} | ||
{require: [requirePath]} | ||
); | ||
|
||
api.run() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this above
fork
.