@@ -5,21 +5,35 @@ import RunInside from '../../../../src/commands/run/inside.js'
55import runCommand from '../../../helpers/runCommand.js'
66
77describe ( 'run:inside' , function ( ) {
8+ const originalProcessArgv = [ ...process . argv ]
9+
10+ const runWithCliArgv = async ( args : string [ ] ) => {
11+ process . argv = [
12+ '/usr/local/bin/node' ,
13+ '/usr/local/bin/heroku' ,
14+ 'run:inside' ,
15+ ...args ,
16+ ]
17+
18+ return runCommand ( RunInside , args )
19+ }
20+
821 beforeEach ( function ( ) {
922 nock . cleanAll ( )
1023 nock . disableNetConnect ( )
1124 } )
1225
1326 afterEach ( function ( ) {
1427 nock . enableNetConnect ( )
28+ process . argv = [ ...originalProcessArgv ]
1529 } )
1630
1731 it ( 'requires a dyno name and command' , async function ( ) {
1832 nock ( 'https://api.heroku.com' )
1933 . get ( '/apps/myapp' )
2034 . reply ( 200 , { name : 'myapp' , stack : { name : 'heroku-20' } } )
2135
22- await runCommand ( RunInside , [
36+ await runWithCliArgv ( [
2337 '--app' ,
2438 'myapp' ,
2539 ] ) . catch ( error => {
@@ -48,7 +62,7 @@ describe('run:inside', function () {
4862 updated_at : '2020-01-01T00:00:00Z' ,
4963 } )
5064
51- await runCommand ( RunInside , [
65+ await runWithCliArgv ( [
5266 'web.1' ,
5367 'bash' ,
5468 '--app' ,
@@ -75,7 +89,7 @@ describe('run:inside', function () {
7589 updated_at : '2020-01-01T00:00:00Z' ,
7690 } )
7791
78- await runCommand ( RunInside , [
92+ await runWithCliArgv ( [
7993 'web.1' ,
8094 'false' ,
8195 '--app' ,
@@ -107,7 +121,7 @@ describe('run:inside', function () {
107121 updated_at : '2020-01-01T00:00:00Z' ,
108122 } )
109123
110- await runCommand ( RunInside , [
124+ await runWithCliArgv ( [
111125 'web.1' ,
112126 'bash' ,
113127 '--app' ,
@@ -138,7 +152,7 @@ describe('run:inside', function () {
138152 updated_at : '2020-01-01T00:00:00Z' ,
139153 } )
140154
141- await runCommand ( RunInside , [
155+ await runWithCliArgv ( [
142156 'web.1' ,
143157 'bash' ,
144158 '--app' ,
0 commit comments