forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed facebook#13445 - the Windows package launcher script can now pa…
…ss all arguments to the cli
- Loading branch information
Showing
5 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Remove the first two elements, we only want the arguments | ||
process.argv.splice(0, 2); | ||
|
||
// Print out the arguments to be used in the test | ||
console.log(process.argv.join(';;')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
:: Copyright (c) 2015-present, Facebook, Inc. | ||
:: All rights reserved. | ||
:: | ||
:: This source code is licensed under the BSD-style license found in the | ||
:: LICENSE file in the root directory of this source tree. An additional grant | ||
:: of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
@echo off | ||
title React Packager | ||
node "$THIS_DIR/launchPackagerCLIMock.js.mock" start %* | ||
pause | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2015-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
THIS_DIR=$(dirname "$0") | ||
node "$THIS_DIR/launchPackagerCLIMock.js.mock" start "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
jest.autoMockOff(); | ||
|
||
const onWindows = /^win/.test(process.platform); | ||
const { spawnSync } = require('child_process'); | ||
|
||
describe('packager launcher', () => { | ||
it('should be able to pass all arguments to the command-line script', () => { | ||
// Determine the appropriate script to test based on the host OS | ||
const cmd = `./packager/__tests__/launchPackagerMock.${onWindows ? 'bat' : 'sh'}`; | ||
|
||
// Let's try to pass some args | ||
const args = ['--arg1', '--arg2']; | ||
const proc = spawnSync(cmd, args); | ||
|
||
// We should've gotten the args from the mock script | ||
const outArgs = proc.stdout.toString().trim().split(";;"); | ||
|
||
// We account for an extra arg in the mock scripts | ||
expect(outArgs[1]).toEqual(args[0]); | ||
expect(outArgs[2]).toEqual(args[1]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters