This repository was archived by the owner on Nov 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 " code" ,
7171 " test"
7272 ]
73+ },
74+ {
75+ "login" : " hgwood" ,
76+ "name" : " Hugo Wood" ,
77+ "avatar_url" : " https://avatars3.githubusercontent.com/u/1656170?v=3" ,
78+ "profile" : " https://github.com/hgwood" ,
79+ "contributions" : [
80+ " bug" ,
81+ " code" ,
82+ " test"
83+ ]
7384 }
7485 ]
7586}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Run scripts that set and use environment variables across platforms
1010[ ![ downloads] [ downloads-badge ]] [ npm-stat ]
1111
1212[ ![ MIT License] [ license-badge ]] [ LICENSE ]
13- [ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-6 -orange.svg?style=flat-square )] ( #contributors )
13+ [ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-7 -orange.svg?style=flat-square )] ( #contributors )
1414[ ![ PRs Welcome] [ prs-badge ]] [ prs ]
1515[ ![ Donate] [ donate-badge ]] [ donate ]
1616[ ![ Code of Conduct] [ coc-badge ]] [ coc ]
@@ -102,8 +102,8 @@ much easier for windows users.
102102Thanks goes to these people ([ emoji key] [ emojis ] ):
103103
104104<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
105- | [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) | [<img src="https://avatars1.githubusercontent.com/u/499038?v=3" width="100px;"/><br /><sub>Ya Zhuang </sub>](https://zhuangya.me)<br />🔌 [📖](https://github.com/kentcdodds/cross-env/commits?author=zhuangya) | [<img src="https://avatars3.githubusercontent.com/u/3440094?v=3" width="100px;"/><br /><sub>James Harris</sub>](https://wopian.me)<br />[📖](https://github.com/kentcdodds/cross-env/commits?author=wopian) | [<img src="https://avatars1.githubusercontent.com/u/8941730?v=3" width="100px;"/><br /><sub>compumike08</sub>](https://github.com/compumike08)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Acompumike08) [📖](https://github.com/kentcdodds/cross-env/commits?author=compumike08) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=compumike08) | [<img src="https://avatars1.githubusercontent.com/u/2270425?v=3" width="100px;"/><br /><sub>Daniel Rodríguez Rivero</sub>](https://github.com/danielo515)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Adanielo515) [💻](https://github.com/kentcdodds/cross-env/commits?author=danielo515) [📖](https://github.com/kentcdodds/cross-env/commits?author=danielo515) | [<img src="https://avatars2.githubusercontent.com/u/1508477?v=3" width="100px;"/><br /><sub>Jonas Keinholz</sub>](https://github.com/inyono)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ainyono) [💻](https://github.com/kentcdodds/cross-env/commits?author=inyono) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=inyono) |
106- | :---: | :---: | :---: | :---: | :---: | :---: |
105+ | [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) | [<img src="https://avatars1.githubusercontent.com/u/499038?v=3" width="100px;"/><br /><sub>Ya Zhuang </sub>](https://zhuangya.me)<br />🔌 [📖](https://github.com/kentcdodds/cross-env/commits?author=zhuangya) | [<img src="https://avatars3.githubusercontent.com/u/3440094?v=3" width="100px;"/><br /><sub>James Harris</sub>](https://wopian.me)<br />[📖](https://github.com/kentcdodds/cross-env/commits?author=wopian) | [<img src="https://avatars1.githubusercontent.com/u/8941730?v=3" width="100px;"/><br /><sub>compumike08</sub>](https://github.com/compumike08)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Acompumike08) [📖](https://github.com/kentcdodds/cross-env/commits?author=compumike08) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=compumike08) | [<img src="https://avatars1.githubusercontent.com/u/2270425?v=3" width="100px;"/><br /><sub>Daniel Rodríguez Rivero</sub>](https://github.com/danielo515)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Adanielo515) [💻](https://github.com/kentcdodds/cross-env/commits?author=danielo515) [📖](https://github.com/kentcdodds/cross-env/commits?author=danielo515) | [<img src="https://avatars2.githubusercontent.com/u/1508477?v=3" width="100px;"/><br /><sub>Jonas Keinholz</sub>](https://github.com/inyono)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ainyono) [💻](https://github.com/kentcdodds/cross-env/commits?author=inyono) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=inyono) | [<img src="https://avatars3.githubusercontent.com/u/1656170?v=3" width="100px;"/><br /><sub>Hugo Wood</sub>](https://github.com/hgwood/blog)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ahgwood) [💻](https://github.com/kentcdodds/cross-env/commits?author=hgwood) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=hgwood) |
106+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
107107<!-- ALL-CONTRIBUTORS-LIST:END -->
108108
109109This project follows the [ all-contributors] [ all-contributors ] specification. Contributions of any kind welcome!
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import isWindows from 'is-windows'
22
33export default commandConvert
44
5- const envUseUnixRegex = / \$ ( \w + ) / g // $my_var
6- const envUseWinRegex = / % ( .* ?) % / g // %my_var%
5+ const envUseUnixRegex = / \$ ( \w + ) / // $my_var
6+ const envUseWinRegex = / % ( .* ?) % / // %my_var%
77
88/**
99 * Converts an environment variable usage to be appropriate for the current OS
Original file line number Diff line number Diff line change @@ -13,12 +13,20 @@ test(`converts unix-style env variable usage for windows`, () => {
1313test ( `leaves command unchanged when not a variable` , ( ) => {
1414 expect ( commandConvert ( 'test' ) ) . toBe ( 'test' )
1515} )
16+
1617test ( `converts windows-style env variable usage for linux` , ( ) => {
1718 isWindowsMock . __mock . returnValue = false
1819 expect ( commandConvert ( '%test%' ) ) . toBe ( '$test' )
1920} )
2021
2122test ( `leaves variable unchanged when using correct operating system` , ( ) => {
22- isWindowsMock . __mock . returnValue = true
23+ isWindowsMock . __mock . returnValue = false
2324 expect ( commandConvert ( '$test' ) ) . toBe ( '$test' )
2425} )
26+
27+ test ( `is stateless` , ( ) => {
28+ // this test prevents falling into regexp traps like this:
29+ // http://stackoverflow.com/a/1520853/971592
30+ isWindowsMock . __mock . returnValue = true
31+ expect ( commandConvert ( '$test' ) ) . toBe ( commandConvert ( '$test' ) )
32+ } )
You can’t perform that action at this time.
0 commit comments