Copilot commented on code in PR #441:
URL: https://github.com/apache/arrow-js/pull/441#discussion_r3359604170
##########
gulp/argv.js:
##########
@@ -15,18 +15,32 @@
// specific language governing permissions and limitations
// under the License.
-import args from 'command-line-args';
-export const argv = args([
- { name: `all`, type: Boolean },
- { name: 'verbose', alias: `v`, type: Boolean },
- { name: `target`, type: String, defaultValue: `` },
- { name: `module`, type: String, defaultValue: `` },
- { name: `coverage`, type: Boolean, defaultValue: false },
- { name: `tests`, type: String, multiple: true, defaultValue:
[`test/unit/`] },
- { name: `targets`, alias: `t`, type: String, multiple: true, defaultValue:
[] },
- { name: `modules`, alias: `m`, type: String, multiple: true, defaultValue:
[] },
-], { partial: true });
+import { parseArgs } from 'node:util';
+const { values, tokens } = parseArgs({
+ options: {
+ all: { type: 'boolean' },
+ verbose: { type: 'boolean', short: 'v' },
+ target: { type: 'string', default: '' },
+ module: { type: 'string', default: '' },
+ coverage: { type: 'boolean', default: false },
+ tests: { type: 'string', multiple: true, default: ['test/unit/'] },
+ targets: { type: 'string', short: 't', multiple: true, default: [] },
+ modules: { type: 'string', short: 'm', multiple: true, default: [] },
+ },
+ args: process.argv.slice(2),
+ strict: false,
+ allowPositionals: true,
+ tokens: true,
+});
+
+// Expose unknown/positional tokens under `_unknown` for compatibility with
+// the previous command-line-args partial mode used by gulp/test-task.js.
+values._unknown = tokens
+ .filter((t) => t.kind === 'positional')
+ .map((t) => t.value);
Review Comment:
`values._unknown` is documented here as preserving the previous
`command-line-args` `{ partial: true }` behavior for gulp/test-task.js, but the
current implementation only includes positional tokens. With
`node:util.parseArgs({ strict: false })`, unknown *options* (e.g.
`--runInBand`, `--testNamePattern foo`) become entries on `values` and will not
be forwarded via `_unknown`, so gulp/test-task.js will silently stop passing
through extra Jest flags.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]