Skip to content

Commit 8857ef1

Browse files
test: debug
1 parent 5f7adc4 commit 8857ef1

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ const noop = () => {};
199199
* @returns {API<RequestInternal, ResponseInternal>} webpack dev middleware
200200
*/
201201
function wdm(compiler, options = {}, isPlugin = false) {
202-
validate(/** @type {Schema} */ (schema), options, {
203-
name: "Dev Middleware",
204-
baseDataPath: "options",
205-
});
202+
// validate(/** @type {Schema} */ (schema), options, {
203+
// name: "Dev Middleware",
204+
// baseDataPath: "options",
205+
// });
206206

207207
const { mimeTypes } = options;
208208

@@ -539,7 +539,7 @@ wdm.koaWrapper = koaWrapper;
539539
* @template {IncomingMessage} [RequestInternal=IncomingMessage]
540540
* @template {ServerResponse} [ResponseInternal=ServerResponse]
541541
* @param {Compiler | MultiCompiler} compiler compiler
542-
* @param {Options<RequestInternal, ResponseInternal>=} options options
542+
* @param {Options<RequestInternal, ResponseInternal> & { debug?: boolean }=} options options
543543
* @param {boolean=} usePlugin true when need to use as a plugin, otherwise false
544544
* @returns {(ctx: EXPECTED_ANY, next: EXPECTED_FUNCTION) => Promise<void> | void} hono wrapper
545545
*/
@@ -639,7 +639,7 @@ function honoWrapper(compiler, options = {}, usePlugin = false) {
639639
* @param {import("fs").ReadStream} stream readable stream
640640
*/
641641
res.stream = (stream) => {
642-
if (options.writeToDisk === true) {
642+
if (options.writeToDisk === true && options.debug) {
643643
console.error(stream);
644644
}
645645

@@ -649,7 +649,7 @@ function honoWrapper(compiler, options = {}, usePlugin = false) {
649649
* @param {Error=} err err
650650
*/
651651
const onEvent = (err) => {
652-
if (options.writeToDisk === true) {
652+
if (options.writeToDisk === true && options.debug) {
653653
console.error("onEvent", err);
654654
}
655655

@@ -669,7 +669,7 @@ function honoWrapper(compiler, options = {}, usePlugin = false) {
669669
body = stream;
670670
isFinished = true;
671671

672-
if (options.writeToDisk === true) {
672+
if (options.writeToDisk === true && options.debug) {
673673
console.error("resolve", isFinished);
674674
}
675675

@@ -729,7 +729,7 @@ function honoWrapper(compiler, options = {}, usePlugin = false) {
729729
},
730730
);
731731
} catch (err) {
732-
if (options.writeToDisk === true) {
732+
if (options.writeToDisk === true && options.debug) {
733733
console.error("catch", err);
734734
}
735735

@@ -744,15 +744,15 @@ function honoWrapper(compiler, options = {}, usePlugin = false) {
744744
return context.json({ message: /** @type {Error} */ (err).message });
745745
}
746746

747-
if (options.writeToDisk === true) {
747+
if (options.writeToDisk === true && options.debug) {
748748
console.error("body", body);
749749
}
750750

751751
if (typeof body !== "undefined") {
752752
return context.body(body, status);
753753
}
754754

755-
if (options.writeToDisk === true) {
755+
if (options.writeToDisk === true && options.debug) {
756756
console.error("next");
757757
}
758758

test/middleware.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4233,7 +4233,7 @@ describe.each([
42334233
});
42344234

42354235
describe("writeToDisk option", () => {
4236-
describe('should work with "true" value', () => {
4236+
describe.only('should work with "true" value', () => {
42374237
let compiler;
42384238

42394239
const outputPath = path.resolve(
@@ -4255,7 +4255,7 @@ describe.each([
42554255
name,
42564256
framework,
42574257
compiler,
4258-
{ writeToDisk: true },
4258+
{ writeToDisk: true, debug: true },
42594259
);
42604260
});
42614261

0 commit comments

Comments
 (0)