diff --git a/fixtures/react_native_with_haul_0_60x_ts/haul.config.js b/fixtures/react_native_with_haul_0_60x_ts/haul.config.js index 4be04145..8f4f5035 100644 --- a/fixtures/react_native_with_haul_0_60x_ts/haul.config.js +++ b/fixtures/react_native_with_haul_0_60x_ts/haul.config.js @@ -1,6 +1,9 @@ import { withPolyfills, makeConfig } from "../../packages/haul-preset-0.60"; export default makeConfig({ + server: { + port: 8000 + }, bundles: { index: { entry: withPolyfills('./index'), diff --git a/integration_tests/react_native_0_60x_ts/__tests__/start.test.ts b/integration_tests/react_native_0_60x_ts/__tests__/start.test.ts index 7c75a56b..69088de3 100644 --- a/integration_tests/react_native_0_60x_ts/__tests__/start.test.ts +++ b/integration_tests/react_native_0_60x_ts/__tests__/start.test.ts @@ -11,7 +11,8 @@ describe('packager server', () => { let instance: Instance; beforeAll(done => { - instance = startServer(8081, TEST_PROJECT_DIR, done); + // server port is set in haul.config.js fort this project + instance = startServer(undefined, TEST_PROJECT_DIR, done); }); afterAll(() => { @@ -27,7 +28,7 @@ describe('packager server', () => { }); async function testPlatform(platform: string) { - const res = await fetch(`http://localhost:8081/index.${platform}.bundle`); + const res = await fetch(`http://localhost:8000/index.${platform}.bundle`); const bundle = await res.text(); expect(bundle).toMatch('__webpack_require__'); } diff --git a/integration_tests/utils/server.ts b/integration_tests/utils/server.ts index 54b813db..461b433e 100644 --- a/integration_tests/utils/server.ts +++ b/integration_tests/utils/server.ts @@ -15,7 +15,7 @@ export type Instance = { }; export function startServer( - port: number, + port: number | undefined, projectDir: string, done: jest.DoneCallback ) { @@ -23,8 +23,7 @@ export function startServer( const server = runHaul(projectDir, [ 'start', - '--port', - port.toString(), + ...(port ? ['--port', port.toString()] : []), ]) as Instance['server']; const instance: Instance = { server, diff --git a/packages/haul-cli/src/commands/start.ts b/packages/haul-cli/src/commands/start.ts index 3cab34ec..ead8e2bc 100644 --- a/packages/haul-cli/src/commands/start.ts +++ b/packages/haul-cli/src/commands/start.ts @@ -1,6 +1,5 @@ import yargs from 'yargs'; import { - DEFAULT_PORT, DEFAULT_CONFIG_FILENAME, INTERACTIVE_MODE_DEFAULT, getProjectConfigPath, @@ -22,7 +21,6 @@ export default function startCommand(runtime: Runtime) { builder: { port: { description: 'Port to run your webpack server', - default: DEFAULT_PORT, type: 'number', }, dev: { @@ -58,7 +56,7 @@ export default function startCommand(runtime: Runtime) { }, async handler( argv: yargs.Arguments<{ - port: number; + port?: number; dev: boolean; interactive?: boolean; minify?: boolean;