This repository was archived by the owner on Jan 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 70
70
" code" ,
71
71
" test"
72
72
]
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
+ ]
73
84
}
74
85
]
75
86
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Run scripts that set and use environment variables across platforms
10
10
[ ![ downloads] [ downloads-badge ]] [ npm-stat ]
11
11
12
12
[ ![ 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 )
14
14
[ ![ PRs Welcome] [ prs-badge ]] [ prs ]
15
15
[ ![ Donate] [ donate-badge ]] [ donate ]
16
16
[ ![ Code of Conduct] [ coc-badge ]] [ coc ]
@@ -102,8 +102,8 @@ much easier for windows users.
102
102
Thanks goes to these people ([ emoji key] [ emojis ] ):
103
103
104
104
<!-- 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
+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
107
107
<!-- ALL-CONTRIBUTORS-LIST:END -->
108
108
109
109
This 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'
2
2
3
3
export default commandConvert
4
4
5
- const envUseUnixRegex = / \$ ( \w + ) / g // $my_var
6
- const envUseWinRegex = / % ( .* ?) % / g // %my_var%
5
+ const envUseUnixRegex = / \$ ( \w + ) / // $my_var
6
+ const envUseWinRegex = / % ( .* ?) % / // %my_var%
7
7
8
8
/**
9
9
* 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`, () => {
13
13
test ( `leaves command unchanged when not a variable` , ( ) => {
14
14
expect ( commandConvert ( 'test' ) ) . toBe ( 'test' )
15
15
} )
16
+
16
17
test ( `converts windows-style env variable usage for linux` , ( ) => {
17
18
isWindowsMock . __mock . returnValue = false
18
19
expect ( commandConvert ( '%test%' ) ) . toBe ( '$test' )
19
20
} )
20
21
21
22
test ( `leaves variable unchanged when using correct operating system` , ( ) => {
22
- isWindowsMock . __mock . returnValue = true
23
+ isWindowsMock . __mock . returnValue = false
23
24
expect ( commandConvert ( '$test' ) ) . toBe ( '$test' )
24
25
} )
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