@adonisjs/assembler 6.1.3-7 → 6.1.3-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/src/dev_server.js
CHANGED
|
@@ -94,7 +94,6 @@ export class DevServer {
|
|
|
94
94
|
});
|
|
95
95
|
this.#httpServer
|
|
96
96
|
.then((result) => {
|
|
97
|
-
this.#logger.warning(`underlying HTTP server closed with status code "${result.exitCode}"`);
|
|
98
97
|
if (mode === 'nonblocking') {
|
|
99
98
|
this.#onClose?.(result.exitCode);
|
|
100
99
|
this.#watcher?.close();
|
|
@@ -102,11 +101,11 @@ export class DevServer {
|
|
|
102
101
|
}
|
|
103
102
|
})
|
|
104
103
|
.catch((error) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
if (mode === 'nonblocking') {
|
|
105
|
+
this.#onError?.(error);
|
|
106
|
+
this.#watcher?.close();
|
|
107
|
+
this.#assetsServer?.stop();
|
|
108
|
+
}
|
|
110
109
|
});
|
|
111
110
|
}
|
|
112
111
|
/**
|
|
@@ -180,6 +179,17 @@ export class DevServer {
|
|
|
180
179
|
this.#onError = callback;
|
|
181
180
|
return this;
|
|
182
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Close watchers and running child processes
|
|
184
|
+
*/
|
|
185
|
+
async close() {
|
|
186
|
+
await this.#watcher?.close();
|
|
187
|
+
this.#assetsServer?.stop();
|
|
188
|
+
if (this.#httpServer) {
|
|
189
|
+
this.#httpServer.removeAllListeners();
|
|
190
|
+
this.#httpServer.kill('SIGKILL');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
183
193
|
/**
|
|
184
194
|
* Start the development server
|
|
185
195
|
*/
|
package/build/src/test_runner.js
CHANGED
|
@@ -121,21 +121,29 @@ export class TestRunner {
|
|
|
121
121
|
.then((result) => {
|
|
122
122
|
if (mode === 'nonblocking') {
|
|
123
123
|
this.#onClose?.(result.exitCode);
|
|
124
|
-
this
|
|
125
|
-
this.#assetsServer?.stop();
|
|
124
|
+
this.close();
|
|
126
125
|
}
|
|
127
126
|
})
|
|
128
127
|
.catch((error) => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
this.#assetsServer?.stop();
|
|
128
|
+
if (mode === 'nonblocking') {
|
|
129
|
+
this.#onError?.(error);
|
|
130
|
+
this.close();
|
|
131
|
+
}
|
|
134
132
|
})
|
|
135
133
|
.finally(() => {
|
|
136
134
|
this.#isBusy = false;
|
|
137
135
|
});
|
|
138
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Restarts the HTTP server
|
|
139
|
+
*/
|
|
140
|
+
#rerunTests(port, filtersArgs) {
|
|
141
|
+
if (this.#testScript) {
|
|
142
|
+
this.#testScript.removeAllListeners();
|
|
143
|
+
this.#testScript.kill('SIGKILL');
|
|
144
|
+
}
|
|
145
|
+
this.#runTests(port, filtersArgs, 'blocking');
|
|
146
|
+
}
|
|
139
147
|
/**
|
|
140
148
|
* Starts the assets server
|
|
141
149
|
*/
|
|
@@ -154,7 +162,7 @@ export class TestRunner {
|
|
|
154
162
|
if (isDotEnvFile(relativePath) || this.#isMetaFile(relativePath)) {
|
|
155
163
|
this.#clearScreen();
|
|
156
164
|
this.#logger.log(`${this.#colors.green(action)} ${relativePath}`);
|
|
157
|
-
this.#
|
|
165
|
+
this.#rerunTests(port, filters);
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
/**
|
|
@@ -171,13 +179,13 @@ export class TestRunner {
|
|
|
171
179
|
* then only run that file
|
|
172
180
|
*/
|
|
173
181
|
if (this.#isTestFile(relativePath)) {
|
|
174
|
-
this.#
|
|
182
|
+
this.#rerunTests(port, this.#convertFiltersToArgs({
|
|
175
183
|
...this.#options.filters,
|
|
176
184
|
files: [relativePath],
|
|
177
|
-
})
|
|
185
|
+
}));
|
|
178
186
|
return;
|
|
179
187
|
}
|
|
180
|
-
this.#
|
|
188
|
+
this.#rerunTests(port, filters);
|
|
181
189
|
}
|
|
182
190
|
/**
|
|
183
191
|
* Set a custom CLI UI logger
|
|
@@ -203,6 +211,17 @@ export class TestRunner {
|
|
|
203
211
|
this.#onError = callback;
|
|
204
212
|
return this;
|
|
205
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Close watchers and running child processes
|
|
216
|
+
*/
|
|
217
|
+
async close() {
|
|
218
|
+
await this.#watcher?.close();
|
|
219
|
+
this.#assetsServer?.stop();
|
|
220
|
+
if (this.#testScript) {
|
|
221
|
+
this.#testScript.removeAllListeners();
|
|
222
|
+
this.#testScript.kill('SIGKILL');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
206
225
|
/**
|
|
207
226
|
* Runs tests
|
|
208
227
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/assembler",
|
|
3
|
-
"version": "6.1.3-
|
|
3
|
+
"version": "6.1.3-9",
|
|
4
4
|
"description": "Provides utilities to run AdonisJS development server and build project for production",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -106,7 +106,10 @@
|
|
|
106
106
|
"exclude": [
|
|
107
107
|
"tests/**",
|
|
108
108
|
"build/**",
|
|
109
|
-
"examples/**"
|
|
109
|
+
"examples/**",
|
|
110
|
+
"src/dev_server.ts",
|
|
111
|
+
"src/test_runner.ts",
|
|
112
|
+
"src/assets_dev_server.ts"
|
|
110
113
|
]
|
|
111
114
|
},
|
|
112
115
|
"eslintConfig": {
|