@@ -91,15 +91,19 @@ test('installs the AVA dependency', async t => {
91
91
92
92
await m ( { cwd : path . dirname ( filepath ) } ) ;
93
93
94
- t . truthy ( get ( JSON . parse ( fs . readFileSync ( filepath , 'utf8' ) ) , 'devDependencies.ava' ) ) ;
94
+ const installed = get ( JSON . parse ( fs . readFileSync ( filepath , 'utf8' ) ) , 'devDependencies.ava' ) ;
95
+ t . truthy ( installed ) ;
96
+ t . regex ( installed , / ^ \^ / ) ;
95
97
} ) ;
96
98
97
99
test ( 'installs AVA@next' , async t => {
98
100
const filepath = tempWrite . sync ( JSON . stringify ( { } ) , 'package.json' ) ;
99
101
100
102
await m ( { cwd : path . dirname ( filepath ) , next : true } ) ;
101
103
102
- t . truthy ( get ( JSON . parse ( fs . readFileSync ( filepath , 'utf8' ) ) , 'devDependencies.ava' ) ) ;
104
+ const installed = get ( JSON . parse ( fs . readFileSync ( filepath , 'utf8' ) ) , 'devDependencies.ava' ) ;
105
+ t . truthy ( installed ) ;
106
+ t . regex ( installed , / ^ \d / ) ;
103
107
} ) ;
104
108
105
109
test ( 'installs via yarn if there\'s a lockfile' , async t => {
@@ -110,6 +114,20 @@ test('installs via yarn if there\'s a lockfile', async t => {
110
114
t . regex ( fs . readFileSync ( yarnLock , 'utf8' ) , / a v a / ) ;
111
115
} ) ;
112
116
117
+ test ( 'installs AVA@next via yarn if there\'s a lockfile' , async t => {
118
+ const filepath = tempWrite . sync ( JSON . stringify ( { } ) , 'package.json' ) ;
119
+ const yarnLock = path . join ( path . dirname ( filepath ) , 'yarn.lock' ) ;
120
+ fs . writeFileSync ( yarnLock , '' ) ;
121
+
122
+ await m ( { cwd : path . dirname ( yarnLock ) , next : true } ) ;
123
+
124
+ t . regex ( fs . readFileSync ( yarnLock , 'utf8' ) , / a v a / ) ;
125
+
126
+ const installed = get ( JSON . parse ( fs . readFileSync ( filepath , 'utf8' ) ) , 'devDependencies.ava' ) ;
127
+ t . truthy ( installed ) ;
128
+ t . regex ( installed , / ^ \d / ) ;
129
+ } ) ;
130
+
113
131
test ( 'invokes via cli' , async t => {
114
132
const cliFilepath = path . resolve ( __dirname , './cli.js' ) ;
115
133
const filepath = tempWrite . sync ( JSON . stringify ( { } ) , 'package.json' ) ;
0 commit comments