-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
[REQUIRED] Environment info
firebase-tools: 15.6.0
Platform: macOS
[REQUIRED] Test case
import firebaseTools from 'firebase-tools';
const PROJECT = 'test';
console.log('1st call...');
try { await firebaseTools.use(PROJECT); } catch (e) { console.error('1st:', e.message); }
console.log('2nd call...');
try { await firebaseTools.use(PROJECT); } catch (e) { console.error('2nd:', e.message); }
console.log('3rd call...');
try { await firebaseTools.use(PROJECT); } catch (e) { console.error('3rd:', e.message); }[REQUIRED] Steps to reproduce
Just run the provided code.
[REQUIRED] Expected behavior
Should not throw.
[REQUIRED] Actual behavior
Throws with Cannot read properties of undefined (reading 'indexOf').
For the issue you can point to lib/command.js args.shift() destructively mutates the option arrays on each register() call.
Fix proposal: use destructuring ([flags, ...args]) instead. Example:
this.options.forEach(([flags, ...args]) => {
cmd.option(flags, ...args);
});Reactions are currently unavailable