5
5
* This source code is licensed under the BSD-style license found in the
6
6
* LICENSE file in the root directory of this source tree. An additional grant
7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @flow
8
10
*/
9
11
12
+ import { Reporter } from "../../src/reporters/index.js" ;
10
13
import * as reporters from "../../src/reporters/index.js" ;
11
14
import * as constants from "../../src/constants.js" ;
12
15
import { default as Lockfile , parse } from "../../src/lockfile/index.js" ;
@@ -18,8 +21,8 @@ import assert from "assert";
18
21
import semver from "semver" ;
19
22
20
23
let stream = require ( "stream" ) ;
21
- let test = require ( "ava" ) ;
22
- let path = require ( "path" ) ;
24
+ let test = require ( "ava" ) ;
25
+ let path = require ( "path" ) ;
23
26
24
27
let fixturesLoc = path . join ( __dirname , ".." , "fixtures" , "install" ) ;
25
28
@@ -41,7 +44,13 @@ async function createLockfile(dir, strict, save) {
41
44
return new Lockfile ( lockfile , strict , save ) ;
42
45
}
43
46
44
- async function run ( flags , args , name , checkInstalled , beforeInstall ) {
47
+ async function run (
48
+ flags : Object ,
49
+ args : Array < string > ,
50
+ name : string ,
51
+ checkInstalled : ?( config : Config , reporter : Reporter ) = > ?Promise < void > ,
52
+ beforeInstall : ?( cwd : string ) = > ?Promise < void >
53
+ ) {
45
54
let out = "" ;
46
55
let stdout = new stream . Writable ( {
47
56
write ( data ) {
@@ -117,7 +126,6 @@ test("[network] install with arg that has binaries", () => {
117
126
test ( "[network] install with --save and offline mirror" , ( ) => {
118
127
let mirrorPath = "mirror-for-offline" ;
119
128
return run ( { save : true } , [ "is-array@1.0.1" ] , "install-with-save-offline-mirror" , async ( config ) => {
120
-
121
129
let allFiles = await fs . walk ( config . cwd ) ;
122
130
123
131
assert ( allFiles . findIndex ( ( file ) => {
@@ -131,7 +139,6 @@ test("[network] install with --save and offline mirror", () => {
131
139
132
140
await fs . unlink ( path . join ( config . cwd , mirrorPath ) ) ;
133
141
await fs . unlink ( path . join ( config . cwd , "package.json" ) ) ;
134
- return allFiles ;
135
142
} ) ;
136
143
} ) ;
137
144
@@ -152,7 +159,6 @@ test("[network] install with --save and without offline mirror", () => {
152
159
153
160
await fs . unlink ( path . join ( config . cwd , mirrorPath ) ) ;
154
161
await fs . unlink ( path . join ( config . cwd , "package.json" ) ) ;
155
- return allFiles ;
156
162
} ) ;
157
163
} ) ;
158
164
@@ -164,8 +170,6 @@ test("install from offline mirror", () => {
164
170
assert ( allFiles . findIndex ( ( file ) => {
165
171
return file . relative === "node_modules/fake-fbkpm-dependency/package.json" ;
166
172
} ) !== - 1 ) ;
167
-
168
- return allFiles ;
169
173
} ) ;
170
174
} ) ;
171
175
0 commit comments