Skip to content

Commit

Permalink
fix(twilio-run): turn off fork-process in inspect mode (#462)
Browse files Browse the repository at this point in the history
* fix(twilio-run): turn off fork-process in inspect mode

* Update start.test.ts

---------

Co-authored-by: makserik <15821542+makserik@users.noreply.github.com>
Co-authored-by: Victor Ayogu <vayogu@twilio.com>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent 34de081 commit 3868a78
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/warm-moles-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'twilio-run': patch
'@twilio-labs/plugin-serverless': patch
---

Fix of debug/inspect mode by disabling fork process
14 changes: 14 additions & 0 deletions packages/twilio-run/__tests__/config/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,18 @@ describe('getConfigFromCli', () => {
expect(startConfig.baseDir).toEqual(path.resolve(config.cwd));
}
});

test('turns off fork process if inspect is enabled', async () => {
require('../../src/config/utils/package-json').__setPackageJson({});
const config = {
dir: './other_dir',
inspect: '',
} as unknown as StartCliFlags;
if (config.dir) {
const startConfig = await getConfigFromCli(config);
expect(startConfig.baseDir).toEqual(path.resolve(config.dir));
expect(startConfig.forkProcess).toEqual(false);
expect(startConfig.inspect).not.toEqual(undefined);
}
});
});
6 changes: 6 additions & 0 deletions packages/twilio-run/src/config/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ export async function getConfigFromCli(
config.assetsFolderName = cli.assetsFolder;
config.functionsFolderName = cli.functionsFolder;
config.forkProcess = cli.forkProcess;

if (typeof config.inspect !== 'undefined') {
debug('Disabling fork-process in inspect mode.');
config.forkProcess = false;
}

config.pkgJson = pkgJson;

return config;
Expand Down

0 comments on commit 3868a78

Please sign in to comment.