-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process:
argv1
property to preserve original argv[1]
- Loading branch information
1 parent
3838b57
commit d9cf132
Showing
7 changed files
with
115 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
console.log(process.argv1); | ||
console.log(process.argv[1]); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { spawnPromisified } from '../common/index.mjs'; | ||
import * as fixtures from '../common/fixtures.mjs'; | ||
import { strictEqual } from 'node:assert'; | ||
import { describe, it } from 'node:test'; | ||
import { dirname } from 'node:path'; | ||
|
||
describe('process.argv1', { concurrency: true }, () => { | ||
it('should be the string for the entry point before the entry was resolved into an absolute path', async () => { | ||
const fixtureAbsolutePath = fixtures.path('process-argv1.js'); | ||
const fixtureRelativePath = './process-argv1.js'; | ||
const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [fixtureRelativePath], { | ||
cwd: dirname(fixtureAbsolutePath), | ||
}); | ||
|
||
strictEqual(stderr, ''); | ||
strictEqual(stdout, `${fixtureRelativePath}\n${fixtureAbsolutePath}\n`); | ||
strictEqual(code, 0); | ||
strictEqual(signal, null); | ||
}); | ||
}); |