From 9a665ec8d5b19dc49118d08d60505e9419190c8c Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Fri, 3 Apr 2020 21:41:47 +0900 Subject: [PATCH 01/87] chore(deps): update jest --- jest.config.js | 1 - package-lock.json | 2201 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 2043 insertions(+), 159 deletions(-) diff --git a/jest.config.js b/jest.config.js index 322de40ff..da6e28d6d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = { - testURL: 'http://localhost/', collectCoverage: false, coveragePathIgnorePatterns: ['test'], moduleFileExtensions: ['js', 'json'], diff --git a/package-lock.json b/package-lock.json index 1cd02b80d..e59a93658 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1256,6 +1256,18 @@ "slash": "^3.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1297,6 +1309,33 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1350,6 +1389,42 @@ "strip-ansi": "^6.0.0" }, "dependencies": { + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -1366,6 +1441,16 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -1409,6 +1494,13 @@ "to-regex-range": "^5.0.1" } }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1421,6 +1513,69 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -1440,12 +1595,24 @@ "glob": "^7.1.3" } }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -1472,6 +1639,15 @@ "requires": { "is-number": "^7.0.0" } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -1484,53 +1660,20 @@ "@jest/fake-timers": "^25.2.6", "@jest/types": "^25.2.6", "jest-mock": "^25.2.6" - } - }, - "@jest/fake-timers": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", - "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "lolex": "^5.0.0" - } - }, - "@jest/reporters": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", - "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.0", - "jest-haste-map": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "node-notifier": "^6.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^3.1.0", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^4.0.1" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1572,18 +1715,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -1595,73 +1726,31 @@ } } }, - "@jest/source-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", - "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.3", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "@jest/test-result": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", - "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", - "dev": true, - "requires": { - "@jest/console": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", - "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", - "dev": true, - "requires": { - "@jest/test-result": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7" - } - }, - "@jest/transform": { + "@jest/fake-timers": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", + "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", "dev": true, "requires": { - "@babel/core": "^7.1.0", "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" + "lolex": "^5.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1672,15 +1761,6 @@ "color-convert": "^2.0.1" } }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -1706,15 +1786,188 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/reporters": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", + "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "jest-haste-map": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "node-notifier": "^6.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^3.1.0", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^4.0.1" + }, + "dependencies": { + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "requires": { "to-regex-range": "^5.0.1" } }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1727,6 +1980,69 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -1737,6 +2053,12 @@ "picomatch": "^2.0.5" } }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1766,21 +2088,137 @@ "requires": { "is-number": "^7.0.0" } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, - "@jest/types": { + "@jest/source-map": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", + "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", "dev": true, "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.3", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "@jest/test-result": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", + "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", + "dev": true, + "requires": { + "@jest/console": "^25.2.6", + "@jest/types": "^25.2.6", "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" + "collect-v8-coverage": "^1.0.0" + }, + "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/test-sequencer": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", + "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", + "dev": true, + "requires": { + "@jest/test-result": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1791,6 +2229,25 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -1816,12 +2273,107 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -1830,6 +2382,24 @@ "requires": { "has-flag": "^4.0.0" } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -2666,6 +3236,42 @@ "slash": "^3.0.0" }, "dependencies": { + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -2676,6 +3282,15 @@ "color-convert": "^2.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -2701,18 +3316,49 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -2721,6 +3367,15 @@ "requires": { "has-flag": "^4.0.0" } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } } } }, @@ -5255,6 +5910,18 @@ "jest-regex-util": "^25.2.6" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -5265,6 +5932,16 @@ "color-convert": "^2.0.1" } }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -5279,6 +5956,27 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, @@ -7820,9 +8518,9 @@ } }, "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-Vm9xwCiQ8t2cNNnckyeAV0UdxKpcQUz4nMxsBvIu8n2kmPSiyb5uaF/8LpmKr+yqL/MdOXaX2Nmdo4Qyxium9Q==", "dev": true, "requires": { "html-escaper": "^2.0.0", @@ -7840,6 +8538,18 @@ "jest-cli": "^25.2.7" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -7902,6 +8612,33 @@ "yargs": "^15.3.1" } }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -7924,10 +8661,57 @@ "throat": "^5.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -7962,6 +8746,12 @@ "pump": "^3.0.0" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -8004,6 +8794,15 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -8041,6 +8840,42 @@ "realpath-native": "^2.0.0" }, "dependencies": { + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8051,6 +8886,51 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "babel-jest": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", + "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", + "dev": true, + "requires": { + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "@types/babel__core": "^7.1.0", + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-jest": "^25.2.6", + "chalk": "^3.0.0", + "slash": "^3.0.0" + } + }, + "babel-plugin-jest-hoist": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", + "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", + "dev": true, + "requires": { + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-jest": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", + "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-bigint": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "babel-plugin-jest-hoist": "^25.2.6" + } + }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -8094,6 +8974,13 @@ "to-regex-range": "^5.0.1" } }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8106,6 +8993,69 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -8116,6 +9066,24 @@ "picomatch": "^2.0.5" } }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -8133,6 +9101,15 @@ "requires": { "is-number": "^7.0.0" } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -8222,6 +9199,18 @@ "pretty-format": "^25.2.6" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8263,6 +9252,33 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -8286,6 +9302,97 @@ "jest-mock": "^25.2.6", "jest-util": "^25.2.6", "jsdom": "^15.2.1" + }, + "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-environment-node": { @@ -8302,11 +9409,94 @@ "semver": "^6.3.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, @@ -8336,6 +9526,28 @@ "which": "^2.0.2" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, "anymatch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", @@ -8355,6 +9567,31 @@ "fill-range": "^7.0.1" } }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8371,6 +9608,12 @@ "dev": true, "optional": true }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -8387,6 +9630,15 @@ "picomatch": "^2.0.5" } }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -8432,6 +9684,18 @@ "throat": "^5.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8473,6 +9737,33 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -8661,6 +9952,18 @@ "stack-utils": "^1.0.1" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8769,6 +10072,70 @@ "dev": true, "requires": { "@jest/types": "^25.2.6" + }, + "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-pnp-resolver": { @@ -8797,6 +10164,18 @@ "resolve": "^1.15.1" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8858,6 +10237,76 @@ "@jest/types": "^25.2.6", "jest-regex-util": "^25.2.6", "jest-snapshot": "^25.2.7" + }, + "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "jest-runner": { @@ -8887,6 +10336,18 @@ "throat": "^5.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8897,35 +10358,149 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "dev": true, "requires": { - "color-name": "~1.1.4" + "braces": "^3.0.1", + "picomatch": "^2.0.5" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, "supports-color": { @@ -8936,6 +10511,24 @@ "requires": { "has-flag": "^4.0.0" } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -8972,6 +10565,42 @@ "yargs": "^15.3.1" }, "dependencies": { + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", + "jest-util": "^25.2.6", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + } + }, + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -8982,6 +10611,25 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -9007,18 +10655,125 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "dev": true, + "optional": true + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "jest-haste-map": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", + "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.3", + "jest-serializer": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7", + "which": "^2.0.2" + } + }, + "jest-regex-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", + "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", + "dev": true + }, + "jest-serializer": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", + "dev": true + }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "jest-worker": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", + "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -9033,6 +10788,24 @@ "requires": { "has-flag": "^4.0.0" } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -9064,6 +10837,18 @@ "semver": "^6.3.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9143,6 +10928,18 @@ "make-dir": "^3.0.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9224,6 +11021,18 @@ "pretty-format": "^25.2.6" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9296,6 +11105,18 @@ "string-length": "^3.1.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9337,6 +11158,33 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "jest-util": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", + "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "is-ci": "^2.0.0", + "make-dir": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -11335,6 +13183,18 @@ "react-is": "^16.12.0" }, "dependencies": { + "@jest/types": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" + } + }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -11351,6 +13211,16 @@ "color-convert": "^2.0.1" } }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -11365,6 +13235,21 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, From aa950a532e450f9c1d92632fa595ff561b8490b1 Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Sun, 5 Apr 2020 14:09:16 +0900 Subject: [PATCH 02/87] chore: migrate to github-actions --- .github/workflows/linter.yml | 30 ++++++ .github/workflows/tests.yml | 41 ++++++++ azure-pipelines.yml | 189 ----------------------------------- 3 files changed, 71 insertions(+), 189 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..35e68a78c --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,30 @@ +name: linter + +on: [push] + +env: + NODE_VERSION: 10.x + +jobs: + linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Use Npm@latest + run: npm i -g npm + - name: Print versions + run: | + node -v + npm -v + - name: Install dependencies + run: npm ci + - name: 'Run lint' + run: npm run lint + - name: 'Run NPM audit' + run: npm run security + - name: Check commit message + uses: wagoid/commitlint-github-action@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..59f77be19 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +name: test + +on: [push] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + node-version: [13.x, 12.x, 10.x] + webpack-version: [next, 4] + exclude: + - node-version: 13.x + webpack-version: 4 + - node-version: 12.x + webpack-version: 4 + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Use Npm@latest + run: npm i -g npm + - name: Print versions + run: | + node -v + npm -v + - name: Install dependencies + run: npm ci + - name: Install webpack@${{ matrix.webpack-version }} + run: npm i webpack@${{ matrix.webpack-version }} + - name: Run tests with coverage + run: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" + - name: Submit coverage data to codecov + uses: codecov/codecov-action@v1.0.6 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: '**/junit.xml' diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 9fa6cae03..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,189 +0,0 @@ -trigger: - - master - - next - -jobs: - - job: Lint - pool: - vmImage: ubuntu-latest - steps: - - task: NodeTool@0 - inputs: - versionSpec: ^10.13.0 - displayName: 'Install Node.js' - - task: Npm@1 - inputs: - command: custom - customCommand: i -g npm@latest - displayName: 'Install latest NPM' - - script: | - node -v - npm -v - displayName: 'Print versions' - - task: Npm@1 - inputs: - command: custom - customCommand: ci - displayName: 'Install dependencies' - - script: npm run lint - displayName: 'Run lint' - - script: npm run security - displayName: 'Run NPM audit' - - script: ./node_modules/.bin/commitlint-azure-pipelines - displayName: 'Run lint commit message' - - - job: Linux - pool: - vmImage: ubuntu-latest - strategy: - maxParallel: 4 - matrix: - node-13: - node_version: ^13.0.0 - webpack_version: next - node-12: - node_version: ^12.0.0 - webpack_version: next - node-10: - node_version: ^10.13.0 - webpack_version: next - node-10-v4: - node_version: ^10.13.0 - webpack_version: 4 - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version) - displayName: 'Install Node.js $(node_version)' - - task: Npm@1 - inputs: - command: custom - customCommand: i -g npm@latest - displayName: 'Install latest NPM' - - script: | - node -v - npm -v - displayName: 'Print versions' - - task: Npm@1 - inputs: - command: custom - customCommand: ci - displayName: 'Install dependencies' - - script: npm i webpack@$(webpack_version) - displayName: 'Install "webpack@$(webpack_version)"' - - script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error) - displayName: 'Run tests with coverage' - - task: PublishTestResults@2 - inputs: - testRunTitle: 'Linux with Node.js $(node_version)' - testResultsFiles: '**/junit.xml' - condition: succeededOrFailed() - displayName: 'Publish test results' - - script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN) - condition: succeededOrFailed() - displayName: 'Submit coverage data to codecov' - - - job: macOS - pool: - vmImage: macOS-latest - strategy: - maxParallel: 4 - matrix: - node-13: - node_version: ^13.0.0 - webpack_version: next - node-12: - node_version: ^12.0.0 - webpack_version: next - node-10: - node_version: ^10.13.0 - webpack_version: next - node-10-v4: - node_version: ^10.13.0 - webpack_version: 4 - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version) - displayName: 'Install Node.js $(node_version)' - - task: Npm@1 - inputs: - command: custom - customCommand: i -g npm@latest - displayName: 'Install latest NPM' - - script: | - node -v - npm -v - displayName: 'Print versions' - - task: Npm@1 - inputs: - command: custom - customCommand: ci - displayName: 'Install dependencies' - - script: npm i webpack@$(webpack_version) - displayName: 'Install "webpack@$(webpack_version)"' - - script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error) - displayName: 'Run tests with coverage' - - task: PublishTestResults@2 - inputs: - testRunTitle: 'Linux with Node.js $(node_version)' - testResultsFiles: '**/junit.xml' - condition: succeededOrFailed() - displayName: 'Publish test results' - - script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN) - condition: succeededOrFailed() - displayName: 'Submit coverage data to codecov' - - - job: Windows - pool: - vmImage: windows-latest - strategy: - maxParallel: 4 - matrix: - node-13: - node_version: ^13.0.0 - webpack_version: next - node-12: - node_version: ^12.0.0 - webpack_version: next - node-10: - node_version: ^10.13.0 - webpack_version: next - node-10-v4: - node_version: ^10.13.0 - webpack_version: 4 - steps: - - script: 'git config --global core.autocrlf input' - displayName: 'Config git core.autocrlf' - - checkout: self - - task: NodeTool@0 - inputs: - versionSpec: $(node_version) - displayName: 'Install Node.js $(node_version)' - - task: Npm@1 - inputs: - command: custom - customCommand: i -g npm@latest - displayName: 'Install latest NPM' - - script: | - node -v - npm -v - displayName: 'Print versions' - - task: Npm@1 - inputs: - command: custom - customCommand: ci - displayName: 'Install dependencies' - - script: npm i webpack@$(webpack_version) - displayName: 'Install "webpack@$(webpack_version)"' - - script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error) - displayName: 'Run tests with coverage' - - task: PublishTestResults@2 - inputs: - testRunTitle: 'Linux with Node.js $(node_version)' - testResultsFiles: '**/junit.xml' - condition: succeededOrFailed() - displayName: 'Publish test results' - - script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN) - condition: succeededOrFailed() - displayName: 'Submit coverage data to codecov' From c331bfb26a4aa2726f33c2e10128d4e1056c7c7d Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Sun, 5 Apr 2020 19:04:51 +0900 Subject: [PATCH 03/87] test: don't use fixed values --- test/middleware.test.js | 143 +++++++++++++++------------------------- 1 file changed, 52 insertions(+), 91 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 1ef821287..b01c0a9b2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -54,6 +54,7 @@ describe('middleware', () => { describe('basic', () => { describe('should work', () => { let compiler; + let codeLength; const outputPath = path.resolve(__dirname, './outputs/basic'); @@ -71,7 +72,12 @@ describe('middleware', () => { app = express(); app.use(instance); - listen = listenShorthand(done); + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', (params) => { + codeLength = params.assets['bundle.js'].source().length; + done(); + }); + }); instance.context.outputFileSystem.mkdirSync(outputPath, { recursive: true, @@ -219,10 +225,7 @@ describe('middleware', () => { .get('/bundle.js') .set('Range', 'bytes=3000-3500') .expect('Content-Length', '501') - .expect( - 'Content-Range', - isWebpack5() ? 'bytes 3000-3500/5204' : 'bytes 3000-3500/4875' - ) + .expect('Content-Range', `bytes 3000-3500/${codeLength}`) .expect(206, done); }); @@ -1011,6 +1014,8 @@ describe('middleware', () => { }); describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + let hash; + beforeAll((done) => { const compiler = getCompiler({ ...webpackConfig, @@ -1030,19 +1035,18 @@ describe('middleware', () => { app = express(); app.use(instance); - listen = listenShorthand(done); + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); }); afterAll(close); it('should return "200" code for GET request to the bundle file', (done) => { - request(app) - .get( - isWebpack5() - ? '/static/45c13f171499f5100d88/bundle.js' - : '/static/4c347cd8af8b39e58cbf/bundle.js' - ) - .expect(200, done); + request(app).get(`/static/${hash}/bundle.js`).expect(200, done); }); it('should return "404" code for GET request to a nonexistent file', (done) => { @@ -1051,22 +1055,14 @@ describe('middleware', () => { it('should return "200" code for GET request to the public path', (done) => { request(app) - .get( - isWebpack5() - ? '/static/45c13f171499f5100d88/' - : '/static/4c347cd8af8b39e58cbf/' - ) + .get(`/static/${hash}/`) .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); it('should return "200" code for GET request to the "index" option', (done) => { request(app) - .get( - isWebpack5() - ? '/static/45c13f171499f5100d88/index.html' - : '/static/4c347cd8af8b39e58cbf/index.html' - ) + .get(`/static/${hash}/index.html`) .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); @@ -1077,6 +1073,9 @@ describe('middleware', () => { }); describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + let hashOne; + let hashTwo; + beforeAll((done) => { const compiler = getCompiler([ { @@ -1116,91 +1115,56 @@ describe('middleware', () => { app = express(); app.use(instance); - listen = listenShorthand(done); + listen = listenShorthand(() => { + compiler.hooks.done.tap('wdm-test', (params) => { + const [one, two] = params.stats; + + hashOne = one.hash; + hashTwo = two.hash; + + done(); + }); + }); }); afterAll(close); it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-one/a9739b1fa1e4eb31790f/bundle.js' - : '/static-one/7ed325c92a1d0fe4ce64/bundle.js' - ) - .expect(200, done); + request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); }); it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-one/a9739b1fa1e4eb31790f/invalid.js' - : '/static-one/7ed325c92a1d0fe4ce64/invalid.js' - ) - .expect(404, done); + request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); }); it('should return "200" code for GET request for the second bundle file', (done) => { request(app) - .get( - isWebpack5() - ? '/static-one/a9739b1fa1e4eb31790f/' - : '/static-one/7ed325c92a1d0fe4ce64/' - ) + .get(`/static-one/${hashOne}/`) .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { request(app) - .get( - isWebpack5() - ? '/static-one/a9739b1fa1e4eb31790f/index.html' - : '/static-one/7ed325c92a1d0fe4ce64/index.html' - ) + .get(`/static-one/${hashOne}/index.html`) .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-two/a819fc976c8e917e69c6/bundle.js' - : '/static-two/db47aa827bb52e5f2e6b/bundle.js' - ) - .expect(200, done); + request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); }); it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-two/a819fc976c8e917e69c6/invalid.js' - : '/static-two/db47aa827bb52e5f2e6b/invalid.js' - ) - .expect(404, done); + request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); }); it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-two/a819fc976c8e917e69c6/' - : '/static-two/db47aa827bb52e5f2e6b/' - ) - .expect(404, done); + request(app).get(`/static-two/${hashTwo}/`).expect(404, done); }); it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - request(app) - .get( - isWebpack5() - ? '/static-two/a819fc976c8e917e69c6/index.html' - : '/static-two/db47aa827bb52e5f2e6b/index.html' - ) - .expect(404, done); + request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); }); it('should return "404" code for GET request to non-public path', (done) => { @@ -2577,6 +2541,7 @@ describe('middleware', () => { describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { let compiler; + let hash; beforeAll((done) => { compiler = getCompiler({ @@ -2605,7 +2570,12 @@ describe('middleware', () => { app = express(); app.use(instance); - listen = listenShorthand(done); + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); }); afterAll(() => { @@ -2618,25 +2588,16 @@ describe('middleware', () => { it('should find the bundle file on disk', (done) => { request(app) - .get( - isWebpack5() - ? '/static/45c13f171499f5100d88/bundle.js' - : '/static/4c347cd8af8b39e58cbf/bundle.js' - ) + .get(`/static/${hash}/bundle.js`) .expect(200, (error) => { if (error) { return done(error); } - const bundlePath = isWebpack5() - ? path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_45c13f171499f5100d88/bundle.js' - ) - : path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_4c347cd8af8b39e58cbf/bundle.js' - ); + const bundlePath = path.resolve( + __dirname, + `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` + ); expect(fs.existsSync(bundlePath)).toBe(true); From 6a26cc6472f33bb2d6b982b836af6f7ab90d9918 Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Mon, 6 Apr 2020 22:04:15 +0900 Subject: [PATCH 04/87] chore: feedback --- .github/workflows/linter.yml | 30 -------------------- .github/workflows/tests.yml | 53 ++++++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 35e68a78c..000000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: linter - -on: [push] - -env: - NODE_VERSION: 10.x - -jobs: - linter: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Use Npm@latest - run: npm i -g npm - - name: Print versions - run: | - node -v - npm -v - - name: Install dependencies - run: npm ci - - name: 'Run lint' - run: npm run lint - - name: 'Run NPM audit' - run: npm run security - - name: Check commit message - uses: wagoid/commitlint-github-action@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 59f77be19..a4ef6742e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,21 +1,52 @@ -name: test +name: tests -on: [push] +on: + push: + branches: + - master + - next + pull_request: + branches: + - master + - next jobs: - test: + linter: + name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} + strategy: + matrix: + os: [ubuntu-latest] + node-version: [12.x] runs-on: ${{ matrix.os }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Print versions + run: | + node -v + npm -v + - name: Install dependencies + run: npm ci + - name: 'Run lint' + run: npm run lint + - name: 'Run NPM audit' + run: npm run security + - name: Check commit message + uses: wagoid/commitlint-github-action@v1 + + test: + name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }} strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] node-version: [13.x, 12.x, 10.x] webpack-version: [next, 4] - exclude: - - node-version: 13.x - webpack-version: 4 - - node-version: 12.x - webpack-version: 4 - + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -30,9 +61,9 @@ jobs: npm -v - name: Install dependencies run: npm ci - - name: Install webpack@${{ matrix.webpack-version }} + - name: Install webpack ${{ matrix.webpack-version }} run: npm i webpack@${{ matrix.webpack-version }} - - name: Run tests with coverage + - name: Run tests for webpack version ${{ matrix.webpack-version }} run: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" - name: Submit coverage data to codecov uses: codecov/codecov-action@v1.0.6 From 7b956efcf4a1225b2a7ea2523bb7c6524a04ae42 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 13:23:17 +0300 Subject: [PATCH 05/87] ci: improve --- .github/workflows/{tests.yml => nodejs.yml} | 54 ++++++++++++--------- README.md | 4 +- 2 files changed, 34 insertions(+), 24 deletions(-) rename .github/workflows/{tests.yml => nodejs.yml} (66%) diff --git a/.github/workflows/tests.yml b/.github/workflows/nodejs.yml similarity index 66% rename from .github/workflows/tests.yml rename to .github/workflows/nodejs.yml index a4ef6742e..8064def6c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/nodejs.yml @@ -1,4 +1,4 @@ -name: tests +name: webpack-dev-middleware on: push: @@ -13,60 +13,70 @@ on: jobs: linter: name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} + + runs-on: ${{ matrix.os }} + strategy: matrix: os: [ubuntu-latest] node-version: [12.x] - runs-on: ${{ matrix.os }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} + + - name: Use Node.js ${{ env.node-version }} uses: actions/setup-node@v1 with: - node-version: ${{ env.NODE_VERSION }} - - name: Print versions - run: | - node -v - npm -v + node-version: ${{ env.node-version }} + + - name: Use latest NPM + run: npm i -g npm + - name: Install dependencies run: npm ci - - name: 'Run lint' + + - name: Lint run: npm run lint - - name: 'Run NPM audit' + + - name: Security audit run: npm run security + - name: Check commit message uses: wagoid/commitlint-github-action@v1 test: name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }} + strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - node-version: [13.x, 12.x, 10.x] - webpack-version: [next, 4] + os: [ubuntu-latest, windows-latest macos-latest] + node-version: [10.x, 12.x, 13.x] + webpack-version: [latest, next] + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: Use Npm@latest + + - name: Use latest NPM run: npm i -g npm - - name: Print versions - run: | - node -v - npm -v + - name: Install dependencies run: npm ci + - name: Install webpack ${{ matrix.webpack-version }} run: npm i webpack@${{ matrix.webpack-version }} + - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" + run: npm run test:coverage -- --ci + - name: Submit coverage data to codecov - uses: codecov/codecov-action@v1.0.6 + uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} file: '**/junit.xml' diff --git a/README.md b/README.md index f39effc0c..869bbd625 100644 --- a/README.md +++ b/README.md @@ -356,8 +356,8 @@ Please take a moment to read our contributing guidelines if you haven't yet done [node-url]: https://nodejs.org [deps]: https://david-dm.org/webpack/webpack-dev-middleware.svg [deps-url]: https://david-dm.org/webpack/webpack-dev-middleware -[tests]: https://dev.azure.com/webpack/webpack-dev-middleware/_apis/build/status/webpack.webpack-dev-middleware?branchName=master -[tests-url]: https://dev.azure.com/webpack/webpack-dev-middleware/_build/latest?definitionId=8&branchName=master +[tests]: https://github.com/webpack/webpack-dev-middleware/workflows/webpack-dev-middleware/badge.svg +[tests-url]: https://github.com/webpack/webpack-dev-middleware/actions [cover]: https://codecov.io/gh/webpack/webpack-dev-middleware/branch/master/graph/badge.svg [cover-url]: https://codecov.io/gh/webpack/webpack-dev-middleware [chat]: https://badges.gitter.im/webpack/webpack.svg From c207e6173fa1ab98988aaf0094bc5aa6bfdca640 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 13:28:37 +0300 Subject: [PATCH 06/87] ci: improve --- .github/workflows/nodejs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8064def6c..db5b77671 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -30,7 +30,7 @@ jobs: node-version: ${{ env.node-version }} - name: Use latest NPM - run: npm i -g npm + run: sudo npm i -g npm - name: Install dependencies run: npm ci @@ -64,7 +64,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Use latest NPM - run: npm i -g npm + run: sudo npm i -g npm - name: Install dependencies run: npm ci From 3e994518315685d1f2fd86f315e3be2d1085e88a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 13:28:56 +0300 Subject: [PATCH 07/87] ci: improve --- .github/workflows/nodejs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index db5b77671..b8e1dbbb6 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,13 +14,13 @@ jobs: linter: name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} - runs-on: ${{ matrix.os }} - strategy: matrix: os: [ubuntu-latest] node-version: [12.x] + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v2 @@ -49,7 +49,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] node-version: [10.x, 12.x, 13.x] webpack-version: [latest, next] From 07a095da7eebde0f0fdc52da5ad6bf8cc981b633 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 13:45:15 +0300 Subject: [PATCH 08/87] ci: improve --- .github/workflows/nodejs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b8e1dbbb6..6677c7965 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -41,8 +41,8 @@ jobs: - name: Security audit run: npm run security - - name: Check commit message - uses: wagoid/commitlint-github-action@v1 + # - name: Check commit message + # uses: wagoid/commitlint-github-action@v1 test: name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }} @@ -63,8 +63,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Use latest NPM - run: sudo npm i -g npm + # - name: Use latest NPM + # run: sudo npm i -g npm - name: Install dependencies run: npm ci From d63cbb73db6e22da0389c947ce2d0cce842939c5 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 13:53:53 +0300 Subject: [PATCH 09/87] ci: improve --- package-lock.json | 4726 +++++++++++++-------------------------------- package.json | 1 - 2 files changed, 1378 insertions(+), 3349 deletions(-) diff --git a/package-lock.json b/package-lock.json index e59a93658..9a2a7701a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1256,18 +1256,6 @@ "slash": "^3.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1309,33 +1297,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1389,42 +1350,6 @@ "strip-ansi": "^6.0.0" }, "dependencies": { - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -1441,16 +1366,6 @@ "color-convert": "^2.0.1" } }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -1494,13 +1409,6 @@ "to-regex-range": "^5.0.1" } }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1513,69 +1421,6 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -1595,24 +1440,12 @@ "glob": "^7.1.3" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -1639,15 +1472,6 @@ "requires": { "is-number": "^7.0.0" } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } } } }, @@ -1660,20 +1484,53 @@ "@jest/fake-timers": "^25.2.6", "@jest/types": "^25.2.6", "jest-mock": "^25.2.6" + } + }, + "@jest/fake-timers": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", + "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", + "dev": true, + "requires": { + "@jest/types": "^25.2.6", + "jest-message-util": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "lolex": "^5.0.0" + } + }, + "@jest/reporters": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", + "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^25.2.6", + "@jest/test-result": "^25.2.6", + "@jest/transform": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "jest-haste-map": "^25.2.6", + "jest-resolve": "^25.2.6", + "jest-util": "^25.2.6", + "jest-worker": "^25.2.6", + "node-notifier": "^6.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^3.1.0", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^4.0.1" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1715,6 +1572,18 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -1726,31 +1595,73 @@ } } }, - "@jest/fake-timers": { + "@jest/source-map": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.2.6.tgz", - "integrity": "sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA==", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", + "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", + "dev": true, + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.3", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "@jest/test-result": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", + "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", "dev": true, "requires": { + "@jest/console": "^25.2.6", "@jest/types": "^25.2.6", - "jest-message-util": "^25.2.6", - "jest-mock": "^25.2.6", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", + "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", + "dev": true, + "requires": { + "@jest/test-result": "^25.2.6", + "jest-haste-map": "^25.2.6", + "jest-runner": "^25.2.7", + "jest-runtime": "^25.2.7" + } + }, + "@jest/transform": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", + "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^25.2.6", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^3.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.3", + "jest-haste-map": "^25.2.6", + "jest-regex-util": "^25.2.6", "jest-util": "^25.2.6", - "lolex": "^5.0.0" + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "realpath-native": "^2.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -1761,6 +1672,15 @@ "color-convert": "^2.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -1785,188 +1705,15 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/reporters": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.2.6.tgz", - "integrity": "sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^25.2.6", - "@jest/test-result": "^25.2.6", - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.0", - "jest-haste-map": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "node-notifier": "^6.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^3.1.0", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^4.0.1" - }, - "dependencies": { - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } }, "has-flag": { "version": "4.0.0", @@ -1980,69 +1727,6 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -2053,12 +1737,6 @@ "picomatch": "^2.0.5" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -2088,61 +1766,21 @@ "requires": { "is-number": "^7.0.0" } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "@jest/source-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.2.6.tgz", - "integrity": "sha512-VuIRZF8M2zxYFGTEhkNSvQkUKafQro4y+mwUxy5ewRqs5N/ynSFUODYp3fy1zCnbCMy1pz3k+u57uCqx8QRSQQ==", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.3", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true } } }, - "@jest/test-result": { + "@jest/types": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.2.6.tgz", - "integrity": "sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w==", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", + "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", "dev": true, "requires": { - "@jest/console": "^25.2.6", - "@jest/types": "^25.2.6", "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^15.0.0", + "chalk": "^3.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -2195,218 +1833,10 @@ } } }, - "@jest/test-sequencer": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz", - "integrity": "sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw==", - "dev": true, - "requires": { - "@jest/test-result": "^25.2.6", - "jest-haste-map": "^25.2.6", - "jest-runner": "^25.2.7", - "jest-runtime": "^25.2.7" - }, - "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "@marionebl/sander": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@marionebl/sander/-/sander-0.6.1.tgz", - "integrity": "sha1-GViWWHTyS8Ub5Ih1/rUNZC/EH3s=", + "@marionebl/sander": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@marionebl/sander/-/sander-0.6.1.tgz", + "integrity": "sha1-GViWWHTyS8Ub5Ih1/rUNZC/EH3s=", "dev": true, "requires": { "graceful-fs": "^4.1.3", @@ -2491,9 +1921,9 @@ } }, "@types/babel__traverse": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz", - "integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==", + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.10.tgz", + "integrity": "sha512-74fNdUGrWsgIB/V9kTO5FGHPWYY6Eqn+3Z7L6Hc4e/BxjYV7puvBqp5HwsVYYfLm6iURYBNCx4Ut37OF9yitCw==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -3236,42 +2666,6 @@ "slash": "^3.0.0" }, "dependencies": { - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -3282,15 +2676,6 @@ "color-convert": "^2.0.1" } }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -3316,49 +2701,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -3367,15 +2721,6 @@ "requires": { "has-flag": "^4.0.0" } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } } } }, @@ -3943,55 +3288,608 @@ "path-is-absolute": "^1.0.0", "readdirp": "^2.2.1", "upath": "^1.1.1" - } - }, - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true - }, - "chrome-trace-event": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", - "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" }, "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "fsevents": { + "version": "1.2.12", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz", + "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1", + "node-pre-gyp": "*" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true + }, + "minipass": { + "version": "2.9.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.3.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.14.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + } + }, + "nopt": { + "version": "4.0.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.7.1", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.13", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.1.1", + "bundled": true, + "dev": true, + "optional": true + } + } + } + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { "is-descriptor": "^0.1.0" @@ -5910,18 +5808,6 @@ "jest-regex-util": "^25.2.6" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -5932,16 +5818,6 @@ "color-convert": "^2.0.1" } }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -5956,27 +5832,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, @@ -6520,877 +6375,326 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "fsevents": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz", - "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-own-enumerable-property-symbols": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", + "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==", + "dev": true + }, + "get-pkg-repo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", + "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", "dev": true, - "optional": true, "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1", - "node-pre-gyp": "*" + "hosted-git-info": "^2.1.4", + "meow": "^3.3.0", + "normalize-package-data": "^2.3.0", + "parse-github-repo-url": "^1.3.0", + "through2": "^2.0.0" }, "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { + "camelcase": { "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, - "optional": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" } }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, - "optional": true, "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, - "chownr": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true }, - "debug": { - "version": "3.2.6", - "bundled": true, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, - "optional": true, "requires": { - "ms": "^2.1.1" + "repeating": "^2.0.0" } }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.7", - "bundled": true, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, - "optional": true, "requires": { - "minipass": "^2.6.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true }, - "gauge": { - "version": "2.7.4", - "bundled": true, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, - "optional": true, "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" } }, - "glob": { - "version": "7.1.6", - "bundled": true, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, - "optional": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "error-ex": "^1.2.0" } }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, - "optional": true, "requires": { - "safer-buffer": ">= 2.1.2 < 3" + "pinkie-promise": "^2.0.0" } }, - "ignore-walk": { - "version": "3.0.3", - "bundled": true, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, - "optional": true, "requires": { - "minimatch": "^3.0.4" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, - "inflight": { - "version": "1.0.6", - "bundled": true, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, - "optional": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, - "inherits": { - "version": "2.0.4", - "bundled": true, - "dev": true, - "optional": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, - "optional": true, "requires": { - "number-is-nan": "^1.0.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, - "isarray": { + "redent": { "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, - "optional": true, "requires": { - "brace-expansion": "^1.1.7" + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" } }, - "minimist": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true - }, - "minipass": { - "version": "2.9.0", - "bundled": true, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, - "optional": true, "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" + "is-utf8": "^0.2.0" } }, - "minizlib": { - "version": "1.3.3", - "bundled": true, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, - "optional": true, "requires": { - "minipass": "^2.9.0" + "get-stdin": "^4.0.1" } }, - "mkdirp": { - "version": "0.5.3", - "bundled": true, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, - "optional": true, "requires": { - "minimist": "^1.2.5" + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" } }, - "ms": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.3", - "bundled": true, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + }, + "get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "git-config-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/git-config-path/-/git-config-path-1.0.1.tgz", + "integrity": "sha1-bTP37WPbDQ4RgTFQO6s6ykfVRmQ=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "fs-exists-sync": "^0.1.0", + "homedir-polyfill": "^1.0.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" + "is-extendable": "^0.1.0" } - }, - "node-pre-gyp": { - "version": "0.14.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4.4.2" - } - }, - "nopt": { - "version": "4.0.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - } - }, - "readable-stream": { - "version": "2.3.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.7.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.1", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.13", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "yallist": { - "version": "3.1.1", - "bundled": true, - "dev": true, - "optional": true } } }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "git-raw-commits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.3.tgz", + "integrity": "sha512-SoSsFL5lnixVzctGEi2uykjA7B5I0AhO9x6kdzvGRHbxsa6JSEgrgy1esRKsfOKE1cgyOJ/KDR2Trxu157sb8w==", + "dev": true, + "requires": { + "dargs": "^4.0.1", + "lodash.template": "^4.0.2", + "meow": "^5.0.0", + "split2": "^2.0.0", + "through2": "^3.0.0" + } }, - "get-own-enumerable-property-symbols": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", - "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==", - "dev": true + "git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", + "dev": true, + "requires": { + "gitconfiglocal": "^1.0.0", + "pify": "^2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } }, - "get-pkg-repo": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", - "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", + "git-semver-tags": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-3.0.1.tgz", + "integrity": "sha512-Hzd1MOHXouITfCasrpVJbRDg9uvW7LfABk3GQmXYZByerBDrfrEMP9HXpNT7RxAbieiocP6u+xq20DkvjwxnCA==", "dev": true, "requires": { - "hosted-git-info": "^2.1.4", - "meow": "^3.3.0", - "normalize-package-data": "^2.3.0", - "parse-github-repo-url": "^1.3.0", - "through2": "^2.0.0" + "meow": "^5.0.0", + "semver": "^6.0.0" }, "dependencies": { - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - } - } - }, - "get-stdin": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", - "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "git-config-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/git-config-path/-/git-config-path-1.0.1.tgz", - "integrity": "sha1-bTP37WPbDQ4RgTFQO6s6ykfVRmQ=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "fs-exists-sync": "^0.1.0", - "homedir-polyfill": "^1.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "git-raw-commits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.3.tgz", - "integrity": "sha512-SoSsFL5lnixVzctGEi2uykjA7B5I0AhO9x6kdzvGRHbxsa6JSEgrgy1esRKsfOKE1cgyOJ/KDR2Trxu157sb8w==", - "dev": true, - "requires": { - "dargs": "^4.0.1", - "lodash.template": "^4.0.2", - "meow": "^5.0.0", - "split2": "^2.0.0", - "through2": "^3.0.0" - } - }, - "git-remote-origin-url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", - "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", - "dev": true, - "requires": { - "gitconfiglocal": "^1.0.0", - "pify": "^2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "git-semver-tags": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-3.0.1.tgz", - "integrity": "sha512-Hzd1MOHXouITfCasrpVJbRDg9uvW7LfABk3GQmXYZByerBDrfrEMP9HXpNT7RxAbieiocP6u+xq20DkvjwxnCA==", - "dev": true, - "requires": { - "meow": "^5.0.0", - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -7502,15 +6806,16 @@ "optional": true }, "handlebars": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.4.tgz", - "integrity": "sha512-Is8+SzHv8K9STNadlBVpVhxXrSXxVgTyIvhdg2Qjak1SfSZ7iEozLHdwiX1jJ9lLFkcFJxqGK5s/cI7ZX+qGkQ==", + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", "dev": true, "requires": { + "minimist": "^1.2.5", "neo-async": "^2.6.0", "source-map": "^0.6.1", "uglify-js": "^3.1.4", - "yargs": "^15.3.1" + "wordwrap": "^1.0.0" }, "dependencies": { "source-map": { @@ -8421,632 +7726,42 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", - "dev": true, - "requires": { - "@babel/core": "^7.7.5", - "@babel/parser": "^7.7.5", - "@babel/template": "^7.7.4", - "@babel/traverse": "^7.7.4", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-Vm9xwCiQ8t2cNNnckyeAV0UdxKpcQUz4nMxsBvIu8n2kmPSiyb5uaF/8LpmKr+yqL/MdOXaX2Nmdo4Qyxium9Q==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", - "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", - "dev": true, - "requires": { - "@jest/core": "^25.2.7", - "import-local": "^3.0.2", - "jest-cli": "^25.2.7" - }, - "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-cli": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", - "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", - "dev": true, - "requires": { - "@jest/core": "^25.2.7", - "@jest/test-result": "^25.2.6", - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^25.2.7", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "prompts": "^2.0.1", - "realpath-native": "^2.0.0", - "yargs": "^15.3.1" - } - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-changed-files": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", - "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "execa": "^3.2.0", - "throat": "^5.0.0" - }, - "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "cross-spawn": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", - "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", - "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@babel/parser": "^7.7.5", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true } } }, - "jest-config": { - "version": "25.2.7", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", - "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^25.2.7", - "@jest/types": "^25.2.6", - "babel-jest": "^25.2.6", - "chalk": "^3.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "jest-environment-jsdom": "^25.2.6", - "jest-environment-node": "^25.2.6", - "jest-get-type": "^25.2.6", - "jest-jasmine2": "^25.2.7", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.2.6", - "jest-util": "^25.2.6", - "jest-validate": "^25.2.6", - "micromatch": "^4.0.2", - "pretty-format": "^25.2.6", - "realpath-native": "^2.0.0" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" }, "dependencies": { - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "babel-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.6.tgz", - "integrity": "sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ==", - "dev": true, - "requires": { - "@jest/transform": "^25.2.6", - "@jest/types": "^25.2.6", - "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^25.2.6", - "chalk": "^3.0.0", - "slash": "^3.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.6.tgz", - "integrity": "sha512-qE2xjMathybYxjiGFJg0mLFrz0qNp83aNZycWDY/SuHiZNq+vQfRQtuINqyXyue1ELd8Rd+1OhFSLjms8msMbw==", - "dev": true, - "requires": { - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-preset-jest": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz", - "integrity": "sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-bigint": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^25.2.6" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, "make-dir": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", @@ -9056,34 +7771,12 @@ "semver": "^6.0.0" } }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -9092,37 +7785,62 @@ "requires": { "has-flag": "^4.0.0" } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { - "is-number": "^7.0.0" + "ms": "^2.1.1" } }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, - "jest-diff": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", - "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", + "istanbul-reports": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", "dev": true, "requires": { - "chalk": "^3.0.0", - "diff-sequences": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.2.6" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest/-/jest-25.2.7.tgz", + "integrity": "sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA==", + "dev": true, + "requires": { + "@jest/core": "^25.2.7", + "import-local": "^3.0.2", + "jest-cli": "^25.2.7" }, "dependencies": { "ansi-styles": { @@ -9166,6 +7884,27 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "jest-cli": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.2.7.tgz", + "integrity": "sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw==", + "dev": true, + "requires": { + "@jest/core": "^25.2.7", + "@jest/test-result": "^25.2.6", + "@jest/types": "^25.2.6", + "chalk": "^3.0.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "is-ci": "^2.0.0", + "jest-config": "^25.2.7", + "jest-util": "^25.2.6", + "jest-validate": "^25.2.6", + "prompts": "^2.0.1", + "realpath-native": "^2.0.0", + "yargs": "^15.3.1" + } + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -9177,40 +7916,134 @@ } } }, - "jest-docblock": { + "jest-changed-files": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", - "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.2.6.tgz", + "integrity": "sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg==", "dev": true, "requires": { - "detect-newline": "^3.0.0" + "@jest/types": "^25.2.6", + "execa": "^3.2.0", + "throat": "^5.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } } }, - "jest-each": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", - "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", + "jest-config": { + "version": "25.2.7", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.2.7.tgz", + "integrity": "sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg==", "dev": true, "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^25.2.7", "@jest/types": "^25.2.6", + "babel-jest": "^25.2.6", "chalk": "^3.0.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "jest-environment-jsdom": "^25.2.6", + "jest-environment-node": "^25.2.6", "jest-get-type": "^25.2.6", + "jest-jasmine2": "^25.2.7", + "jest-regex-util": "^25.2.6", + "jest-resolve": "^25.2.6", "jest-util": "^25.2.6", - "pretty-format": "^25.2.6" + "jest-validate": "^25.2.6", + "micromatch": "^4.0.2", + "pretty-format": "^25.2.6", + "realpath-native": "^2.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9221,6 +8054,15 @@ "color-convert": "^2.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -9246,39 +8088,37 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "dev": true, "requires": { - "semver": "^6.0.0" + "braces": "^3.0.1", + "picomatch": "^2.0.5" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -9287,35 +8127,30 @@ "requires": { "has-flag": "^4.0.0" } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } } } }, - "jest-environment-jsdom": { + "jest-diff": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", - "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.2.6.tgz", + "integrity": "sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==", "dev": true, "requires": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", - "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", - "jest-util": "^25.2.6", - "jsdom": "^15.2.1" + "chalk": "^3.0.0", + "diff-sequences": "^25.2.6", + "jest-get-type": "^25.2.6", + "pretty-format": "^25.2.6" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9338,50 +8173,23 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "semver": "^6.0.0" + "color-name": "~1.1.4" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "supports-color": { @@ -9395,32 +8203,28 @@ } } }, - "jest-environment-node": { + "jest-docblock": { "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", - "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.2.6.tgz", + "integrity": "sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.2.6.tgz", + "integrity": "sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ==", "dev": true, "requires": { - "@jest/environment": "^25.2.6", - "@jest/fake-timers": "^25.2.6", "@jest/types": "^25.2.6", - "jest-mock": "^25.2.6", + "chalk": "^3.0.0", + "jest-get-type": "^25.2.6", "jest-util": "^25.2.6", - "semver": "^6.3.0" + "pretty-format": "^25.2.6" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -9462,33 +8266,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -9500,6 +8277,42 @@ } } }, + "jest-environment-jsdom": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz", + "integrity": "sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ==", + "dev": true, + "requires": { + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "jsdom": "^15.2.1" + } + }, + "jest-environment-node": { + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.2.6.tgz", + "integrity": "sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA==", + "dev": true, + "requires": { + "@jest/environment": "^25.2.6", + "@jest/fake-timers": "^25.2.6", + "@jest/types": "^25.2.6", + "jest-mock": "^25.2.6", + "jest-util": "^25.2.6", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "jest-get-type": { "version": "25.2.6", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", @@ -9526,28 +8339,6 @@ "which": "^2.0.2" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, "anymatch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", @@ -9567,31 +8358,6 @@ "fill-range": "^7.0.1" } }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -9608,12 +8374,6 @@ "dev": true, "optional": true }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -9630,15 +8390,6 @@ "picomatch": "^2.0.5" } }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -9684,181 +8435,54 @@ "throat": "^5.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-junit": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-10.0.0.tgz", - "integrity": "sha512-dbOVRyxHprdSpwSAR9/YshLwmnwf+RSl5hf0kCGlhAcEeZY9aRqo4oNmaT0tLC16Zy9D0zekDjWkjHGjXlglaQ==", - "dev": true, - "requires": { - "jest-validate": "^24.9.0", - "mkdirp": "^0.5.1", - "strip-ansi": "^5.2.0", - "uuid": "^3.3.3", - "xml": "^1.0.1" - }, - "dependencies": { - "@jest/types": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", - "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - } - }, - "@types/yargs": { - "version": "13.0.8", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", - "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "jest-get-type": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", - "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==", - "dev": true + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } }, - "jest-validate": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", - "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, - "pretty-format": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", - "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" + "color-name": "~1.1.4" } }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "has-flag": "^4.0.0" } } } @@ -9952,18 +8576,6 @@ "stack-utils": "^1.0.1" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -10072,70 +8684,6 @@ "dev": true, "requires": { "@jest/types": "^25.2.6" - }, - "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-pnp-resolver": { @@ -10164,18 +8712,6 @@ "resolve": "^1.15.1" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -10237,76 +8773,6 @@ "@jest/types": "^25.2.6", "jest-regex-util": "^25.2.6", "jest-snapshot": "^25.2.7" - }, - "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "jest-runner": { @@ -10336,171 +8802,45 @@ "throat": "^5.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" } }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "semver": "^6.0.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" + "color-name": "~1.1.4" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "supports-color": { @@ -10511,24 +8851,6 @@ "requires": { "has-flag": "^4.0.0" } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } } } }, @@ -10565,42 +8887,6 @@ "yargs": "^15.3.1" }, "dependencies": { - "@jest/transform": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.6.tgz", - "integrity": "sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.2.6", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.3", - "jest-haste-map": "^25.2.6", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.2.6", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - } - }, - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -10611,25 +8897,6 @@ "color-convert": "^2.0.1" } }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -10655,125 +8922,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "dev": true, - "optional": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "jest-haste-map": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.6.tgz", - "integrity": "sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.3", - "jest-serializer": "^25.2.6", - "jest-util": "^25.2.6", - "jest-worker": "^25.2.6", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - } - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "jest-serializer": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", - "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", - "dev": true - }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "jest-worker": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.6.tgz", - "integrity": "sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -10788,24 +8948,6 @@ "requires": { "has-flag": "^4.0.0" } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } } } }, @@ -10837,18 +8979,6 @@ "semver": "^6.3.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -10928,18 +9058,6 @@ "make-dir": "^3.0.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -11021,18 +9139,6 @@ "pretty-format": "^25.2.6" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -11105,18 +9211,6 @@ "string-length": "^3.1.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", @@ -11158,33 +9252,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "jest-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.6.tgz", - "integrity": "sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q==", - "dev": true, - "requires": { - "@jest/types": "^25.2.6", - "chalk": "^3.0.0", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -13157,9 +11224,9 @@ "dev": true }, "prettier": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz", - "integrity": "sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz", + "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==", "dev": true }, "prettier-linter-helpers": { @@ -13183,18 +11250,6 @@ "react-is": "^16.12.0" }, "dependencies": { - "@jest/types": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.6.tgz", - "integrity": "sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - } - }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -13211,16 +11266,6 @@ "color-convert": "^2.0.1" } }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -13235,21 +11280,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, @@ -15727,6 +13757,12 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "worker-farm": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", @@ -15822,12 +13858,6 @@ "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==", "dev": true }, - "xml": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", - "integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=", - "dev": true - }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", @@ -15927,9 +13957,9 @@ "dev": true }, "yargs-parser": { - "version": "18.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.1.tgz", - "integrity": "sha512-KRHEsOM16IX7XuLnMOqImcPNbLVXMNHYAoFc3BKR8Ortl5gzDbtXvvEoGx9imk5E+X1VeNKNlcHr8B8vi+7ipA==", + "version": "18.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.2.tgz", + "integrity": "sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ==", "dev": true, "requires": { "camelcase": "^5.0.0", diff --git a/package.json b/package.json index ca485a096..1cb22d91c 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "file-loader": "^6.0.0", "husky": "^4.2.3", "jest": "^25.2.7", - "jest-junit": "^10.0.0", "lint-staged": "^10.1.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.3", From fb5636d3e53057224e626d922dd6bad30dfa5cf7 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 14:50:18 +0300 Subject: [PATCH 10/87] ci: improve --- .github/workflows/nodejs.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6677c7965..a6f86ef79 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -63,8 +63,12 @@ jobs: with: node-version: ${{ matrix.node-version }} - # - name: Use latest NPM - # run: sudo npm i -g npm + - name: Set environment variables + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' + run: echo ::set-env name=MAYBE_NEED_SUDO::sudo + + - name: Use latest NPM + run: ${{ MAYBE_NEED_SUDO }} npm i -g npm - name: Install dependencies run: npm ci From 57b5bb681941a46496dff0a336f9eb02e8675025 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 14:53:35 +0300 Subject: [PATCH 11/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a6f86ef79..e5925c7ce 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -65,7 +65,7 @@ jobs: - name: Set environment variables if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: echo ::set-env name=MAYBE_NEED_SUDO::sudo + run: echo "::set-env name=MAYBE_NEED_SUDO::sudo" - name: Use latest NPM run: ${{ MAYBE_NEED_SUDO }} npm i -g npm From 3d96c8d73fa86af616cf20045d7ea805855d7918 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 14:54:57 +0300 Subject: [PATCH 12/87] ci: improve --- .github/workflows/nodejs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e5925c7ce..6172b2b3f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -65,10 +65,10 @@ jobs: - name: Set environment variables if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: echo "::set-env name=MAYBE_NEED_SUDO::sudo" + run: echo "::set-env name=SUDO::sudo" - name: Use latest NPM - run: ${{ MAYBE_NEED_SUDO }} npm i -g npm + run: ${{ SUDO }} npm i -g npm - name: Install dependencies run: npm ci From 489ed6558b81b62481f15f9ec582e21a6f05b159 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:03:05 +0300 Subject: [PATCH 13/87] ci: improve --- .github/workflows/nodejs.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6172b2b3f..891bd0e20 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -63,12 +63,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Set environment variables - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: echo "::set-env name=SUDO::sudo" - - name: Use latest NPM - run: ${{ SUDO }} npm i -g npm + run: sudo npm i -g npm - name: Install dependencies run: npm ci From e4b80eb98d6e59a234c42f84198591c134e590f2 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:15:41 +0300 Subject: [PATCH 14/87] ci: improve --- .github/workflows/nodejs.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 891bd0e20..3091f53ae 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -45,7 +45,7 @@ jobs: # uses: wagoid/commitlint-github-action@v1 test: - name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }} + name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} strategy: matrix: @@ -63,9 +63,14 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Use latest NPM + - name: Use latest NPM on ubuntu/macos + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' run: sudo npm i -g npm + - name: Use latest NPM in windows + if: matrix.os == 'windows-latest' + run: npm i -g npm + - name: Install dependencies run: npm ci @@ -79,4 +84,3 @@ jobs: uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - file: '**/junit.xml' From 0493ea086b09edcc41f3824613af43e2d564a9a3 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:22:03 +0300 Subject: [PATCH 15/87] ci: improve --- .github/workflows/nodejs.yml | 9 +++- package-lock.json | 93 ------------------------------------ package.json | 1 - 3 files changed, 7 insertions(+), 96 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 3091f53ae..7f43b0fec 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,6 +14,9 @@ jobs: linter: name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + strategy: matrix: os: [ubuntu-latest] @@ -23,6 +26,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Use Node.js ${{ env.node-version }} uses: actions/setup-node@v1 @@ -41,8 +46,8 @@ jobs: - name: Security audit run: npm run security - # - name: Check commit message - # uses: wagoid/commitlint-github-action@v1 + - name: Check commit message + uses: wagoid/commitlint-github-action@v1 test: name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} diff --git a/package-lock.json b/package-lock.json index 9a2a7701a..d264ae82d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4051,99 +4051,6 @@ "json-parser": "^1.0.0" } }, - "commitlint-azure-pipelines-cli": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/commitlint-azure-pipelines-cli/-/commitlint-azure-pipelines-cli-1.0.3.tgz", - "integrity": "sha512-ZS0Ansmu1c6MGncWdGIhQ0L3R3kJyX0ZVkMLG4GXeKx9aoVJudBJlfYztnsXwjpRFenFr8+Pd2xh3jM4Z4Etdg==", - "dev": true, - "requires": { - "execa": "^4.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", - "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.0.tgz", - "integrity": "sha512-JbDUxwV3BoT5ZVXQrSVbAiaXhXUkIwvbhPIwZ0N13kX+5yCzOhUNdocxB/UQRuYOHRYYwAxKYwJYc0T4D12pDA==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", diff --git a/package.json b/package.json index 1cb22d91c..2293ba447 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "@webpack-contrib/defaults": "^6.3.0", "@webpack-contrib/eslint-config-webpack": "^3.0.0", "babel-jest": "^25.2.6", - "commitlint-azure-pipelines-cli": "^1.0.3", "cross-env": "^7.0.2", "del": "^5.1.0", "del-cli": "^3.0.0", From 55e0a31aaa5b716145b832b8cb4a3fd0349717a6 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:26:56 +0300 Subject: [PATCH 16/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 7f43b0fec..b3b55202a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,7 +11,7 @@ on: - next jobs: - linter: + lint: name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} env: From dbb851cd3e48d4d58cae294c385f925c71e51d0a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:27:41 +0300 Subject: [PATCH 17/87] ci: improve --- .github/workflows/nodejs.yml | 80 ++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b3b55202a..5f0247a1e 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,51 +11,53 @@ on: - next jobs: - lint: - name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - strategy: - matrix: - os: [ubuntu-latest] - node-version: [12.x] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Use Node.js ${{ env.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.node-version }} - - - name: Use latest NPM - run: sudo npm i -g npm - - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run lint - - - name: Security audit - run: npm run security - - - name: Check commit message - uses: wagoid/commitlint-github-action@v1 + # lint: + # name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} + # + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # + # strategy: + # matrix: + # os: [ubuntu-latest] + # node-version: [12.x] + # + # runs-on: ${{ matrix.os }} + # + # steps: + # - uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + # + # - name: Use Node.js ${{ env.node-version }} + # uses: actions/setup-node@v1 + # with: + # node-version: ${{ env.node-version }} + # + # - name: Use latest NPM + # run: sudo npm i -g npm + # + # - name: Install dependencies + # run: npm ci + # + # - name: Lint + # run: npm run lint + # + # - name: Security audit + # run: npm run security + # + # - name: Check commit message + # uses: wagoid/commitlint-github-action@v1 test: name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [10.x, 12.x, 13.x] + # os: [ubuntu-latest, windows-latest, macos-latest] + os: [macos-latest] + # node-version: [10.x, 12.x, 13.x] + node-version: [13.x] webpack-version: [latest, next] runs-on: ${{ matrix.os }} From b0487fa75b4f775ab7ccaf5e5474fbfeef380fdf Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:31:27 +0300 Subject: [PATCH 18/87] ci: improve --- .github/workflows/nodejs.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 5f0247a1e..d80c3bfb2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -54,11 +54,12 @@ jobs: strategy: matrix: - # os: [ubuntu-latest, windows-latest, macos-latest] + # os: [ubuntu-latest, windows-latest, macos-latest] os: [macos-latest] - # node-version: [10.x, 12.x, 13.x] + # node-version: [10.x, 12.x, 13.x] node-version: [13.x] - webpack-version: [latest, next] + # webpack-version: [latest, next] + webpack-version: [latest] runs-on: ${{ matrix.os }} From f52b70f9d4460ad3769c0559b249438d073ec0b5 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 15:32:02 +0300 Subject: [PATCH 19/87] ci: improve --- test/middleware.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index b01c0a9b2..4539d7f4c 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -51,7 +51,7 @@ describe('middleware', () => { } } - describe('basic', () => { + describe.skip('basic', () => { describe('should work', () => { let compiler; let codeLength; From d22d600dec9caea6059008576c7a1882380545fa Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 16:42:02 +0300 Subject: [PATCH 20/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 665 ------ test/middleware.test.js | 2268 ++++++++++---------- 2 files changed, 1134 insertions(+), 1799 deletions(-) delete mode 100644 test/__snapshots__/middleware.test.js.snap diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap deleted file mode 100644 index c6de037ca..000000000 --- a/test/__snapshots__/middleware.test.js.snap +++ /dev/null @@ -1,665 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Child \\"broken\\": ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"broken\\": Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "Child \\"warning\\": WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"warning\\": Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"success\\": Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Entrypoint main = bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "X modules", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: -Error: Error in the \\"fs.mkdir\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: -Error: Error in the \\"fs.writeFile\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Error: Error in Watch method", - ], - ], -] -`; - -exports[`middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware logger should logging on successfully build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; diff --git a/test/middleware.test.js b/test/middleware.test.js index 4539d7f4c..271b25718 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -51,7 +51,7 @@ describe('middleware', () => { } } - describe.skip('basic', () => { + describe('basic', () => { describe('should work', () => { let compiler; let codeLength; @@ -790,1140 +790,1140 @@ describe('middleware', () => { } }); - describe('should respect the value of the "Content-Type" header from other middleware', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = express(); - app.use((req, res, next) => { - res.set('Content-Type', 'application/octet-stream'); - next(); - }); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should not guess a MIME type if the "Content-Type" header is found', (done) => { - request(app) - .get('/bundle.js') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should not throw an error on the valid "output.path" value for linux', () => { - it('should be no error', (done) => { - expect(() => { - const compiler = getCompiler(); - - compiler.outputPath = '/my/path'; - - instance = middleware(compiler); - - instance.close(done); - }).not.toThrow(); - }); - }); - - describe('should not throw an error on the valid "output.path" value for windows', () => { - it('should be no error', (done) => { - expect(() => { - const compiler = getCompiler(); - - compiler.outputPath = 'C:/my/path'; - - instance = middleware(compiler); - - instance.close(done); - }).not.toThrow(); - }); - }); - - describe('should work without "output" options', () => { - beforeAll((done) => { - // eslint-disable-next-line no-undefined - const compiler = getCompiler({ ...webpackConfig, output: undefined }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/main.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with trailing slash at the end of the "option.path" option', () => { - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/basic/'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect empty "output.publicPath" and "output.path" options', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options', () => { - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - publicPath: '/static/', - path: path.resolve(__dirname, './outputs/other-basic'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { - let hash; - - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - publicPath: isWebpack5() - ? '/static/[fullhash]/' - : '/static/[hash]/', - path: isWebpack5() - ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') - : path.resolve(__dirname, './outputs/other-basic-[hash]'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - hash = h; - done(); - }); - }); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get(`/static/${hash}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the public path', (done) => { - request(app) - .get(`/static/${hash}/`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get(`/static/${hash}/index.html`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { - let hashOne; - let hashTwo; - - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle.js', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/array-[fullhash]/static-one' - ) - : path.resolve(__dirname, './outputs/array-[hash]/static-one'), - publicPath: isWebpack5() - ? '/static-one/[fullhash]/' - : '/static-one/[hash]/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle.js', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/array-[fullhash]/static-two' - ) - : path.resolve(__dirname, './outputs/array-[hash]/static-two'), - publicPath: isWebpack5() - ? '/static-two/[fullhash]/' - : '/static-two/[hash]/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.done.tap('wdm-test', (params) => { - const [one, two] = params.stats; - - hashOne = one.hash; - hashTwo = two.hash; - - done(); - }); - }); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); - }); - - it('should return "200" code for GET request for the second bundle file', (done) => { - request(app) - .get(`/static-one/${hashOne}/`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get(`/static-one/${hashOne}/index.html`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); - }); - - it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/`).expect(404, done); - }); - - it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackMultiConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/static-one/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - request(app).get('/static-one/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - request(app) - .get('/static-one/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get('/static-one/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the second bundle file', (done) => { - request(app).get('/static-two/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - request(app).get('/static-two/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - request(app).get('/static-two/').expect(404, done); - }); - - it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - request(app).get('/static-two/index.html').expect(404, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/my-public/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/array/static-two'), - publicPath: '/my-public/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/my-public/bundle-one.js').expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get('/my-public/bundle-two.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/my-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path', (done) => { - request(app) - .get('/my-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/my-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/one-public/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/two-public/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/one-public/bundle-one.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { - request(app).get('/one-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - request(app) - .get('/one-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get('/one-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get('/two-public/bundle-two.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { - request(app).get('/two-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - request(app) - .get('/two-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - request(app) - .get('/two-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackClientServerConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { - beforeAll((done) => { - const compiler = getCompiler([ - webpackClientServerConfig[1], - webpackClientServerConfig[0], - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackClientServerConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/client-server/same'), - publicPath: '/static/', - }, - }, - { - ...webpackClientServerConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/client-server/same'), - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle-one.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app).get('/static/').expect(200, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect the "stats" option with the "false" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: false }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option with the "none" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'none' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option with the "minimal" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" requests to bundles file', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - }); - - describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - stats: { all: false, entrypoints: true }, - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to bundle files', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - - describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler( - webpackOneErrorOneWarningOneSuccessWithNamesConfig - ); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for "GET" requests to bundle files', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - }); - - describe('should throw an error on "run" when we watching', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging an error', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - return compiler.run((runError) => { - expect(() => { - throw runError; - }).toThrowErrorMatchingSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should throw an error on "watch" when we watching', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging an error', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - return compiler.watch({}, (watchError) => { - expect(() => { - throw watchError; - }).toThrowErrorMatchingSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should handle an earlier request if a change happened while compiling', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - let invalidated = false; - - compiler.hooks.done.tap('Invalidated', () => { - if (!invalidated) { - instance.invalidate(); - - invalidated = true; - } - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - }); + //describe('should respect the value of the "Content-Type" header from other middleware', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use((req, res, next) => { + // res.set('Content-Type', 'application/octet-stream'); + // next(); + // }); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should not guess a MIME type if the "Content-Type" header is found', (done) => { + // request(app) + // .get('/bundle.js') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + //}); + // + //describe('should not throw an error on the valid "output.path" value for linux', () => { + // it('should be no error', (done) => { + // expect(() => { + // const compiler = getCompiler(); + // + // compiler.outputPath = '/my/path'; + // + // instance = middleware(compiler); + // + // instance.close(done); + // }).not.toThrow(); + // }); + //}); + // + //describe('should not throw an error on the valid "output.path" value for windows', () => { + // it('should be no error', (done) => { + // expect(() => { + // const compiler = getCompiler(); + // + // compiler.outputPath = 'C:/my/path'; + // + // instance = middleware(compiler); + // + // instance.close(done); + // }).not.toThrow(); + // }); + //}); + // + //describe('should work without "output" options', () => { + // beforeAll((done) => { + // // eslint-disable-next-line no-undefined + // const compiler = getCompiler({ ...webpackConfig, output: undefined }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/main.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + //}); + // + //describe('should work with trailing slash at the end of the "option.path" option', () => { + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve(__dirname, './outputs/basic/'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + //}); + // + //describe('should respect empty "output.publicPath" and "output.path" options', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options', () => { + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // publicPath: '/static/', + // path: path.resolve(__dirname, './outputs/other-basic'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + // let hash; + // + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // publicPath: isWebpack5() + // ? '/static/[fullhash]/' + // : '/static/[hash]/', + // path: isWebpack5() + // ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') + // : path.resolve(__dirname, './outputs/other-basic-[hash]'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + // hash = h; + // done(); + // }); + // }); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get(`/static/${hash}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the public path', (done) => { + // request(app) + // .get(`/static/${hash}/`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get(`/static/${hash}/index.html`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + // let hashOne; + // let hashTwo; + // + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle.js', + // path: isWebpack5() + // ? path.resolve( + // __dirname, + // './outputs/array-[fullhash]/static-one' + // ) + // : path.resolve(__dirname, './outputs/array-[hash]/static-one'), + // publicPath: isWebpack5() + // ? '/static-one/[fullhash]/' + // : '/static-one/[hash]/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle.js', + // path: isWebpack5() + // ? path.resolve( + // __dirname, + // './outputs/array-[fullhash]/static-two' + // ) + // : path.resolve(__dirname, './outputs/array-[hash]/static-two'), + // publicPath: isWebpack5() + // ? '/static-two/[fullhash]/' + // : '/static-two/[hash]/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.done.tap('wdm-test', (params) => { + // const [one, two] = params.stats; + // + // hashOne = one.hash; + // hashTwo = two.hash; + // + // done(); + // }); + // }); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + // request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); + // }); + // + // it('should return "200" code for GET request for the second bundle file', (done) => { + // request(app) + // .get(`/static-one/${hashOne}/`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get(`/static-one/${hashOne}/index.html`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackMultiConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/static-one/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + // request(app).get('/static-one/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + // request(app) + // .get('/static-one/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get('/static-one/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the second bundle file', (done) => { + // request(app).get('/static-two/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + // request(app).get('/static-two/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + // request(app).get('/static-two/').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + // request(app).get('/static-two/index.html').expect(404, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/my-public/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/array/static-two'), + // publicPath: '/my-public/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/my-public/bundle-one.js').expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get('/my-public/bundle-two.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/my-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path', (done) => { + // request(app) + // .get('/my-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/my-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/one-public/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/two-public/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/one-public/bundle-one.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { + // request(app).get('/one-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + // request(app) + // .get('/one-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get('/one-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get('/two-public/bundle-two.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { + // request(app).get('/two-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + // request(app) + // .get('/two-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + // request(app) + // .get('/two-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackClientServerConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // webpackClientServerConfig[1], + // webpackClientServerConfig[0], + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + //}); + // + //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackClientServerConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/client-server/same'), + // publicPath: '/static/', + // }, + // }, + // { + // ...webpackClientServerConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/client-server/same'), + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle-one.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app).get('/static/').expect(200, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + //}); + // + //describe('should respect the "stats" option with the "false" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: false }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + //}); + // + //describe('should respect the "stats" option with the "none" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: 'none' }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + //}); + // + //describe('should respect the "stats" option with the "minimal" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + //}); + // + //describe('should respect the "stats" option in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" requests to bundles file', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // return request(app) + // .get('/static-three/bundle.js') + // .expect(200, (thirdError) => { + // if (thirdError) { + // return done(thirdError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // }); + //}); + // + //describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // stats: { all: false, entrypoints: true }, + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + //}); + // + //describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to bundle files', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + //}); + // + //describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler( + // webpackOneErrorOneWarningOneSuccessWithNamesConfig + // ); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for "GET" requests to bundle files', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // return request(app) + // .get('/static-three/bundle.js') + // .expect(200, (thirdError) => { + // if (thirdError) { + // return done(thirdError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // }); + //}); + // + //describe('should throw an error on "run" when we watching', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging an error', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // return compiler.run((runError) => { + // expect(() => { + // throw runError; + // }).toThrowErrorMatchingSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should throw an error on "watch" when we watching', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging an error', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // return compiler.watch({}, (watchError) => { + // expect(() => { + // throw watchError; + // }).toThrowErrorMatchingSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should handle an earlier request if a change happened while compiling', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // let invalidated = false; + // + // compiler.hooks.done.tap('Invalidated', () => { + // if (!invalidated) { + // instance.invalidate(); + // + // invalidated = true; + // } + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + //}); }); - describe('mimeTypes option', () => { +/* describe('mimeTypes option', () => { describe('should set the correct value for "Content-Type" header to known MIME type', () => { beforeAll((done) => { const outputPath = path.resolve(__dirname, './outputs/basic'); @@ -3563,5 +3563,5 @@ describe('middleware', () => { }); }); }); - }); + });*/ }); From e486e196f83d090747bc8a17a0d28a3abde697f9 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 16:54:09 +0300 Subject: [PATCH 21/87] ci: improve --- test/middleware.test.js | 2302 +++++++++++++++++++-------------------- 1 file changed, 1151 insertions(+), 1151 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 271b25718..b083dfcb2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -373,7 +373,7 @@ describe('middleware', () => { }); }); - describe('should work with difference requests', () => { + /* describe('should work with difference requests', () => { const basicOutputPath = path.resolve(__dirname, './outputs/basic'); const fixtures = [ { @@ -788,1142 +788,1142 @@ describe('middleware', () => { } }); } - }); + });*/ + + /*describe('should respect the value of the "Content-Type" header from other middleware', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + app = express(); + app.use((req, res, next) => { + res.set('Content-Type', 'application/octet-stream'); + next(); + }); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should not guess a MIME type if the "Content-Type" header is found', (done) => { + request(app) + .get('/bundle.js') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + });*/ + + /*describe('should not throw an error on the valid "output.path" value for linux', () => { + it('should be no error', (done) => { + expect(() => { + const compiler = getCompiler(); + + compiler.outputPath = '/my/path'; + + instance = middleware(compiler); + + instance.close(done); + }).not.toThrow(); + }); + });*/ + + /*describe('should not throw an error on the valid "output.path" value for windows', () => { + it('should be no error', (done) => { + expect(() => { + const compiler = getCompiler(); + + compiler.outputPath = 'C:/my/path'; + + instance = middleware(compiler); + + instance.close(done); + }).not.toThrow(); + }); + });*/ + + /*describe('should work without "output" options', () => { + beforeAll((done) => { + // eslint-disable-next-line no-undefined + const compiler = getCompiler({ ...webpackConfig, output: undefined }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/main.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + });*/ + + /*describe('should work with trailing slash at the end of the "option.path" option', () => { + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/basic/'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + });*/ + + /*describe('should respect empty "output.publicPath" and "output.path" options', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options', () => { + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + publicPath: '/static/', + path: path.resolve(__dirname, './outputs/other-basic'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + let hash; + + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + publicPath: isWebpack5() + ? '/static/[fullhash]/' + : '/static/[hash]/', + path: isWebpack5() + ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') + : path.resolve(__dirname, './outputs/other-basic-[hash]'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get(`/static/${hash}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the public path', (done) => { + request(app) + .get(`/static/${hash}/`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get(`/static/${hash}/index.html`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + let hashOne; + let hashTwo; + + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle.js', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/array-[fullhash]/static-one' + ) + : path.resolve(__dirname, './outputs/array-[hash]/static-one'), + publicPath: isWebpack5() + ? '/static-one/[fullhash]/' + : '/static-one/[hash]/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle.js', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/array-[fullhash]/static-two' + ) + : path.resolve(__dirname, './outputs/array-[hash]/static-two'), + publicPath: isWebpack5() + ? '/static-two/[fullhash]/' + : '/static-two/[hash]/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.done.tap('wdm-test', (params) => { + const [one, two] = params.stats; + + hashOne = one.hash; + hashTwo = two.hash; + + done(); + }); + }); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); + }); + + it('should return "200" code for GET request for the second bundle file', (done) => { + request(app) + .get(`/static-one/${hashOne}/`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get(`/static-one/${hashOne}/index.html`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); + }); + + it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/`).expect(404, done); + }); + + it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackMultiConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/static-one/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + request(app).get('/static-one/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + request(app) + .get('/static-one/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get('/static-one/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the second bundle file', (done) => { + request(app).get('/static-two/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + request(app).get('/static-two/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + request(app).get('/static-two/').expect(404, done); + }); + + it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + request(app).get('/static-two/index.html').expect(404, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/my-public/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/array/static-two'), + publicPath: '/my-public/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/my-public/bundle-one.js').expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get('/my-public/bundle-two.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/my-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path', (done) => { + request(app) + .get('/my-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/my-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/one-public/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/two-public/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/one-public/bundle-one.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { + request(app).get('/one-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + request(app) + .get('/one-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get('/one-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get('/two-public/bundle-two.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { + request(app).get('/two-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + request(app) + .get('/two-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + request(app) + .get('/two-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackClientServerConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { + beforeAll((done) => { + const compiler = getCompiler([ + webpackClientServerConfig[1], + webpackClientServerConfig[0], + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + });*/ + + /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackClientServerConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/client-server/same'), + publicPath: '/static/', + }, + }, + { + ...webpackClientServerConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/client-server/same'), + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle-one.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app).get('/static/').expect(200, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + });*/ + + /*describe('should respect the "stats" option with the "false" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: false }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + });*/ + + /*describe('should respect the "stats" option with the "none" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: 'none' }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + });*/ + + /*describe('should respect the "stats" option with the "minimal" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); - //describe('should respect the value of the "Content-Type" header from other middleware', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use((req, res, next) => { - // res.set('Content-Type', 'application/octet-stream'); - // next(); - // }); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should not guess a MIME type if the "Content-Type" header is found', (done) => { - // request(app) - // .get('/bundle.js') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - //}); - // - //describe('should not throw an error on the valid "output.path" value for linux', () => { - // it('should be no error', (done) => { - // expect(() => { - // const compiler = getCompiler(); - // - // compiler.outputPath = '/my/path'; - // - // instance = middleware(compiler); - // - // instance.close(done); - // }).not.toThrow(); - // }); - //}); - // - //describe('should not throw an error on the valid "output.path" value for windows', () => { - // it('should be no error', (done) => { - // expect(() => { - // const compiler = getCompiler(); - // - // compiler.outputPath = 'C:/my/path'; - // - // instance = middleware(compiler); - // - // instance.close(done); - // }).not.toThrow(); - // }); - //}); - // - //describe('should work without "output" options', () => { - // beforeAll((done) => { - // // eslint-disable-next-line no-undefined - // const compiler = getCompiler({ ...webpackConfig, output: undefined }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/main.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - //}); - // - //describe('should work with trailing slash at the end of the "option.path" option', () => { - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve(__dirname, './outputs/basic/'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - //}); - // - //describe('should respect empty "output.publicPath" and "output.path" options', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options', () => { - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // publicPath: '/static/', - // path: path.resolve(__dirname, './outputs/other-basic'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { - // let hash; - // - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // publicPath: isWebpack5() - // ? '/static/[fullhash]/' - // : '/static/[hash]/', - // path: isWebpack5() - // ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') - // : path.resolve(__dirname, './outputs/other-basic-[hash]'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - // hash = h; - // done(); - // }); - // }); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get(`/static/${hash}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the public path', (done) => { - // request(app) - // .get(`/static/${hash}/`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get(`/static/${hash}/index.html`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { - // let hashOne; - // let hashTwo; - // - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle.js', - // path: isWebpack5() - // ? path.resolve( - // __dirname, - // './outputs/array-[fullhash]/static-one' - // ) - // : path.resolve(__dirname, './outputs/array-[hash]/static-one'), - // publicPath: isWebpack5() - // ? '/static-one/[fullhash]/' - // : '/static-one/[hash]/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle.js', - // path: isWebpack5() - // ? path.resolve( - // __dirname, - // './outputs/array-[fullhash]/static-two' - // ) - // : path.resolve(__dirname, './outputs/array-[hash]/static-two'), - // publicPath: isWebpack5() - // ? '/static-two/[fullhash]/' - // : '/static-two/[hash]/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.done.tap('wdm-test', (params) => { - // const [one, two] = params.stats; - // - // hashOne = one.hash; - // hashTwo = two.hash; - // - // done(); - // }); - // }); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - // request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); - // }); - // - // it('should return "200" code for GET request for the second bundle file', (done) => { - // request(app) - // .get(`/static-one/${hashOne}/`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get(`/static-one/${hashOne}/index.html`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackMultiConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/static-one/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - // request(app).get('/static-one/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - // request(app) - // .get('/static-one/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get('/static-one/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the second bundle file', (done) => { - // request(app).get('/static-two/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - // request(app).get('/static-two/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - // request(app).get('/static-two/').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - // request(app).get('/static-two/index.html').expect(404, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/my-public/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/array/static-two'), - // publicPath: '/my-public/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/my-public/bundle-one.js').expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get('/my-public/bundle-two.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/my-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path', (done) => { - // request(app) - // .get('/my-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/my-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/one-public/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/two-public/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/one-public/bundle-one.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { - // request(app).get('/one-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - // request(app) - // .get('/one-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get('/one-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get('/two-public/bundle-two.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { - // request(app).get('/two-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - // request(app) - // .get('/two-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - // request(app) - // .get('/two-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackClientServerConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // webpackClientServerConfig[1], - // webpackClientServerConfig[0], - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - //}); - // - //describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackClientServerConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/client-server/same'), - // publicPath: '/static/', - // }, - // }, - // { - // ...webpackClientServerConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/client-server/same'), - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle-one.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app).get('/static/').expect(200, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - //}); - // - //describe('should respect the "stats" option with the "false" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: false }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - //}); - // - //describe('should respect the "stats" option with the "none" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: 'none' }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - //}); - // - //describe('should respect the "stats" option with the "minimal" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - //}); - // - //describe('should respect the "stats" option in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" requests to bundles file', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // return request(app) - // .get('/static-three/bundle.js') - // .expect(200, (thirdError) => { - // if (thirdError) { - // return done(thirdError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // }); - //}); - // - //describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // stats: { all: false, entrypoints: true }, - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - //}); - // - //describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to bundle files', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - //}); - // - //describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler( - // webpackOneErrorOneWarningOneSuccessWithNamesConfig - // ); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for "GET" requests to bundle files', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // return request(app) - // .get('/static-three/bundle.js') - // .expect(200, (thirdError) => { - // if (thirdError) { - // return done(thirdError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // }); - //}); - // - //describe('should throw an error on "run" when we watching', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging an error', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // return compiler.run((runError) => { - // expect(() => { - // throw runError; - // }).toThrowErrorMatchingSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should throw an error on "watch" when we watching', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging an error', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // return compiler.watch({}, (watchError) => { - // expect(() => { - // throw watchError; - // }).toThrowErrorMatchingSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should handle an earlier request if a change happened while compiling', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // let invalidated = false; - // - // compiler.hooks.done.tap('Invalidated', () => { - // if (!invalidated) { - // instance.invalidate(); - // - // invalidated = true; - // } - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - //}); + return done(); + }); + }); + });*/ + + /*describe('should respect the "stats" option in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" requests to bundles file', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + return request(app) + .get('/static-three/bundle.js') + .expect(200, (thirdError) => { + if (thirdError) { + return done(thirdError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + }); + });*/ + + /*describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + stats: { all: false, entrypoints: true }, + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + });*/ + + /*describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to bundle files', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + });*/ + + /*describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler( + webpackOneErrorOneWarningOneSuccessWithNamesConfig + ); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for "GET" requests to bundle files', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + return request(app) + .get('/static-three/bundle.js') + .expect(200, (thirdError) => { + if (thirdError) { + return done(thirdError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + }); + });*/ + + /*describe('should throw an error on "run" when we watching', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging an error', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + return compiler.run((runError) => { + expect(() => { + throw runError; + }).toThrowErrorMatchingSnapshot(); + + done(); + }); + }); + }); + });*/ + + /*describe('should throw an error on "watch" when we watching', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging an error', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + return compiler.watch({}, (watchError) => { + expect(() => { + throw watchError; + }).toThrowErrorMatchingSnapshot(); + + done(); + }); + }); + }); + });*/ + + /*describe('should handle an earlier request if a change happened while compiling', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + let invalidated = false; + + compiler.hooks.done.tap('Invalidated', () => { + if (!invalidated) { + instance.invalidate(); + + invalidated = true; + } + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + });*/ }); -/* describe('mimeTypes option', () => { + describe('mimeTypes option', () => { describe('should set the correct value for "Content-Type" header to known MIME type', () => { beforeAll((done) => { const outputPath = path.resolve(__dirname, './outputs/basic'); @@ -2040,7 +2040,7 @@ describe('middleware', () => { }); }); - describe('watchOptions option', () => { + /*describe('watchOptions option', () => { describe('should work without value', () => { let compiler; let spy; @@ -2171,9 +2171,9 @@ describe('middleware', () => { }); }); }); - }); + });*/ - describe('writeToDisk option', () => { + /*describe('writeToDisk option', () => { describe('should work with "true" value', () => { let compiler; @@ -2605,9 +2605,9 @@ describe('middleware', () => { }); }); }); - }); + });*/ - describe('methods option', () => { + /*describe('methods option', () => { let compiler; beforeAll((done) => { @@ -2637,9 +2637,9 @@ describe('middleware', () => { it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { request(app).head('/public/bundle.js').expect(404, done); }); - }); + });*/ - describe('headers option', () => { + /*describe('headers option', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -2662,9 +2662,9 @@ describe('middleware', () => { .expect('X-nonsense-2', 'no') .expect(200, done); }); - }); + });*/ - describe('publicPath option', () => { + /*describe('publicPath option', () => { describe('should work with "string" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -2683,9 +2683,9 @@ describe('middleware', () => { request(app).get('/public/bundle.js').expect(200, done); }); }); - }); + });*/ - describe('serverSideRender option', () => { + /*describe('serverSideRender option', () => { let locals; beforeAll((done) => { @@ -2720,9 +2720,9 @@ describe('middleware', () => { return done(); }); }); - }); + });*/ - describe('outputFileSystem option', () => { + /*describe('outputFileSystem option', () => { describe('should work with an unspecified value', () => { let compiler; @@ -2885,9 +2885,9 @@ describe('middleware', () => { ); }); }); - }); + });*/ - describe('index option', () => { + /*describe('index option', () => { describe('should work with "false" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -3179,9 +3179,9 @@ describe('middleware', () => { request(app).get('/').expect(404, done); }); }); - }); + });*/ - describe('logger', () => { + /*describe('logger', () => { describe('should logging on successfully build', () => { let compiler; let getLogsPlugin; From 21e498acc1f673894627385d2cd7a99f983c90ec Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 16:59:46 +0300 Subject: [PATCH 22/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- test/middleware.test.js | 236 +++++++++++++++++------------------ 2 files changed, 119 insertions(+), 119 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d80c3bfb2..6babf05c3 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -86,7 +86,7 @@ jobs: run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: npm run test:coverage -- --ci + run: npm run test:coverage -- --ci --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/middleware.test.js b/test/middleware.test.js index b083dfcb2..c75ed7256 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -1923,122 +1923,122 @@ describe('middleware', () => { });*/ }); - describe('mimeTypes option', () => { - describe('should set the correct value for "Content-Type" header to known MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.html'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to "file.html"', (done) => { - request(app) - .get('/file.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); - }); - }); - - describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.phtml'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to "file.html"', (done) => { - request(app) - .get('/file.phtml') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should set the correct value for "Content-Type" header to specified MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - mimeTypes: { - phtml: 'text/html', - }, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.phtml'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request "file.html"', (done) => { - request(app) - .get('/file.phtml') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); - }); - }); - }); + //describe('mimeTypes option', () => { + // describe('should set the correct value for "Content-Type" header to known MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.html'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to "file.html"', (done) => { + // request(app) + // .get('/file.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, 'welcome', done); + // }); + // }); + // + // describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.phtml'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to "file.html"', (done) => { + // request(app) + // .get('/file.phtml') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should set the correct value for "Content-Type" header to specified MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // mimeTypes: { + // phtml: 'text/html', + // }, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.phtml'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request "file.html"', (done) => { + // request(app) + // .get('/file.phtml') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, 'welcome', done); + // }); + // }); + //}); /*describe('watchOptions option', () => { describe('should work without value', () => { @@ -2639,7 +2639,7 @@ describe('middleware', () => { }); });*/ - /*describe('headers option', () => { + describe('headers option', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -2662,7 +2662,7 @@ describe('middleware', () => { .expect('X-nonsense-2', 'no') .expect(200, done); }); - });*/ + }); /*describe('publicPath option', () => { describe('should work with "string" value', () => { From 3cfce58a2c8f7aea3926875070dc46b6979659fb Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:08:48 +0300 Subject: [PATCH 23/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- test/middleware.test.js | 370 +++++++++++++++++------------------ 2 files changed, 186 insertions(+), 186 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6babf05c3..ea5f18297 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -86,7 +86,7 @@ jobs: run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: npm run test:coverage -- --ci --verbose + run: npm run test:coverage -- --ci --verbose --forceExit - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/middleware.test.js b/test/middleware.test.js index c75ed7256..b01c0a9b2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -373,7 +373,7 @@ describe('middleware', () => { }); }); - /* describe('should work with difference requests', () => { + describe('should work with difference requests', () => { const basicOutputPath = path.resolve(__dirname, './outputs/basic'); const fixtures = [ { @@ -788,9 +788,9 @@ describe('middleware', () => { } }); } - });*/ + }); - /*describe('should respect the value of the "Content-Type" header from other middleware', () => { + describe('should respect the value of the "Content-Type" header from other middleware', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -814,9 +814,9 @@ describe('middleware', () => { .expect('Content-Type', 'application/octet-stream') .expect(200, done); }); - });*/ + }); - /*describe('should not throw an error on the valid "output.path" value for linux', () => { + describe('should not throw an error on the valid "output.path" value for linux', () => { it('should be no error', (done) => { expect(() => { const compiler = getCompiler(); @@ -828,9 +828,9 @@ describe('middleware', () => { instance.close(done); }).not.toThrow(); }); - });*/ + }); - /*describe('should not throw an error on the valid "output.path" value for windows', () => { + describe('should not throw an error on the valid "output.path" value for windows', () => { it('should be no error', (done) => { expect(() => { const compiler = getCompiler(); @@ -842,9 +842,9 @@ describe('middleware', () => { instance.close(done); }).not.toThrow(); }); - });*/ + }); - /*describe('should work without "output" options', () => { + describe('should work without "output" options', () => { beforeAll((done) => { // eslint-disable-next-line no-undefined const compiler = getCompiler({ ...webpackConfig, output: undefined }); @@ -880,9 +880,9 @@ describe('middleware', () => { .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); - });*/ + }); - /*describe('should work with trailing slash at the end of the "option.path" option', () => { + describe('should work with trailing slash at the end of the "option.path" option', () => { beforeAll((done) => { const compiler = getCompiler({ ...webpackConfig, @@ -923,9 +923,9 @@ describe('middleware', () => { .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); - });*/ + }); - /*describe('should respect empty "output.publicPath" and "output.path" options', () => { + describe('should respect empty "output.publicPath" and "output.path" options', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -960,9 +960,9 @@ describe('middleware', () => { .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options', () => { + describe('should respect "output.publicPath" and "output.path" options', () => { beforeAll((done) => { const compiler = getCompiler({ ...webpackConfig, @@ -1011,9 +1011,9 @@ describe('middleware', () => { .expect('Content-Type', 'text/html; charset=utf-8') .expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { let hash; beforeAll((done) => { @@ -1070,9 +1070,9 @@ describe('middleware', () => { it('should return "404" code for GET request to the non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { let hashOne; let hashTwo; @@ -1170,9 +1170,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { beforeAll((done) => { const compiler = getCompiler(webpackMultiConfig); @@ -1231,9 +1231,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { beforeAll((done) => { const compiler = getCompiler([ { @@ -1297,9 +1297,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { beforeAll((done) => { const compiler = getCompiler([ { @@ -1381,9 +1381,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { beforeAll((done) => { const compiler = getCompiler(webpackClientServerConfig); @@ -1422,9 +1422,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { beforeAll((done) => { const compiler = getCompiler([ webpackClientServerConfig[1], @@ -1466,9 +1466,9 @@ describe('middleware', () => { it('should return "404" code for GET request to non-public path', (done) => { request(app).get('/').expect(404, done); }); - });*/ + }); - /*describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { beforeAll((done) => { const compiler = getCompiler([ { @@ -1523,9 +1523,9 @@ describe('middleware', () => { .expect('Content-Type', 'text/html; charset=utf-8') .expect(200, done); }); - });*/ + }); - /*describe('should respect the "stats" option with the "false" value from the configuration', () => { + describe('should respect the "stats" option with the "false" value from the configuration', () => { let compiler; let getLogsPlugin; @@ -1558,9 +1558,9 @@ describe('middleware', () => { return done(); }); }); - });*/ + }); - /*describe('should respect the "stats" option with the "none" value from the configuration', () => { + describe('should respect the "stats" option with the "none" value from the configuration', () => { let compiler; let getLogsPlugin; @@ -1593,9 +1593,9 @@ describe('middleware', () => { return done(); }); }); - });*/ + }); - /*describe('should respect the "stats" option with the "minimal" value from the configuration', () => { + describe('should respect the "stats" option with the "minimal" value from the configuration', () => { let compiler; let getLogsPlugin; @@ -1628,9 +1628,9 @@ describe('middleware', () => { return done(); }); }); - });*/ + }); - /*describe('should respect the "stats" option in multi-compiler mode', () => { + describe('should respect the "stats" option in multi-compiler mode', () => { let compiler; let getLogsPlugin; @@ -1679,9 +1679,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { let compiler; let getLogsPlugin; @@ -1717,9 +1717,9 @@ describe('middleware', () => { return done(); }); }); - });*/ + }); - /*describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { let compiler; let getLogsPlugin; @@ -1760,9 +1760,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { let compiler; let getLogsPlugin; @@ -1813,9 +1813,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('should throw an error on "run" when we watching', () => { + describe('should throw an error on "run" when we watching', () => { let compiler; let getLogsPlugin; @@ -1852,9 +1852,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('should throw an error on "watch" when we watching', () => { + describe('should throw an error on "watch" when we watching', () => { let compiler; let getLogsPlugin; @@ -1891,9 +1891,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('should handle an earlier request if a change happened while compiling', () => { + describe('should handle an earlier request if a change happened while compiling', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -1920,127 +1920,127 @@ describe('middleware', () => { it('should return the "200" code for the "GET" request to the bundle file', (done) => { request(app).get('/bundle.js').expect(200, done); }); - });*/ + }); + }); + + describe('mimeTypes option', () => { + describe('should set the correct value for "Content-Type" header to known MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.html'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to "file.html"', (done) => { + request(app) + .get('/file.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); + }); + }); + + describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.phtml'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to "file.html"', (done) => { + request(app) + .get('/file.phtml') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + }); + + describe('should set the correct value for "Content-Type" header to specified MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler, { + mimeTypes: { + phtml: 'text/html', + }, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.phtml'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request "file.html"', (done) => { + request(app) + .get('/file.phtml') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); + }); + }); }); - //describe('mimeTypes option', () => { - // describe('should set the correct value for "Content-Type" header to known MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.html'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to "file.html"', (done) => { - // request(app) - // .get('/file.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, 'welcome', done); - // }); - // }); - // - // describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.phtml'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to "file.html"', (done) => { - // request(app) - // .get('/file.phtml') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should set the correct value for "Content-Type" header to specified MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // mimeTypes: { - // phtml: 'text/html', - // }, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.phtml'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request "file.html"', (done) => { - // request(app) - // .get('/file.phtml') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, 'welcome', done); - // }); - // }); - //}); - - /*describe('watchOptions option', () => { + describe('watchOptions option', () => { describe('should work without value', () => { let compiler; let spy; @@ -2171,9 +2171,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('writeToDisk option', () => { + describe('writeToDisk option', () => { describe('should work with "true" value', () => { let compiler; @@ -2605,9 +2605,9 @@ describe('middleware', () => { }); }); }); - });*/ + }); - /*describe('methods option', () => { + describe('methods option', () => { let compiler; beforeAll((done) => { @@ -2637,7 +2637,7 @@ describe('middleware', () => { it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { request(app).head('/public/bundle.js').expect(404, done); }); - });*/ + }); describe('headers option', () => { beforeAll((done) => { @@ -2664,7 +2664,7 @@ describe('middleware', () => { }); }); - /*describe('publicPath option', () => { + describe('publicPath option', () => { describe('should work with "string" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -2683,9 +2683,9 @@ describe('middleware', () => { request(app).get('/public/bundle.js').expect(200, done); }); }); - });*/ + }); - /*describe('serverSideRender option', () => { + describe('serverSideRender option', () => { let locals; beforeAll((done) => { @@ -2720,9 +2720,9 @@ describe('middleware', () => { return done(); }); }); - });*/ + }); - /*describe('outputFileSystem option', () => { + describe('outputFileSystem option', () => { describe('should work with an unspecified value', () => { let compiler; @@ -2885,9 +2885,9 @@ describe('middleware', () => { ); }); }); - });*/ + }); - /*describe('index option', () => { + describe('index option', () => { describe('should work with "false" value', () => { beforeAll((done) => { const compiler = getCompiler(webpackConfig); @@ -3179,9 +3179,9 @@ describe('middleware', () => { request(app).get('/').expect(404, done); }); }); - });*/ + }); - /*describe('logger', () => { + describe('logger', () => { describe('should logging on successfully build', () => { let compiler; let getLogsPlugin; @@ -3563,5 +3563,5 @@ describe('middleware', () => { }); }); }); - });*/ + }); }); From ebc4db4f8e7034625e3b72149255ad15de53a778 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:12:43 +0300 Subject: [PATCH 24/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 665 +++++++++++++++++++++ 1 file changed, 665 insertions(+) create mode 100644 test/__snapshots__/middleware.test.js.snap diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap new file mode 100644 index 000000000..c6de037ca --- /dev/null +++ b/test/__snapshots__/middleware.test.js.snap @@ -0,0 +1,665 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Child \\"broken\\": ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"broken\\": Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "Child \\"warning\\": WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"warning\\": Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"success\\": Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Entrypoint main = bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "X modules", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; + +exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; + +exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: +Error: Error in the \\"fs.mkdir\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: +Error: Error in the \\"fs.writeFile\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Error: Error in Watch method", + ], + ], +] +`; + +exports[`middleware logger should logging an warning should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + +exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware logger should logging on successfully build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; From a2a78eacfbbfce891fd386bffff42614e2f3307b Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:16:55 +0300 Subject: [PATCH 25/87] ci: improve --- .github/workflows/nodejs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index ea5f18297..1b1f9b448 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -86,8 +86,9 @@ jobs: run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: npm run test:coverage -- --ci --verbose --forceExit + run: node_modules/.bin/jest test/middleware.test.js -u --verbose + # run: npm run test:coverage -- --ci - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 with: From 2ad103b2092fbb09f0d91447b7943c8cbe0d1e79 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:21:28 +0300 Subject: [PATCH 26/87] ci: improve --- .github/workflows/nodejs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 1b1f9b448..fe41744b1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -80,7 +80,9 @@ jobs: run: npm i -g npm - name: Install dependencies - run: npm ci + run: | + npm ci + npm rebuild - name: Install webpack ${{ matrix.webpack-version }} run: npm i webpack@${{ matrix.webpack-version }} From e2eed1b87ee74ff81e70f558f490783a671d4c2e Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:29:12 +0300 Subject: [PATCH 27/87] ci: improve --- .github/workflows/nodejs.yml | 3 +++ package-lock.json | 17 ++++++++++++----- package.json | 1 + test/middleware.test.js | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index fe41744b1..8f23f9648 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -90,6 +90,9 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} run: node_modules/.bin/jest test/middleware.test.js -u --verbose + - name: Cat + run: cat crash.log + # run: npm run test:coverage -- --ci - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/package-lock.json b/package-lock.json index d264ae82d..eb553a12a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2896,7 +2896,6 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, - "optional": true, "requires": { "file-uri-to-path": "1.0.0" } @@ -6048,8 +6047,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true + "dev": true }, "fill-range": { "version": "4.0.0", @@ -10398,8 +10396,7 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true + "dev": true }, "nanomatch": { "version": "1.2.13", @@ -11913,6 +11910,16 @@ "ajv-keywords": "^3.4.1" } }, + "segfault-handler": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/segfault-handler/-/segfault-handler-1.3.0.tgz", + "integrity": "sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg==", + "dev": true, + "requires": { + "bindings": "^1.2.1", + "nan": "^2.14.0" + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index 2293ba447..92ff24d46 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "lint-staged": "^10.1.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.3", + "segfault-handler": "^1.3.0", "standard-version": "^7.1.0", "supertest": "^4.0.2", "webpack": "^4.42.1" diff --git a/test/middleware.test.js b/test/middleware.test.js index b01c0a9b2..0b940550f 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -26,6 +26,10 @@ import webpackMultiWarningConfig from './fixtures/webpack.array.warning.config'; import webpackOneErrorOneWarningOneSuccessConfig from './fixtures/webpack.array.one-error-one-warning-one-success'; import webpackOneErrorOneWarningOneSuccessWithNamesConfig from './fixtures/webpack.array.one-error-one-warning-one-success-with-names'; +const SegfaultHandler = require('segfault-handler'); + +SegfaultHandler.registerHandler('crash.log'); + describe('middleware', () => { let instance; let listen; From f85e33b452cd07d3f37094703d146fe4d8d4ba42 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:42:03 +0300 Subject: [PATCH 28/87] ci: improve --- .github/workflows/nodejs.yml | 13 +++++-------- package-lock.json | 17 +++++------------ package.json | 1 - test/middleware.test.js | 4 ---- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8f23f9648..a55a8d2fb 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -80,20 +80,17 @@ jobs: run: npm i -g npm - name: Install dependencies - run: | - npm ci - npm rebuild + run: npm ci - name: Install webpack ${{ matrix.webpack-version }} run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: node_modules/.bin/jest test/middleware.test.js -u --verbose - - - name: Cat - run: cat crash.log - # run: npm run test:coverage -- --ci + run: | + node --version + node_modules/.bin/jest test/middleware.test.js -u + - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 with: diff --git a/package-lock.json b/package-lock.json index eb553a12a..d264ae82d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2896,6 +2896,7 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, + "optional": true, "requires": { "file-uri-to-path": "1.0.0" } @@ -6047,7 +6048,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true + "dev": true, + "optional": true }, "fill-range": { "version": "4.0.0", @@ -10396,7 +10398,8 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true + "dev": true, + "optional": true }, "nanomatch": { "version": "1.2.13", @@ -11910,16 +11913,6 @@ "ajv-keywords": "^3.4.1" } }, - "segfault-handler": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/segfault-handler/-/segfault-handler-1.3.0.tgz", - "integrity": "sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg==", - "dev": true, - "requires": { - "bindings": "^1.2.1", - "nan": "^2.14.0" - } - }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index 92ff24d46..2293ba447 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "lint-staged": "^10.1.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.3", - "segfault-handler": "^1.3.0", "standard-version": "^7.1.0", "supertest": "^4.0.2", "webpack": "^4.42.1" diff --git a/test/middleware.test.js b/test/middleware.test.js index 0b940550f..b01c0a9b2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -26,10 +26,6 @@ import webpackMultiWarningConfig from './fixtures/webpack.array.warning.config'; import webpackOneErrorOneWarningOneSuccessConfig from './fixtures/webpack.array.one-error-one-warning-one-success'; import webpackOneErrorOneWarningOneSuccessWithNamesConfig from './fixtures/webpack.array.one-error-one-warning-one-success-with-names'; -const SegfaultHandler = require('segfault-handler'); - -SegfaultHandler.registerHandler('crash.log'); - describe('middleware', () => { let instance; let listen; From 580cd58458c645fa965b63f076a10e03cae32ed2 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:44:02 +0300 Subject: [PATCH 29/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a55a8d2fb..59a4f3183 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -75,7 +75,7 @@ jobs: if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' run: sudo npm i -g npm - - name: Use latest NPM in windows + - name: Use latest NPM on windows if: matrix.os == 'windows-latest' run: npm i -g npm From 83e86f75e787ba6325a3e30c539913c4abd3c7e4 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:49:59 +0300 Subject: [PATCH 30/87] ci: improve --- .github/workflows/nodejs.yml | 4 +- test/__snapshots__/middleware.test.js.snap | 236 - test/middleware.test.js | 6258 ++++++++++---------- 3 files changed, 3130 insertions(+), 3368 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 59a4f3183..6bea34af0 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,9 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: | - node --version - node_modules/.bin/jest test/middleware.test.js -u + run: node_modules/.bin/jest test/middleware.test.js -u --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index c6de037ca..f3f63eba8 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,241 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Child \\"broken\\": ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"broken\\": Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "Child \\"warning\\": WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"warning\\": Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Child \\"success\\": Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Entrypoint main = bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "X modules", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - -exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; - exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index b01c0a9b2..88f386cc5 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -51,3135 +51,3135 @@ describe('middleware', () => { } } - describe('basic', () => { - describe('should work', () => { - let compiler; - let codeLength; - - const outputPath = path.resolve(__dirname, './outputs/basic'); - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.afterCompile.tap('wdm-test', (params) => { - codeLength = params.assets['bundle.js'].source().length; - done(); - }); - }); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'image.svg'), - 'svg image' - ); - instance.context.outputFileSystem.mkdirSync( - path.resolve(outputPath, 'directory/nested-directory'), - { recursive: true } - ); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'directory/nested-directory/index.html'), - 'My Index.' - ); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'throw-an-exception-on-readFileSync.txt'), - 'exception' - ); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'unknown'), - 'unknown' - ); - }); - - afterAll(close); - - it('should not find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect('Content-Type', 'application/javascript; charset=utf-8') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(fs.existsSync(path.resolve(outputPath, 'bundle.js'))).toBe( - false - ); - - return done(); - }); - }); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'bundle.js') - ); - - request(app) - .get('/bundle.js') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'application/javascript; charset=utf-8') - .expect(200, fileData.toString(), done); - }); - - it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { - request(app) - .head('/bundle.js') - .expect( - 'Content-Length', - instance.context.outputFileSystem - .readFileSync(path.resolve(outputPath, 'bundle.js')) - .byteLength.toString() - ) - .expect('Content-Type', 'application/javascript; charset=utf-8') - // eslint-disable-next-line no-undefined - .expect(200, undefined, done); - }); - - it('should return the "404" code for the "POST" request to the bundle file', (done) => { - request(app).post('/bundle.js').expect(404, done); - }); - - it('should return the "200" code for the "GET" request to the "image.svg" file', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'image.svg') - ); - - request(app) - .get('/image.svg') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'image/svg+xml') - .expect(200, fileData, done); - }); - - it('should return the "200" code for the "GET" request to the directory', (done) => { - const fileData = fs.readFileSync( - path.resolve(__dirname, './fixtures/index.html') - ); - - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect('Content-Length', fileData.byteLength.toString()) - .expect(200, fileData.toString(), done); - }); - - it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'directory/nested-directory/index.html') - ); - - request(app) - .get('/directory/nested-directory/') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, fileData.toString(), done); - }); - - it('should return the "200" code for the "GET" request to the subdirectory with "index.html" without trailing slash', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'directory/nested-directory/index.html') - ); - - request(app) - .get('/directory/nested-directory') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, fileData.toString(), done); - }); - - it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'directory/nested-directory/index.html') - ); - - request(app) - .get('/directory/nested-directory/index.html') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, fileData.toString(), done); - }); - - it('should return the "416" code for the "GET" request with the invalid range header', (done) => { - request(app) - .get('/bundle.js') - .set('Range', 'bytes=6000-') - .expect(416, done); - }); - - it('should return the "206" code for the "GET" request with the valid range header', (done) => { - request(app) - .get('/bundle.js') - .set('Range', 'bytes=3000-3500') - .expect('Content-Length', '501') - .expect('Content-Range', `bytes 3000-3500/${codeLength}`) - .expect(206, done); - }); - - it('should return the "404" code for the "GET" request with to the non-public path', (done) => { - request(app) - .get('/nonpublic/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - - it('should return the "404" code for the "GET" request to the deleted file', (done) => { - const spy = jest - .spyOn(instance.context.outputFileSystem, 'readFileSync') - .mockImplementation(() => { - throw new Error('error'); - }); - - request(app) - .get('/public/throw-an-exception-on-readFileSync.txt') - .expect(404, (error) => { - if (error) { - return done(error); - } - - spy.mockRestore(); - - return done(); - }); - }); - - it('should return "200" code code for the "GET" request to the file without extension', (done) => { - const fileData = instance.context.outputFileSystem.readFileSync( - path.resolve(outputPath, 'unknown') - ); - - request(app) - .get('/unknown') - .expect('Content-Length', fileData.byteLength.toString()) - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should not work with the broken "publicPath" option', () => { - let compiler; - - const outputPath = path.resolve(__dirname, './outputs/basic'); - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - publicPath: 'https://test:malfor%5Med@test.example.com', - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "400" code for the "GET" request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(404, done); - }); - }); - - describe('should work in multi-compiler mode', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackMultiConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/static-one/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a non existing file for the first compiler', (done) => { - request(app).get('/static-one/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - request(app) - .get('/static-one/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get('/static-one/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request for the bundle file for the second compiler', (done) => { - request(app).get('/static-two/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a non existing file for the second compiler', (done) => { - request(app).get('/static-two/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - request(app).get('/static-two/').expect(404, done); - }); - - it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - request(app).get('/static-two/index.html').expect(404, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app) - .get('/static-three/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app) - .get('/static-three/invalid.js') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - }); - - describe('should work with difference requests', () => { - const basicOutputPath = path.resolve(__dirname, './outputs/basic'); - const fixtures = [ - { - urls: [ - { - value: 'bundle.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - { - value: '', - contentType: 'text/html; charset=utf-8', - code: 200, - }, - { - value: 'index.html', - contentType: 'text/html; charset=utf-8', - code: 200, - }, - { - value: 'invalid.js', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - { - value: 'complex', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - { - value: 'complex/invalid.js', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - { - value: 'complex/complex', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - { - value: 'complex/complex/invalid.js', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - { - value: '%', - contentType: 'text/html; charset=utf-8', - code: 404, - }, - ], - }, - { - file: 'config.json', - data: JSON.stringify({ foo: 'bar' }), - urls: [ - { - value: 'config.json', - contentType: 'application/json; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'image.svg', - data: 'SVG', - urls: [ - { - value: 'image.svg', - contentType: 'image/svg+xml', - code: 200, - }, - ], - }, - { - file: 'foo.js', - data: 'console.log("foo");', - urls: [ - { - value: 'foo.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: '/complex/foo.js', - data: 'console.log("foo");', - urls: [ - { - value: 'complex/foo.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - { - value: 'complex/./foo.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - { - value: 'complex/foo/../foo.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: '/complex/complex/foo.js', - data: 'console.log("foo");', - urls: [ - { - value: 'complex/complex/foo.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: '/föö.js', - data: 'console.log("foo");', - urls: [ - // Express encodes the URI component, so we do the same - { - value: 'f%C3%B6%C3%B6.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: '/%foo%/%foo%.js', - data: 'console.log("foo");', - urls: [ - // Filenames can contain characters not allowed in URIs - { - value: '%foo%/%foo%.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'test.html', - data: '
test
', - urls: [ - { - value: 'test.html?foo=bar', - contentType: 'text/html; charset=utf-8', - code: 200, - }, - { - value: 'test.html?foo=bar#hash', - contentType: 'text/html; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'pathname with spaces.js', - data: 'console.log("foo");', - urls: [ - { - value: 'pathname%20with%20spaces.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'dirname with spaces/filename with spaces.js', - data: 'console.log("foo");', - urls: [ - { - value: 'dirname%20with%20spaces/filename%20with%20spaces.js', - contentType: 'application/javascript; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'filename-name-with-dots/mono-v6.x.x', - data: 'content with .', - urls: [ - { - value: 'filename-name-with-dots/mono-v6.x.x', - contentType: 'application/octet-stream', - code: 200, - }, - ], - }, - { - file: 'noextension', - data: 'noextension content', - urls: [ - { - value: 'noextension', - contentType: 'application/octet-stream', - code: 200, - }, - ], - }, - { - file: '3dAr.usdz', - data: '3dAr.usdz content', - urls: [ - { - value: '3dAr.usdz', - contentType: 'model/vnd.usdz+zip', - code: 200, - }, - ], - }, - { - file: 'hello.wasm', - data: 'hello.wasm content', - urls: [ - { - value: 'hello.wasm', - contentType: 'application/wasm', - code: 200, - }, - ], - }, - ]; - - const configurations = [ - { - output: { path: basicOutputPath, publicPath: '' }, - publicPathForRequest: '/', - }, - { - output: { path: path.join(basicOutputPath, 'dist'), publicPath: '' }, - publicPathForRequest: '/', - }, - { - output: { path: basicOutputPath, publicPath: '/' }, - publicPathForRequest: '/', - }, - { - output: { path: path.join(basicOutputPath, 'dist'), publicPath: '/' }, - publicPathForRequest: '/', - }, - { - output: { path: basicOutputPath, publicPath: '/static' }, - publicPathForRequest: '/static/', - }, - { - output: { - path: path.join(basicOutputPath, 'dist'), - publicPath: '/static', - }, - publicPathForRequest: '/static/', - }, - { - output: { path: basicOutputPath, publicPath: '/static/' }, - publicPathForRequest: '/static/', - }, - { - output: { - path: path.join(basicOutputPath, 'dist'), - publicPath: '/static/', - }, - publicPathForRequest: '/static/', - }, - { - output: { - path: path.join(basicOutputPath, 'dist/#leadinghash'), - publicPath: '/', - }, - publicPathForRequest: '/', - }, - { - output: { - path: basicOutputPath, - publicPath: 'http://127.0.0.1/', - }, - publicPathForRequest: '/', - }, - { - output: { - path: basicOutputPath, - publicPath: 'http://127.0.0.1:3000/', - }, - publicPathForRequest: '/', - }, - { - output: { - path: basicOutputPath, - publicPath: '//test.domain/', - }, - publicPathForRequest: '/', - }, - ]; - - const isWindows = process.platform === 'win32'; - - if (isWindows) { - fixtures.push( - { - file: 'windows.txt', - data: 'windows.txt content', - urls: [ - { - value: 'windows.txt', - contentType: 'text/plain; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'windows 2.txt', - data: 'windows 2.txt content', - urls: [ - { - value: 'windows%202.txt', - contentType: 'text/plain; charset=utf-8', - code: 200, - }, - ], - }, - { - file: 'test & test & %20.txt', - data: 'test & test & %20.txt content', - urls: [ - { - value: 'test%20%26%20test%20%26%20%2520.txt', - contentType: 'text/plain; charset=utf-8', - code: 200, - }, - ], - } - ); - - configurations.push( - { - output: { - path: path.join(basicOutputPath, 'my static'), - publicPath: '/static/', - }, - publicPathForRequest: '/static/', - }, - { - output: { - path: path.join(basicOutputPath, 'my%20static'), - publicPath: '/static/', - }, - publicPathForRequest: '/static/', - }, - { - output: { - path: path.join(basicOutputPath, 'my %20 static'), - publicPath: '/my%20static/', - }, - publicPathForRequest: '/my%20static/', - } - ); - } - - for (const configuration of configurations) { - // eslint-disable-next-line no-loop-func - describe('should work handle requests', () => { - const { output, publicPathForRequest } = configuration; - const { path: outputPath, publicPath } = output; - - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - publicPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - const { - context: { - outputFileSystem: { mkdirSync, writeFileSync }, - }, - } = instance; - - for (const { file, data } of fixtures) { - if (file) { - const fullPath = path.join(outputPath, file); - - mkdirSync(path.dirname(fullPath), { recursive: true }); - writeFileSync(fullPath, data); - } - } - }); - - afterAll(close); - - for (const { data, urls } of fixtures) { - for (const { value, contentType, code } of urls) { - // eslint-disable-next-line no-loop-func - it(`should return the "${code}" code for the "GET" request for the "${value}" url`, (done) => { - request(app) - .get(`${publicPathForRequest}${value}`) - .expect('Content-Type', contentType) - .expect('Content-Length', data ? String(data.length) : /\d+/) - .expect(code, done); - }); - } - } - }); - } - }); - - describe('should respect the value of the "Content-Type" header from other middleware', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = express(); - app.use((req, res, next) => { - res.set('Content-Type', 'application/octet-stream'); - next(); - }); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should not guess a MIME type if the "Content-Type" header is found', (done) => { - request(app) - .get('/bundle.js') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should not throw an error on the valid "output.path" value for linux', () => { - it('should be no error', (done) => { - expect(() => { - const compiler = getCompiler(); - - compiler.outputPath = '/my/path'; - - instance = middleware(compiler); - - instance.close(done); - }).not.toThrow(); - }); - }); - - describe('should not throw an error on the valid "output.path" value for windows', () => { - it('should be no error', (done) => { - expect(() => { - const compiler = getCompiler(); - - compiler.outputPath = 'C:/my/path'; - - instance = middleware(compiler); - - instance.close(done); - }).not.toThrow(); - }); - }); - - describe('should work without "output" options', () => { - beforeAll((done) => { - // eslint-disable-next-line no-undefined - const compiler = getCompiler({ ...webpackConfig, output: undefined }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/main.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with trailing slash at the end of the "option.path" option', () => { - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/basic/'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect empty "output.publicPath" and "output.path" options', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options', () => { - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - publicPath: '/static/', - path: path.resolve(__dirname, './outputs/other-basic'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { - let hash; - - beforeAll((done) => { - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - publicPath: isWebpack5() - ? '/static/[fullhash]/' - : '/static/[hash]/', - path: isWebpack5() - ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') - : path.resolve(__dirname, './outputs/other-basic-[hash]'), - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - hash = h; - done(); - }); - }); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get(`/static/${hash}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the public path', (done) => { - request(app) - .get(`/static/${hash}/`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get(`/static/${hash}/index.html`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { - let hashOne; - let hashTwo; - - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle.js', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/array-[fullhash]/static-one' - ) - : path.resolve(__dirname, './outputs/array-[hash]/static-one'), - publicPath: isWebpack5() - ? '/static-one/[fullhash]/' - : '/static-one/[hash]/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle.js', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/array-[fullhash]/static-two' - ) - : path.resolve(__dirname, './outputs/array-[hash]/static-two'), - publicPath: isWebpack5() - ? '/static-two/[fullhash]/' - : '/static-two/[hash]/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.done.tap('wdm-test', (params) => { - const [one, two] = params.stats; - - hashOne = one.hash; - hashTwo = two.hash; - - done(); - }); - }); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); - }); - - it('should return "200" code for GET request for the second bundle file', (done) => { - request(app) - .get(`/static-one/${hashOne}/`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get(`/static-one/${hashOne}/index.html`) - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); - }); - - it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/`).expect(404, done); - }); - - it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackMultiConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/static-one/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - request(app).get('/static-one/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - request(app) - .get('/static-one/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get('/static-one/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the second bundle file', (done) => { - request(app).get('/static-two/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - request(app).get('/static-two/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - request(app).get('/static-two/').expect(404, done); - }); - - it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - request(app).get('/static-two/index.html').expect(404, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/my-public/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/array/static-two'), - publicPath: '/my-public/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/my-public/bundle-one.js').expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get('/my-public/bundle-two.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/my-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path', (done) => { - request(app) - .get('/my-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option', (done) => { - request(app) - .get('/my-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackMultiConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/one-public/', - }, - }, - { - ...webpackMultiConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/array/static-one'), - publicPath: '/two-public/', - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - request(app).get('/one-public/bundle-one.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { - request(app).get('/one-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - request(app) - .get('/one-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - request(app) - .get('/one-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - request(app).get('/two-public/bundle-two.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { - request(app).get('/two-public/invalid.js').expect(404, done); - }); - - it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - request(app) - .get('/two-public/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - request(app) - .get('/two-public/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackClientServerConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { - beforeAll((done) => { - const compiler = getCompiler([ - webpackClientServerConfig[1], - webpackClientServerConfig[0], - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle.js').expect(200, done); - }); - - it('should return "404" code for GET request to nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app) - .get('/static/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to non-public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { - beforeAll((done) => { - const compiler = getCompiler([ - { - ...webpackClientServerConfig[0], - output: { - filename: 'bundle-one.js', - path: path.resolve(__dirname, './outputs/client-server/same'), - publicPath: '/static/', - }, - }, - { - ...webpackClientServerConfig[1], - output: { - filename: 'bundle-two.js', - path: path.resolve(__dirname, './outputs/client-server/same'), - }, - }, - ]); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return "200" code for GET request to the bundle file', (done) => { - request(app).get('/static/bundle-one.js').expect(200, done); - }); - - it('should return "404" code for GET request to a nonexistent file', (done) => { - request(app).get('/static/invalid.js').expect(404, done); - }); - - it('should return "404" code for GET request to the public path', (done) => { - request(app).get('/static/').expect(200, done); - }); - - it('should return "200" code for GET request to the non-public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return "404" code for GET request to the "index" option', (done) => { - request(app) - .get('/static/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should respect the "stats" option with the "false" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: false }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option with the "none" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'none' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option with the "minimal" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" requests to bundles file', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - }); - - describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - stats: { all: false, entrypoints: true }, - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - - describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to bundle files', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - - describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler( - webpackOneErrorOneWarningOneSuccessWithNamesConfig - ); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for "GET" requests to bundle files', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - return request(app) - .get('/static-three/bundle.js') - .expect(200, (thirdError) => { - if (thirdError) { - return done(thirdError); - } - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - return done(); - }); - }); - }); - }); - }); - - describe('should throw an error on "run" when we watching', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging an error', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - return compiler.run((runError) => { - expect(() => { - throw runError; - }).toThrowErrorMatchingSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should throw an error on "watch" when we watching', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging an error', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - return compiler.watch({}, (watchError) => { - expect(() => { - throw watchError; - }).toThrowErrorMatchingSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should handle an earlier request if a change happened while compiling', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - let invalidated = false; - - compiler.hooks.done.tap('Invalidated', () => { - if (!invalidated) { - instance.invalidate(); - - invalidated = true; - } - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/bundle.js').expect(200, done); - }); - }); - }); - - describe('mimeTypes option', () => { - describe('should set the correct value for "Content-Type" header to known MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.html'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to "file.html"', (done) => { - request(app) - .get('/file.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); - }); - }); - - describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.phtml'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to "file.html"', (done) => { - request(app) - .get('/file.phtml') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should set the correct value for "Content-Type" header to specified MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - mimeTypes: { - phtml: 'text/html', - }, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'file.phtml'), - 'welcome' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request "file.html"', (done) => { - request(app) - .get('/file.phtml') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, 'welcome', done); - }); - }); - }); - - describe('watchOptions option', () => { - describe('should work without value', () => { - let compiler; - let spy; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - spy = jest.spyOn(compiler, 'watch'); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - spy.mockRestore(); - - close(); - }); - - it('should pass arguments to the "watch" method', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual({}); - - return done(); - }); - }); - }); - - describe('should respect options from the configuration', () => { - let compiler; - let spy; - - beforeAll((done) => { - compiler = getCompiler(webpackWatchOptionsConfig); - - spy = jest.spyOn(compiler, 'watch'); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - spy.mockRestore(); - - close(); - }); - - it('should pass arguments to the "watch" method', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(done); - } - - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual({ - aggregateTimeout: 300, - poll: true, - }); - - return done(error); - }); - }); - }); - - describe('should respect options from the configuration in multi-compile mode', () => { - let compiler; - let spy; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWatchOptionsConfig); - - spy = jest.spyOn(compiler, 'watch'); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - spy.mockRestore(); - - close(); - }); - - it('should pass arguments to the "watch" method', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - - expect(spy).toHaveBeenCalledTimes(1); - expect(spy.mock.calls[0][0]).toEqual([ - { aggregateTimeout: 800, poll: false }, - { aggregateTimeout: 300, poll: true }, - ]); - - return done(); - }); - }); - }); - }); - }); - - describe('writeToDisk option', () => { - describe('should work with "true" value', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/write-to-disk-true'), - }, - }); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync(path.posix.resolve(__dirname, './outputs/write-to-disk-true')); - - close(); - }); - - it('should find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-true/bundle.js' - ); - - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(1); - expect(fs.existsSync(bundlePath)).toBe(true); - - instance.invalidate(); - - return compiler.hooks.done.tap( - 'DevMiddlewareWriteToDiskTest', - () => { - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(1); - - done(); - } - ); - }); - }); - }); - - describe('should work with "false" value', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, './outputs/write-to-disk-false'), - }, - }); - - instance = middleware(compiler, { writeToDisk: false }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should not find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-false/bundle.js' - ); - - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(0); - expect(fs.existsSync(bundlePath)).toBe(false); - - instance.invalidate(); - - return compiler.hooks.done.tap( - 'DevMiddlewareWriteToDiskTest', - () => { - expect( - compiler.hooks.assetEmitted.taps.filter( - (hook) => hook.name === 'DevMiddleware' - ).length - ).toBe(0); - - done(); - } - ); - }); - }); - }); - - describe('should work with "Function" value when it returns "true"', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-function-true' - ), - }, - }); - - instance = middleware(compiler, { - writeToDisk: (filePath) => /bundle\.js$/.test(filePath), - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-function-true') - ); - - close(); - }); - - it('should find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-function-true/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - - describe('should work with "Function" value when it returns "false"', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-function-false' - ), - }, - }); - - instance = middleware(compiler, { - writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-function-false' - ) - ); - - close(); - }); - - it('should not find the bundle file on disk', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-function-false/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(false); - - return done(); - }); - }); - }); - - describe('should work when assets have query string', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackQueryStringConfig, - output: { - filename: 'bundle.js?[contenthash]', - path: path.resolve( - __dirname, - './outputs/write-to-disk-query-string' - ), - }, - }); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-query-string') - ); - - close(); - }); - - it('should find the bundle file on disk with no querystring', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - './outputs/write-to-disk-query-string/bundle.js' - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - - describe('should work in multi-compiler mode', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler([ - { - ...webpackMultiWatchOptionsConfig[0], - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/static-one' - ), - publicPath: '/static-one/', - }, - }, - { - ...webpackMultiWatchOptionsConfig[1], - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/static-two' - ), - publicPath: '/static-two/', - }, - }, - ]); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-multi-compiler/' - ) - ); - - close(); - }); - - it('should find the bundle files on disk', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (firstError) => { - if (firstError) { - return done(firstError); - } - - return request(app) - .get('/static-two/bundle.js') - .expect(200, (secondError) => { - if (secondError) { - return done(secondError); - } - const bundleFiles = [ - './outputs/write-to-disk-multi-compiler/static-one/bundle.js', - './outputs/write-to-disk-multi-compiler/static-one/index.html', - './outputs/write-to-disk-multi-compiler/static-one/svg.svg', - './outputs/write-to-disk-multi-compiler/static-two/bundle.js', - ]; - - for (const bundleFile of bundleFiles) { - const bundlePath = path.resolve(__dirname, bundleFile); - - expect(fs.existsSync(bundlePath)).toBe(true); - } - - return done(); - }); - }); - }); - }); - - describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { - let compiler; - let hash; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackConfig, - ...{ - output: { - filename: 'bundle.js', - publicPath: isWebpack5() - ? '/static/[fullhash]/' - : '/static/[hash]/', - path: isWebpack5() - ? path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_[fullhash]' - ) - : path.resolve( - __dirname, - './outputs/write-to-disk-with-hash/dist_[hash]' - ), - }, - }, - }); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(() => { - compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - hash = h; - done(); - }); - }); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') - ); - - close(); - }); - - it('should find the bundle file on disk', (done) => { - request(app) - .get(`/static/${hash}/bundle.js`) - .expect(200, (error) => { - if (error) { - return done(error); - } - - const bundlePath = path.resolve( - __dirname, - `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` - ); - - expect(fs.existsSync(bundlePath)).toBe(true); - - return done(); - }); - }); - }); - }); - - describe('methods option', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { - methods: ['POST'], - publicPath: '/public/', - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "POST" request to the bundle file', (done) => { - request(app).post('/public/bundle.js').expect(200, done); - }); - - it('should return the "404" code for the "GET" request to the bundle file', (done) => { - request(app).get('/public/bundle.js').expect(404, done); - }); - - it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { - request(app).head('/public/bundle.js').expect(404, done); - }); - }); - - describe('headers option', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { - headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { - request(app) - .get('/bundle.js') - .expect('X-nonsense-1', 'yes') - .expect('X-nonsense-2', 'no') - .expect(200, done); - }); - }); - - describe('publicPath option', () => { - describe('should work with "string" value', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { publicPath: '/public/' }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the bundle file', (done) => { - request(app).get('/public/bundle.js').expect(200, done); - }); - }); - }); - - describe('serverSideRender option', () => { - let locals; - - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { serverSideRender: true }); - - app = express(); - app.use(instance); - app.use((req, res) => { - // eslint-disable-next-line prefer-destructuring - locals = res.locals; - - res.sendStatus(200); - }); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request', (done) => { - request(app) - .get('/foo/bar') - .expect(200, (error) => { - if (error) { - return done(error); - } - - expect(locals.webpack.devMiddleware).toBeDefined(); - - return done(); - }); - }); - }); - - describe('outputFileSystem option', () => { - describe('should work with an unspecified value', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use the "memfs" package by default', () => { - const { Stats } = memfs; - - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should work with the configured value (native fs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - const configuredFs = fs; - - configuredFs.join = path.join.bind(path); - configuredFs.mkdirp = () => {}; - - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use the configurated output filesystem', () => { - const { Stats } = fs; - - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should work with the configured value (memfs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - const configuredFs = createFsFromVolume(new Volume()); - - configuredFs.join = path.join.bind(path); - - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use the configured output filesystem', () => { - const { Stats } = memfs; - - expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(compiler.outputFileSystem).toHaveProperty('join'); - expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should work with the configured value in multi-compiler mode (native fs)', () => { - let compiler; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - const configuredFs = fs; - - configuredFs.join = path.join.bind(path); - configuredFs.mkdirp = () => {}; - - instance = middleware(compiler, { - outputFileSystem: configuredFs, - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should use configured output filesystems', () => { - const { Stats } = fs; - - for (const childCompiler of compiler.compilers) { - expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(childCompiler.outputFileSystem).toHaveProperty('join'); - expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); - } - - expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - Stats - ); - expect(instance.context.outputFileSystem).toHaveProperty('join'); - expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); - }); - }); - - describe('should throw an error on the invalid fs value - no join method', () => { - it('should throw an error', () => { - expect(() => { - const compiler = getCompiler(webpackConfig); - - middleware(compiler, { outputFileSystem: { mkdirp: () => {} } }); - }).toThrow( - 'Invalid options: options.outputFileSystem.join() method is expected' - ); - }); - }); - - describe('should throw an error on the invalid fs value - no mkdirp method', () => { - it('should throw an error', () => { - expect(() => { - const compiler = getCompiler(webpackConfig); - - middleware(compiler, { outputFileSystem: { join: () => {} } }); - }).toThrow( - 'Invalid options: options.outputFileSystem.mkdirp() method is expected' - ); - }); - }); - }); - - describe('index option', () => { - describe('should work with "false" value', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { index: false, publicPath: '/' }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(404, done); - }); - - it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with "true" value', () => { - beforeAll((done) => { - const compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { index: true, publicPath: '/' }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/index.html') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with "string" value', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'default.html', - publicPath: '/', - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'default.html'), - 'hello' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with "string" value with a custom extension', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'index.custom', - publicPath: '/', - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'index.custom'), - 'hello' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'index.custom', - mimeTypes: { - custom: 'text/html', - }, - publicPath: '/', - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'index.custom'), - 'hello' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'text/html; charset=utf-8') - .expect(200, done); - }); - }); - - describe('should work with "string" value without an extension', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { index: 'noextension' }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.writeFileSync( - path.resolve(outputPath, 'noextension'), - 'hello' - ); - }); - - afterAll(close); - - it('should return the "200" code for the "GET" request to the public path', (done) => { - request(app) - .get('/') - .expect('Content-Type', 'application/octet-stream') - .expect(200, done); - }); - }); - - describe('should work with "string" value but the "index" option is a directory', () => { - beforeAll((done) => { - const outputPath = path.resolve(__dirname, './outputs/basic'); - const compiler = getCompiler({ - ...webpackConfig, - output: { - filename: 'bundle.js', - path: outputPath, - }, - }); - - instance = middleware(compiler, { - index: 'custom.html', - publicPath: '/', - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - - instance.context.outputFileSystem.mkdirSync(outputPath, { - recursive: true, - }); - instance.context.outputFileSystem.mkdirSync( - path.resolve(outputPath, 'custom.html') - ); - }); - - afterAll(close); - - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - - describe('should not handle request when index is neither a file nor a directory', () => { - let compiler; - let isDirectory; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - instance = middleware(compiler, { - index: 'default.html', - publicPath: '/', - }); - - isDirectory = jest - .spyOn(instance.context.outputFileSystem, 'statSync') - .mockImplementation(() => { - return { - isFile: () => false, - isDirectory: () => false, - }; - }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - isDirectory.mockRestore(); - - close(); - }); - - it('should return the "404" code for the "GET" request to the public path', (done) => { - request(app).get('/').expect(404, done); - }); - }); - }); + //describe('basic', () => { + // describe('should work', () => { + // let compiler; + // let codeLength; + // + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.afterCompile.tap('wdm-test', (params) => { + // codeLength = params.assets['bundle.js'].source().length; + // done(); + // }); + // }); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'image.svg'), + // 'svg image' + // ); + // instance.context.outputFileSystem.mkdirSync( + // path.resolve(outputPath, 'directory/nested-directory'), + // { recursive: true } + // ); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'directory/nested-directory/index.html'), + // 'My Index.' + // ); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'throw-an-exception-on-readFileSync.txt'), + // 'exception' + // ); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'unknown'), + // 'unknown' + // ); + // }); + // + // afterAll(close); + // + // it('should not find the bundle file on disk', (done) => { + // request(app) + // .get('/bundle.js') + // .expect('Content-Type', 'application/javascript; charset=utf-8') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(fs.existsSync(path.resolve(outputPath, 'bundle.js'))).toBe( + // false + // ); + // + // return done(); + // }); + // }); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'bundle.js') + // ); + // + // request(app) + // .get('/bundle.js') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'application/javascript; charset=utf-8') + // .expect(200, fileData.toString(), done); + // }); + // + // it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { + // request(app) + // .head('/bundle.js') + // .expect( + // 'Content-Length', + // instance.context.outputFileSystem + // .readFileSync(path.resolve(outputPath, 'bundle.js')) + // .byteLength.toString() + // ) + // .expect('Content-Type', 'application/javascript; charset=utf-8') + // // eslint-disable-next-line no-undefined + // .expect(200, undefined, done); + // }); + // + // it('should return the "404" code for the "POST" request to the bundle file', (done) => { + // request(app).post('/bundle.js').expect(404, done); + // }); + // + // it('should return the "200" code for the "GET" request to the "image.svg" file', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'image.svg') + // ); + // + // request(app) + // .get('/image.svg') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'image/svg+xml') + // .expect(200, fileData, done); + // }); + // + // it('should return the "200" code for the "GET" request to the directory', (done) => { + // const fileData = fs.readFileSync( + // path.resolve(__dirname, './fixtures/index.html') + // ); + // + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect(200, fileData.toString(), done); + // }); + // + // it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'directory/nested-directory/index.html') + // ); + // + // request(app) + // .get('/directory/nested-directory/') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, fileData.toString(), done); + // }); + // + // it('should return the "200" code for the "GET" request to the subdirectory with "index.html" without trailing slash', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'directory/nested-directory/index.html') + // ); + // + // request(app) + // .get('/directory/nested-directory') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, fileData.toString(), done); + // }); + // + // it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'directory/nested-directory/index.html') + // ); + // + // request(app) + // .get('/directory/nested-directory/index.html') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, fileData.toString(), done); + // }); + // + // it('should return the "416" code for the "GET" request with the invalid range header', (done) => { + // request(app) + // .get('/bundle.js') + // .set('Range', 'bytes=6000-') + // .expect(416, done); + // }); + // + // it('should return the "206" code for the "GET" request with the valid range header', (done) => { + // request(app) + // .get('/bundle.js') + // .set('Range', 'bytes=3000-3500') + // .expect('Content-Length', '501') + // .expect('Content-Range', `bytes 3000-3500/${codeLength}`) + // .expect(206, done); + // }); + // + // it('should return the "404" code for the "GET" request with to the non-public path', (done) => { + // request(app) + // .get('/nonpublic/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // + // it('should return the "404" code for the "GET" request to the deleted file', (done) => { + // const spy = jest + // .spyOn(instance.context.outputFileSystem, 'readFileSync') + // .mockImplementation(() => { + // throw new Error('error'); + // }); + // + // request(app) + // .get('/public/throw-an-exception-on-readFileSync.txt') + // .expect(404, (error) => { + // if (error) { + // return done(error); + // } + // + // spy.mockRestore(); + // + // return done(); + // }); + // }); + // + // it('should return "200" code code for the "GET" request to the file without extension', (done) => { + // const fileData = instance.context.outputFileSystem.readFileSync( + // path.resolve(outputPath, 'unknown') + // ); + // + // request(app) + // .get('/unknown') + // .expect('Content-Length', fileData.byteLength.toString()) + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should not work with the broken "publicPath" option', () => { + // let compiler; + // + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // publicPath: 'https://test:malfor%5Med@test.example.com', + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "400" code for the "GET" request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(404, done); + // }); + // }); + // + // describe('should work in multi-compiler mode', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackMultiConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/static-one/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a non existing file for the first compiler', (done) => { + // request(app).get('/static-one/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + // request(app) + // .get('/static-one/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get('/static-one/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request for the bundle file for the second compiler', (done) => { + // request(app).get('/static-two/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a non existing file for the second compiler', (done) => { + // request(app).get('/static-two/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + // request(app).get('/static-two/').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + // request(app).get('/static-two/index.html').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/static-three/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/static-three/invalid.js') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // }); + // + // describe('should work with difference requests', () => { + // const basicOutputPath = path.resolve(__dirname, './outputs/basic'); + // const fixtures = [ + // { + // urls: [ + // { + // value: 'bundle.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // { + // value: '', + // contentType: 'text/html; charset=utf-8', + // code: 200, + // }, + // { + // value: 'index.html', + // contentType: 'text/html; charset=utf-8', + // code: 200, + // }, + // { + // value: 'invalid.js', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // { + // value: 'complex', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // { + // value: 'complex/invalid.js', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // { + // value: 'complex/complex', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // { + // value: 'complex/complex/invalid.js', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // { + // value: '%', + // contentType: 'text/html; charset=utf-8', + // code: 404, + // }, + // ], + // }, + // { + // file: 'config.json', + // data: JSON.stringify({ foo: 'bar' }), + // urls: [ + // { + // value: 'config.json', + // contentType: 'application/json; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'image.svg', + // data: 'SVG', + // urls: [ + // { + // value: 'image.svg', + // contentType: 'image/svg+xml', + // code: 200, + // }, + // ], + // }, + // { + // file: 'foo.js', + // data: 'console.log("foo");', + // urls: [ + // { + // value: 'foo.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: '/complex/foo.js', + // data: 'console.log("foo");', + // urls: [ + // { + // value: 'complex/foo.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // { + // value: 'complex/./foo.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // { + // value: 'complex/foo/../foo.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: '/complex/complex/foo.js', + // data: 'console.log("foo");', + // urls: [ + // { + // value: 'complex/complex/foo.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: '/föö.js', + // data: 'console.log("foo");', + // urls: [ + // // Express encodes the URI component, so we do the same + // { + // value: 'f%C3%B6%C3%B6.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: '/%foo%/%foo%.js', + // data: 'console.log("foo");', + // urls: [ + // // Filenames can contain characters not allowed in URIs + // { + // value: '%foo%/%foo%.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'test.html', + // data: '
test
', + // urls: [ + // { + // value: 'test.html?foo=bar', + // contentType: 'text/html; charset=utf-8', + // code: 200, + // }, + // { + // value: 'test.html?foo=bar#hash', + // contentType: 'text/html; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'pathname with spaces.js', + // data: 'console.log("foo");', + // urls: [ + // { + // value: 'pathname%20with%20spaces.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'dirname with spaces/filename with spaces.js', + // data: 'console.log("foo");', + // urls: [ + // { + // value: 'dirname%20with%20spaces/filename%20with%20spaces.js', + // contentType: 'application/javascript; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'filename-name-with-dots/mono-v6.x.x', + // data: 'content with .', + // urls: [ + // { + // value: 'filename-name-with-dots/mono-v6.x.x', + // contentType: 'application/octet-stream', + // code: 200, + // }, + // ], + // }, + // { + // file: 'noextension', + // data: 'noextension content', + // urls: [ + // { + // value: 'noextension', + // contentType: 'application/octet-stream', + // code: 200, + // }, + // ], + // }, + // { + // file: '3dAr.usdz', + // data: '3dAr.usdz content', + // urls: [ + // { + // value: '3dAr.usdz', + // contentType: 'model/vnd.usdz+zip', + // code: 200, + // }, + // ], + // }, + // { + // file: 'hello.wasm', + // data: 'hello.wasm content', + // urls: [ + // { + // value: 'hello.wasm', + // contentType: 'application/wasm', + // code: 200, + // }, + // ], + // }, + // ]; + // + // const configurations = [ + // { + // output: { path: basicOutputPath, publicPath: '' }, + // publicPathForRequest: '/', + // }, + // { + // output: { path: path.join(basicOutputPath, 'dist'), publicPath: '' }, + // publicPathForRequest: '/', + // }, + // { + // output: { path: basicOutputPath, publicPath: '/' }, + // publicPathForRequest: '/', + // }, + // { + // output: { path: path.join(basicOutputPath, 'dist'), publicPath: '/' }, + // publicPathForRequest: '/', + // }, + // { + // output: { path: basicOutputPath, publicPath: '/static' }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { + // path: path.join(basicOutputPath, 'dist'), + // publicPath: '/static', + // }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { path: basicOutputPath, publicPath: '/static/' }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { + // path: path.join(basicOutputPath, 'dist'), + // publicPath: '/static/', + // }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { + // path: path.join(basicOutputPath, 'dist/#leadinghash'), + // publicPath: '/', + // }, + // publicPathForRequest: '/', + // }, + // { + // output: { + // path: basicOutputPath, + // publicPath: 'http://127.0.0.1/', + // }, + // publicPathForRequest: '/', + // }, + // { + // output: { + // path: basicOutputPath, + // publicPath: 'http://127.0.0.1:3000/', + // }, + // publicPathForRequest: '/', + // }, + // { + // output: { + // path: basicOutputPath, + // publicPath: '//test.domain/', + // }, + // publicPathForRequest: '/', + // }, + // ]; + // + // const isWindows = process.platform === 'win32'; + // + // if (isWindows) { + // fixtures.push( + // { + // file: 'windows.txt', + // data: 'windows.txt content', + // urls: [ + // { + // value: 'windows.txt', + // contentType: 'text/plain; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'windows 2.txt', + // data: 'windows 2.txt content', + // urls: [ + // { + // value: 'windows%202.txt', + // contentType: 'text/plain; charset=utf-8', + // code: 200, + // }, + // ], + // }, + // { + // file: 'test & test & %20.txt', + // data: 'test & test & %20.txt content', + // urls: [ + // { + // value: 'test%20%26%20test%20%26%20%2520.txt', + // contentType: 'text/plain; charset=utf-8', + // code: 200, + // }, + // ], + // } + // ); + // + // configurations.push( + // { + // output: { + // path: path.join(basicOutputPath, 'my static'), + // publicPath: '/static/', + // }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { + // path: path.join(basicOutputPath, 'my%20static'), + // publicPath: '/static/', + // }, + // publicPathForRequest: '/static/', + // }, + // { + // output: { + // path: path.join(basicOutputPath, 'my %20 static'), + // publicPath: '/my%20static/', + // }, + // publicPathForRequest: '/my%20static/', + // } + // ); + // } + // + // for (const configuration of configurations) { + // // eslint-disable-next-line no-loop-func + // describe('should work handle requests', () => { + // const { output, publicPathForRequest } = configuration; + // const { path: outputPath, publicPath } = output; + // + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // publicPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // const { + // context: { + // outputFileSystem: { mkdirSync, writeFileSync }, + // }, + // } = instance; + // + // for (const { file, data } of fixtures) { + // if (file) { + // const fullPath = path.join(outputPath, file); + // + // mkdirSync(path.dirname(fullPath), { recursive: true }); + // writeFileSync(fullPath, data); + // } + // } + // }); + // + // afterAll(close); + // + // for (const { data, urls } of fixtures) { + // for (const { value, contentType, code } of urls) { + // // eslint-disable-next-line no-loop-func + // it(`should return the "${code}" code for the "GET" request for the "${value}" url`, (done) => { + // request(app) + // .get(`${publicPathForRequest}${value}`) + // .expect('Content-Type', contentType) + // .expect('Content-Length', data ? String(data.length) : /\d+/) + // .expect(code, done); + // }); + // } + // } + // }); + // } + // }); + // + // describe('should respect the value of the "Content-Type" header from other middleware', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use((req, res, next) => { + // res.set('Content-Type', 'application/octet-stream'); + // next(); + // }); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should not guess a MIME type if the "Content-Type" header is found', (done) => { + // request(app) + // .get('/bundle.js') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should not throw an error on the valid "output.path" value for linux', () => { + // it('should be no error', (done) => { + // expect(() => { + // const compiler = getCompiler(); + // + // compiler.outputPath = '/my/path'; + // + // instance = middleware(compiler); + // + // instance.close(done); + // }).not.toThrow(); + // }); + // }); + // + // describe('should not throw an error on the valid "output.path" value for windows', () => { + // it('should be no error', (done) => { + // expect(() => { + // const compiler = getCompiler(); + // + // compiler.outputPath = 'C:/my/path'; + // + // instance = middleware(compiler); + // + // instance.close(done); + // }).not.toThrow(); + // }); + // }); + // + // describe('should work without "output" options', () => { + // beforeAll((done) => { + // // eslint-disable-next-line no-undefined + // const compiler = getCompiler({ ...webpackConfig, output: undefined }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/main.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should work with trailing slash at the end of the "option.path" option', () => { + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve(__dirname, './outputs/basic/'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should respect empty "output.publicPath" and "output.path" options', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options', () => { + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // publicPath: '/static/', + // path: path.resolve(__dirname, './outputs/other-basic'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + // let hash; + // + // beforeAll((done) => { + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // publicPath: isWebpack5() + // ? '/static/[fullhash]/' + // : '/static/[hash]/', + // path: isWebpack5() + // ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') + // : path.resolve(__dirname, './outputs/other-basic-[hash]'), + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + // hash = h; + // done(); + // }); + // }); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get(`/static/${hash}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the public path', (done) => { + // request(app) + // .get(`/static/${hash}/`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get(`/static/${hash}/index.html`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + // let hashOne; + // let hashTwo; + // + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle.js', + // path: isWebpack5() + // ? path.resolve( + // __dirname, + // './outputs/array-[fullhash]/static-one' + // ) + // : path.resolve(__dirname, './outputs/array-[hash]/static-one'), + // publicPath: isWebpack5() + // ? '/static-one/[fullhash]/' + // : '/static-one/[hash]/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle.js', + // path: isWebpack5() + // ? path.resolve( + // __dirname, + // './outputs/array-[fullhash]/static-two' + // ) + // : path.resolve(__dirname, './outputs/array-[hash]/static-two'), + // publicPath: isWebpack5() + // ? '/static-two/[fullhash]/' + // : '/static-two/[hash]/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.done.tap('wdm-test', (params) => { + // const [one, two] = params.stats; + // + // hashOne = one.hash; + // hashTwo = two.hash; + // + // done(); + // }); + // }); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + // request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); + // }); + // + // it('should return "200" code for GET request for the second bundle file', (done) => { + // request(app) + // .get(`/static-one/${hashOne}/`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get(`/static-one/${hashOne}/index.html`) + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + // request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackMultiConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/static-one/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + // request(app).get('/static-one/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + // request(app) + // .get('/static-one/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get('/static-one/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the second bundle file', (done) => { + // request(app).get('/static-two/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + // request(app).get('/static-two/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + // request(app).get('/static-two/').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + // request(app).get('/static-two/index.html').expect(404, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/my-public/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/array/static-two'), + // publicPath: '/my-public/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/my-public/bundle-one.js').expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get('/my-public/bundle-two.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/my-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path', (done) => { + // request(app) + // .get('/my-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/my-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackMultiConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/one-public/', + // }, + // }, + // { + // ...webpackMultiConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/array/static-one'), + // publicPath: '/two-public/', + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + // request(app).get('/one-public/bundle-one.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { + // request(app).get('/one-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + // request(app) + // .get('/one-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + // request(app) + // .get('/one-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + // request(app).get('/two-public/bundle-two.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { + // request(app).get('/two-public/invalid.js').expect(404, done); + // }); + // + // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + // request(app) + // .get('/two-public/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + // request(app) + // .get('/two-public/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackClientServerConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // webpackClientServerConfig[1], + // webpackClientServerConfig[0], + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app) + // .get('/static/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to non-public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { + // beforeAll((done) => { + // const compiler = getCompiler([ + // { + // ...webpackClientServerConfig[0], + // output: { + // filename: 'bundle-one.js', + // path: path.resolve(__dirname, './outputs/client-server/same'), + // publicPath: '/static/', + // }, + // }, + // { + // ...webpackClientServerConfig[1], + // output: { + // filename: 'bundle-two.js', + // path: path.resolve(__dirname, './outputs/client-server/same'), + // }, + // }, + // ]); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return "200" code for GET request to the bundle file', (done) => { + // request(app).get('/static/bundle-one.js').expect(200, done); + // }); + // + // it('should return "404" code for GET request to a nonexistent file', (done) => { + // request(app).get('/static/invalid.js').expect(404, done); + // }); + // + // it('should return "404" code for GET request to the public path', (done) => { + // request(app).get('/static/').expect(200, done); + // }); + // + // it('should return "200" code for GET request to the non-public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return "404" code for GET request to the "index" option', (done) => { + // request(app) + // .get('/static/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should respect the "stats" option with the "false" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: false }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // + // describe('should respect the "stats" option with the "none" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: 'none' }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // + // describe('should respect the "stats" option with the "minimal" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // + // describe('should respect the "stats" option in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" requests to bundles file', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // return request(app) + // .get('/static-three/bundle.js') + // .expect(200, (thirdError) => { + // if (thirdError) { + // return done(thirdError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // }); + // }); + // + // describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // stats: { all: false, entrypoints: true }, + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // + // describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to bundle files', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // }); + // + // describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler( + // webpackOneErrorOneWarningOneSuccessWithNamesConfig + // ); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for "GET" requests to bundle files', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // return request(app) + // .get('/static-three/bundle.js') + // .expect(200, (thirdError) => { + // if (thirdError) { + // return done(thirdError); + // } + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // return done(); + // }); + // }); + // }); + // }); + // }); + // + // describe('should throw an error on "run" when we watching', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging an error', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // return compiler.run((runError) => { + // expect(() => { + // throw runError; + // }).toThrowErrorMatchingSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should throw an error on "watch" when we watching', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging an error', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // return compiler.watch({}, (watchError) => { + // expect(() => { + // throw watchError; + // }).toThrowErrorMatchingSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should handle an earlier request if a change happened while compiling', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // let invalidated = false; + // + // compiler.hooks.done.tap('Invalidated', () => { + // if (!invalidated) { + // instance.invalidate(); + // + // invalidated = true; + // } + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app).get('/bundle.js').expect(200, done); + // }); + // }); + //}); + // + //describe('mimeTypes option', () => { + // describe('should set the correct value for "Content-Type" header to known MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.html'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to "file.html"', (done) => { + // request(app) + // .get('/file.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, 'welcome', done); + // }); + // }); + // + // describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.phtml'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to "file.html"', (done) => { + // request(app) + // .get('/file.phtml') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should set the correct value for "Content-Type" header to specified MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // mimeTypes: { + // phtml: 'text/html', + // }, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'file.phtml'), + // 'welcome' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request "file.html"', (done) => { + // request(app) + // .get('/file.phtml') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, 'welcome', done); + // }); + // }); + //}); + // + //describe('watchOptions option', () => { + // describe('should work without value', () => { + // let compiler; + // let spy; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // spy = jest.spyOn(compiler, 'watch'); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // spy.mockRestore(); + // + // close(); + // }); + // + // it('should pass arguments to the "watch" method', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(spy).toHaveBeenCalledTimes(1); + // expect(spy.mock.calls[0][0]).toEqual({}); + // + // return done(); + // }); + // }); + // }); + // + // describe('should respect options from the configuration', () => { + // let compiler; + // let spy; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackWatchOptionsConfig); + // + // spy = jest.spyOn(compiler, 'watch'); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // spy.mockRestore(); + // + // close(); + // }); + // + // it('should pass arguments to the "watch" method', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(done); + // } + // + // expect(spy).toHaveBeenCalledTimes(1); + // expect(spy.mock.calls[0][0]).toEqual({ + // aggregateTimeout: 300, + // poll: true, + // }); + // + // return done(error); + // }); + // }); + // }); + // + // describe('should respect options from the configuration in multi-compile mode', () => { + // let compiler; + // let spy; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWatchOptionsConfig); + // + // spy = jest.spyOn(compiler, 'watch'); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // spy.mockRestore(); + // + // close(); + // }); + // + // it('should pass arguments to the "watch" method', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // + // expect(spy).toHaveBeenCalledTimes(1); + // expect(spy.mock.calls[0][0]).toEqual([ + // { aggregateTimeout: 800, poll: false }, + // { aggregateTimeout: 300, poll: true }, + // ]); + // + // return done(); + // }); + // }); + // }); + // }); + //}); + // + //describe('writeToDisk option', () => { + // describe('should work with "true" value', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve(__dirname, './outputs/write-to-disk-true'), + // }, + // }); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync(path.posix.resolve(__dirname, './outputs/write-to-disk-true')); + // + // close(); + // }); + // + // it('should find the bundle file on disk', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // './outputs/write-to-disk-true/bundle.js' + // ); + // + // expect( + // compiler.hooks.assetEmitted.taps.filter( + // (hook) => hook.name === 'DevMiddleware' + // ).length + // ).toBe(1); + // expect(fs.existsSync(bundlePath)).toBe(true); + // + // instance.invalidate(); + // + // return compiler.hooks.done.tap( + // 'DevMiddlewareWriteToDiskTest', + // () => { + // expect( + // compiler.hooks.assetEmitted.taps.filter( + // (hook) => hook.name === 'DevMiddleware' + // ).length + // ).toBe(1); + // + // done(); + // } + // ); + // }); + // }); + // }); + // + // describe('should work with "false" value', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve(__dirname, './outputs/write-to-disk-false'), + // }, + // }); + // + // instance = middleware(compiler, { writeToDisk: false }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should not find the bundle file on disk', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // './outputs/write-to-disk-false/bundle.js' + // ); + // + // expect( + // compiler.hooks.assetEmitted.taps.filter( + // (hook) => hook.name === 'DevMiddleware' + // ).length + // ).toBe(0); + // expect(fs.existsSync(bundlePath)).toBe(false); + // + // instance.invalidate(); + // + // return compiler.hooks.done.tap( + // 'DevMiddlewareWriteToDiskTest', + // () => { + // expect( + // compiler.hooks.assetEmitted.taps.filter( + // (hook) => hook.name === 'DevMiddleware' + // ).length + // ).toBe(0); + // + // done(); + // } + // ); + // }); + // }); + // }); + // + // describe('should work with "Function" value when it returns "true"', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-function-true' + // ), + // }, + // }); + // + // instance = middleware(compiler, { + // writeToDisk: (filePath) => /bundle\.js$/.test(filePath), + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-function-true') + // ); + // + // close(); + // }); + // + // it('should find the bundle file on disk', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // './outputs/write-to-disk-function-true/bundle.js' + // ); + // + // expect(fs.existsSync(bundlePath)).toBe(true); + // + // return done(); + // }); + // }); + // }); + // + // describe('should work with "Function" value when it returns "false"', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-function-false' + // ), + // }, + // }); + // + // instance = middleware(compiler, { + // writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-function-false' + // ) + // ); + // + // close(); + // }); + // + // it('should not find the bundle file on disk', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // './outputs/write-to-disk-function-false/bundle.js' + // ); + // + // expect(fs.existsSync(bundlePath)).toBe(false); + // + // return done(); + // }); + // }); + // }); + // + // describe('should work when assets have query string', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackQueryStringConfig, + // output: { + // filename: 'bundle.js?[contenthash]', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-query-string' + // ), + // }, + // }); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-query-string') + // ); + // + // close(); + // }); + // + // it('should find the bundle file on disk with no querystring', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // './outputs/write-to-disk-query-string/bundle.js' + // ); + // + // expect(fs.existsSync(bundlePath)).toBe(true); + // + // return done(); + // }); + // }); + // }); + // + // describe('should work in multi-compiler mode', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler([ + // { + // ...webpackMultiWatchOptionsConfig[0], + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-multi-compiler/static-one' + // ), + // publicPath: '/static-one/', + // }, + // }, + // { + // ...webpackMultiWatchOptionsConfig[1], + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-multi-compiler/static-two' + // ), + // publicPath: '/static-two/', + // }, + // }, + // ]); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-multi-compiler/' + // ) + // ); + // + // close(); + // }); + // + // it('should find the bundle files on disk', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (firstError) => { + // if (firstError) { + // return done(firstError); + // } + // + // return request(app) + // .get('/static-two/bundle.js') + // .expect(200, (secondError) => { + // if (secondError) { + // return done(secondError); + // } + // const bundleFiles = [ + // './outputs/write-to-disk-multi-compiler/static-one/bundle.js', + // './outputs/write-to-disk-multi-compiler/static-one/index.html', + // './outputs/write-to-disk-multi-compiler/static-one/svg.svg', + // './outputs/write-to-disk-multi-compiler/static-two/bundle.js', + // ]; + // + // for (const bundleFile of bundleFiles) { + // const bundlePath = path.resolve(__dirname, bundleFile); + // + // expect(fs.existsSync(bundlePath)).toBe(true); + // } + // + // return done(); + // }); + // }); + // }); + // }); + // + // describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { + // let compiler; + // let hash; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackConfig, + // ...{ + // output: { + // filename: 'bundle.js', + // publicPath: isWebpack5() + // ? '/static/[fullhash]/' + // : '/static/[hash]/', + // path: isWebpack5() + // ? path.resolve( + // __dirname, + // './outputs/write-to-disk-with-hash/dist_[fullhash]' + // ) + // : path.resolve( + // __dirname, + // './outputs/write-to-disk-with-hash/dist_[hash]' + // ), + // }, + // }, + // }); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(() => { + // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + // hash = h; + // done(); + // }); + // }); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') + // ); + // + // close(); + // }); + // + // it('should find the bundle file on disk', (done) => { + // request(app) + // .get(`/static/${hash}/bundle.js`) + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // const bundlePath = path.resolve( + // __dirname, + // `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` + // ); + // + // expect(fs.existsSync(bundlePath)).toBe(true); + // + // return done(); + // }); + // }); + // }); + //}); + // + //describe('methods option', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { + // methods: ['POST'], + // publicPath: '/public/', + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "POST" request to the bundle file', (done) => { + // request(app).post('/public/bundle.js').expect(200, done); + // }); + // + // it('should return the "404" code for the "GET" request to the bundle file', (done) => { + // request(app).get('/public/bundle.js').expect(404, done); + // }); + // + // it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { + // request(app).head('/public/bundle.js').expect(404, done); + // }); + //}); + // + //describe('headers option', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { + // headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { + // request(app) + // .get('/bundle.js') + // .expect('X-nonsense-1', 'yes') + // .expect('X-nonsense-2', 'no') + // .expect(200, done); + // }); + //}); + // + //describe('publicPath option', () => { + // describe('should work with "string" value', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { publicPath: '/public/' }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the bundle file', (done) => { + // request(app).get('/public/bundle.js').expect(200, done); + // }); + // }); + //}); + // + //describe('serverSideRender option', () => { + // let locals; + // + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { serverSideRender: true }); + // + // app = express(); + // app.use(instance); + // app.use((req, res) => { + // // eslint-disable-next-line prefer-destructuring + // locals = res.locals; + // + // res.sendStatus(200); + // }); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request', (done) => { + // request(app) + // .get('/foo/bar') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // expect(locals.webpack.devMiddleware).toBeDefined(); + // + // return done(); + // }); + // }); + //}); + // + //describe('outputFileSystem option', () => { + // describe('should work with an unspecified value', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should use the "memfs" package by default', () => { + // const { Stats } = memfs; + // + // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + // Stats + // ); + // expect(compiler.outputFileSystem).toHaveProperty('join'); + // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + // }); + // }); + // + // describe('should work with the configured value (native fs)', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // const configuredFs = fs; + // + // configuredFs.join = path.join.bind(path); + // configuredFs.mkdirp = () => {}; + // + // instance = middleware(compiler, { + // outputFileSystem: configuredFs, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should use the configurated output filesystem', () => { + // const { Stats } = fs; + // + // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + // Stats + // ); + // expect(compiler.outputFileSystem).toHaveProperty('join'); + // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + // }); + // }); + // + // describe('should work with the configured value (memfs)', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // const configuredFs = createFsFromVolume(new Volume()); + // + // configuredFs.join = path.join.bind(path); + // + // instance = middleware(compiler, { + // outputFileSystem: configuredFs, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should use the configured output filesystem', () => { + // const { Stats } = memfs; + // + // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + // Stats + // ); + // expect(compiler.outputFileSystem).toHaveProperty('join'); + // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + // }); + // }); + // + // describe('should work with the configured value in multi-compiler mode (native fs)', () => { + // let compiler; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // const configuredFs = fs; + // + // configuredFs.join = path.join.bind(path); + // configuredFs.mkdirp = () => {}; + // + // instance = middleware(compiler, { + // outputFileSystem: configuredFs, + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should use configured output filesystems', () => { + // const { Stats } = fs; + // + // for (const childCompiler of compiler.compilers) { + // expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( + // Stats + // ); + // expect(childCompiler.outputFileSystem).toHaveProperty('join'); + // expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); + // } + // + // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + // Stats + // ); + // expect(instance.context.outputFileSystem).toHaveProperty('join'); + // expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); + // }); + // }); + // + // describe('should throw an error on the invalid fs value - no join method', () => { + // it('should throw an error', () => { + // expect(() => { + // const compiler = getCompiler(webpackConfig); + // + // middleware(compiler, { outputFileSystem: { mkdirp: () => {} } }); + // }).toThrow( + // 'Invalid options: options.outputFileSystem.join() method is expected' + // ); + // }); + // }); + // + // describe('should throw an error on the invalid fs value - no mkdirp method', () => { + // it('should throw an error', () => { + // expect(() => { + // const compiler = getCompiler(webpackConfig); + // + // middleware(compiler, { outputFileSystem: { join: () => {} } }); + // }).toThrow( + // 'Invalid options: options.outputFileSystem.mkdirp() method is expected' + // ); + // }); + // }); + //}); + // + //describe('index option', () => { + // describe('should work with "false" value', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { index: false, publicPath: '/' }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "404" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(404, done); + // }); + // + // it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "true" value', () => { + // beforeAll((done) => { + // const compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { index: true, publicPath: '/' }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/index.html') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "string" value', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // index: 'default.html', + // publicPath: '/', + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'default.html'), + // 'hello' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "string" value with a custom extension', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // index: 'index.custom', + // publicPath: '/', + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'index.custom'), + // 'hello' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // index: 'index.custom', + // mimeTypes: { + // custom: 'text/html', + // }, + // publicPath: '/', + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'index.custom'), + // 'hello' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'text/html; charset=utf-8') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "string" value without an extension', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { index: 'noextension' }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.writeFileSync( + // path.resolve(outputPath, 'noextension'), + // 'hello' + // ); + // }); + // + // afterAll(close); + // + // it('should return the "200" code for the "GET" request to the public path', (done) => { + // request(app) + // .get('/') + // .expect('Content-Type', 'application/octet-stream') + // .expect(200, done); + // }); + // }); + // + // describe('should work with "string" value but the "index" option is a directory', () => { + // beforeAll((done) => { + // const outputPath = path.resolve(__dirname, './outputs/basic'); + // const compiler = getCompiler({ + // ...webpackConfig, + // output: { + // filename: 'bundle.js', + // path: outputPath, + // }, + // }); + // + // instance = middleware(compiler, { + // index: 'custom.html', + // publicPath: '/', + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // + // instance.context.outputFileSystem.mkdirSync(outputPath, { + // recursive: true, + // }); + // instance.context.outputFileSystem.mkdirSync( + // path.resolve(outputPath, 'custom.html') + // ); + // }); + // + // afterAll(close); + // + // it('should return the "404" code for the "GET" request to the public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + // + // describe('should not handle request when index is neither a file nor a directory', () => { + // let compiler; + // let isDirectory; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // instance = middleware(compiler, { + // index: 'default.html', + // publicPath: '/', + // }); + // + // isDirectory = jest + // .spyOn(instance.context.outputFileSystem, 'statSync') + // .mockImplementation(() => { + // return { + // isFile: () => false, + // isDirectory: () => false, + // }; + // }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // isDirectory.mockRestore(); + // + // close(); + // }); + // + // it('should return the "404" code for the "GET" request to the public path', (done) => { + // request(app).get('/').expect(404, done); + // }); + // }); + //}); describe('logger', () => { describe('should logging on successfully build', () => { From 66867952fa7c014e510096b193fa50adbc1d0f23 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 17:56:03 +0300 Subject: [PATCH 31/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 388 ------------ test/middleware.test.js | 684 ++++++++++----------- 2 files changed, 342 insertions(+), 730 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index f3f63eba8..58e023055 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,151 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: -Error: Error in the \\"fs.mkdir\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: -Error: Error in the \\"fs.writeFile\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Error: Error in Watch method", - ], - ], -] -`; - -exports[`middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - exports[`middleware logger should logging on successfully build should logging 1`] = ` Array [ Array [ @@ -185,245 +39,3 @@ Array [ ], ] `; - -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; diff --git a/test/middleware.test.js b/test/middleware.test.js index 88f386cc5..3d3a4d1ad 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,347 +3221,347 @@ describe('middleware', () => { }); }); - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging on unsuccessful build in multi-compiler ', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging an warning', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging warnings in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging an error in "watch" method', () => { - let getLogsPlugin; - - it('should logging on startup', () => { - const compiler = getCompiler(webpackConfig); - - const watchSpy = jest - .spyOn(compiler, 'watch') - .mockImplementation((watchOptions, callback) => { - const error = new Error('Error in Watch method'); - - error.stack = ''; - - callback(error); - - return { close: () => {} }; - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - instance.close(); - - watchSpy.mockRestore(); - }); - }); - - describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let mkdirSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-mkdir-error' - ), - }, - }); - - mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.mkdir" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - ); - - mkdirSpy.mockRestore(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); - - describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let writeFileSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ), - }, - }); - - writeFileSpy = jest - .spyOn(fs, 'writeFile') - .mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.writeFile" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - writeFileSpy.mockRestore(); - - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ) - ); - - close(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging on unsuccessful build in multi-compiler ', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging an warning', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging warnings in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging an error in "watch" method', () => { + // let getLogsPlugin; + // + // it('should logging on startup', () => { + // const compiler = getCompiler(webpackConfig); + // + // const watchSpy = jest + // .spyOn(compiler, 'watch') + // .mockImplementation((watchOptions, callback) => { + // const error = new Error('Error in Watch method'); + // + // error.stack = ''; + // + // callback(error); + // + // return { close: () => {} }; + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // instance.close(); + // + // watchSpy.mockRestore(); + // }); + //}); + // + //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let mkdirSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-mkdir-error' + // ), + // }, + // }); + // + // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.mkdir" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + // ); + // + // mkdirSpy.mockRestore(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + //}); + // + //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let writeFileSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ), + // }, + // }); + // + // writeFileSpy = jest + // .spyOn(fs, 'writeFile') + // .mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.writeFile" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // writeFileSpy.mockRestore(); + // + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ) + // ); + // + // close(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + //}); }); }); From 2bea4c7196cdc8fada1b748dc3544d7c66b7d023 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:02:08 +0300 Subject: [PATCH 32/87] ci: improve --- test/middleware.test.js | 78 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 3d3a4d1ad..3c92554ca 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,45 +3221,45 @@ describe('middleware', () => { }); }); - //describe('should logging on successfully build in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // + describe('should logging on successfully build in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + //describe('should logging on unsuccessful build', () => { // let compiler; // let getLogsPlugin; From e469d2d7e576aabad3838cd948d02e982dca52de Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:13:36 +0300 Subject: [PATCH 33/87] ci: improve --- test/middleware.test.js | 78 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 3c92554ca..f44cff883 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,45 +3260,45 @@ describe('middleware', () => { }); }); - //describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + //describe('should logging on unsuccessful build in multi-compiler ', () => { // let compiler; // let getLogsPlugin; From d61ad728467ccb407cba0d332654216f2391a80d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:20:13 +0300 Subject: [PATCH 34/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 268 +++++++++++++++++++++ test/middleware.test.js | 156 ++++++------ 2 files changed, 346 insertions(+), 78 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 58e023055..34e0875ce 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,113 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware logger should logging an warning should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + +exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + exports[`middleware logger should logging on successfully build should logging 1`] = ` Array [ Array [ @@ -39,3 +147,163 @@ Array [ ], ] `; + +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; diff --git a/test/middleware.test.js b/test/middleware.test.js index f44cff883..f8bdbfc63 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3299,84 +3299,84 @@ describe('middleware', () => { }); }); - //describe('should logging on unsuccessful build in multi-compiler ', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should logging an warning', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // + describe('should logging on unsuccessful build in multi-compiler ', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging an warning', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + //describe('should logging warnings in multi-compiler mode', () => { // let compiler; // let getLogsPlugin; From 4e934055d3e1e7c84692f678e0acfeb21af3b19f Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:23:13 +0300 Subject: [PATCH 35/87] ci: improve --- test/middleware.test.js | 232 ++++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index f8bdbfc63..1427f9ad7 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,122 +3182,122 @@ describe('middleware', () => { //}); describe('logger', () => { - describe('should logging on successfully build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + // + //describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From 81954e656ceaaa2921a99f4b12005826dd339d6d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:27:22 +0300 Subject: [PATCH 36/87] ci: improve --- test/middleware.test.js | 156 ++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 1427f9ad7..16f5218a7 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3220,84 +3220,84 @@ describe('middleware', () => { // }); // }); //}); - // - //describe('should logging on successfully build in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + + describe('should logging on successfully build in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From ad40ce51e4d8c8263937dfdc7d1c1b0b613ee4a6 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:37:03 +0300 Subject: [PATCH 37/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6bea34af0..dde0fd191 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js -u --verbose + run: node_modules/.bin/jest test/middleware.test.js --runInBand --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 From 6b7e48d086bf096a02387ebcb23051228b43defe Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:42:14 +0300 Subject: [PATCH 38/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- test/middleware.test.js | 76 ++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index dde0fd191..014a606a8 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --runInBand --verbose + run: node_modules/.bin/jest test/middleware.test.js --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/middleware.test.js b/test/middleware.test.js index 16f5218a7..e80105480 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3338,44 +3338,44 @@ describe('middleware', () => { }); }); - describe('should logging an warning', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging an warning', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); //describe('should logging warnings in multi-compiler mode', () => { // let compiler; From 11bab6b46b674ff7d476ca84e81d0783d3ac4a3d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:45:53 +0300 Subject: [PATCH 39/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index e80105480..c67e350d7 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,44 +3221,44 @@ describe('middleware', () => { // }); //}); - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build', () => { let compiler; From c269c234a974aaddeb785e722ba5744e6e5e2419 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:51:10 +0300 Subject: [PATCH 40/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index c67e350d7..33e216eb3 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,44 +3260,44 @@ describe('middleware', () => { // }); //}); - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From 21f852c61bc4fa39fd05a9bb45ec417f685acb98 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 18:59:19 +0300 Subject: [PATCH 41/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 54 ----- test/middleware.test.js | 228 ++++++++++----------- 2 files changed, 114 insertions(+), 168 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 34e0875ce..7e078a826 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,59 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 33e216eb3..6e7de1d08 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,122 +3182,122 @@ describe('middleware', () => { //}); describe('logger', () => { - //describe('should logging on successfully build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build', () => { + let compiler; + let getLogsPlugin; - //describe('should logging on successfully build in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + beforeAll((done) => { + compiler = getCompiler(webpackConfig); - //describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging on successfully build in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From 469906c0da4e5f7afa9b21e40e4546cef217f247 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:03:35 +0300 Subject: [PATCH 42/87] ci: improve --- .github/workflows/nodejs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 014a606a8..b1c4ae721 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,11 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --verbose + run: | + launchctl limit maxfiles + ulimit -n 200000 + ulimit -u 65536 + node_modules/.bin/jest test/middleware.test.js --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 From 46d1402f73850b7dd76d56f5176382358c585967 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:12:00 +0300 Subject: [PATCH 43/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 6e7de1d08..e80105480 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,44 +3182,44 @@ describe('middleware', () => { //}); describe('logger', () => { - describe('should logging on successfully build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; From b84946f93e95ebcbcef2f613686ab85570b9f1d4 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:14:56 +0300 Subject: [PATCH 44/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index e80105480..c67e350d7 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,44 +3221,44 @@ describe('middleware', () => { // }); //}); - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build', () => { let compiler; From f59b99a7a8eead9a4f16e24235605fceedbe07a9 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:18:19 +0300 Subject: [PATCH 45/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index c67e350d7..33e216eb3 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,44 +3260,44 @@ describe('middleware', () => { // }); //}); - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From be7194d46bbdd9e1c2ad6e81c8192b83da922e57 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:25:52 +0300 Subject: [PATCH 46/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 206 --------------------- test/middleware.test.js | 2 +- 2 files changed, 1 insertion(+), 207 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 7e078a826..aef81e56a 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,99 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - -exports[`middleware logger should logging on successfully build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ @@ -129,118 +35,6 @@ You may need an appropriate loader to handle this file type, currently no loader Module parse failed: Unexpected token (1:3) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() |", ], ], diff --git a/test/middleware.test.js b/test/middleware.test.js index 33e216eb3..0fdd3f02f 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3327,7 +3327,7 @@ describe('middleware', () => { return done(error); } - instance.invalidate(); + // instance.invalidate(); return instance.waitUntilValid(() => { expect(getLogsPlugin.logs).toMatchSnapshot(); From 09ae227bcce8470055113cd059efb3c6b3ba77ff Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:30:37 +0300 Subject: [PATCH 47/87] ci: improve --- test/middleware.test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 0fdd3f02f..eb0d48063 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3327,13 +3327,14 @@ describe('middleware', () => { return done(error); } + return done(); // instance.invalidate(); - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); + //return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + //}); }); }); }); From 92c8cc272558acb9b8afe0c9c40294e973146a37 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:33:11 +0300 Subject: [PATCH 48/87] ci: improve --- .github/workflows/nodejs.yml | 6 +-- test/__snapshots__/middleware.test.js.snap | 49 ---------------------- test/middleware.test.js | 13 +++--- 3 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 test/__snapshots__/middleware.test.js.snap diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b1c4ae721..014a606a8 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,11 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: | - launchctl limit maxfiles - ulimit -n 200000 - ulimit -u 65536 - node_modules/.bin/jest test/middleware.test.js --verbose + run: node_modules/.bin/jest test/middleware.test.js --verbose - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap deleted file mode 100644 index aef81e56a..000000000 --- a/test/__snapshots__/middleware.test.js.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; diff --git a/test/middleware.test.js b/test/middleware.test.js index eb0d48063..33e216eb3 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3327,14 +3327,13 @@ describe('middleware', () => { return done(error); } - return done(); - // instance.invalidate(); + instance.invalidate(); - //return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - //}); + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); }); }); }); From b25097dcd6f180f7dd8e48449b5c610012322798 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:39:34 +0300 Subject: [PATCH 49/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 235 +++++++++++++++++++++ test/middleware.test.js | 154 +++++++------- 2 files changed, 312 insertions(+), 77 deletions(-) create mode 100644 test/__snapshots__/middleware.test.js.snap diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap new file mode 100644 index 000000000..c43af5961 --- /dev/null +++ b/test/__snapshots__/middleware.test.js.snap @@ -0,0 +1,235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`middleware logger should logging an warning should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; diff --git a/test/middleware.test.js b/test/middleware.test.js index 33e216eb3..f6e40f40b 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3338,84 +3338,84 @@ describe('middleware', () => { }); }); - //describe('should logging an warning', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging an warning', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging warnings in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); - //describe('should logging warnings in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // //describe('should logging an error in "watch" method', () => { // let getLogsPlugin; // From ac88f0489034e8946dfbae786747ac1f9dd4ac77 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:45:51 +0300 Subject: [PATCH 50/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 12 +++++ test/middleware.test.js | 62 +++++++++++----------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index c43af5961..6eb4b52dc 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Error: Error in Watch method", + ], + ], +] +`; + exports[`middleware logger should logging an warning should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index f6e40f40b..8271f46ad 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3416,37 +3416,37 @@ describe('middleware', () => { }); }); - //describe('should logging an error in "watch" method', () => { - // let getLogsPlugin; - // - // it('should logging on startup', () => { - // const compiler = getCompiler(webpackConfig); - // - // const watchSpy = jest - // .spyOn(compiler, 'watch') - // .mockImplementation((watchOptions, callback) => { - // const error = new Error('Error in Watch method'); - // - // error.stack = ''; - // - // callback(error); - // - // return { close: () => {} }; - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // instance.close(); - // - // watchSpy.mockRestore(); - // }); - //}); - // + describe('should logging an error in "watch" method', () => { + let getLogsPlugin; + + it('should logging on startup', () => { + const compiler = getCompiler(webpackConfig); + + const watchSpy = jest + .spyOn(compiler, 'watch') + .mockImplementation((watchOptions, callback) => { + const error = new Error('Error in Watch method'); + + error.stack = ''; + + callback(error); + + return { close: () => {} }; + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + instance.close(); + + watchSpy.mockRestore(); + }); + }); + //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { // let compiler; // let getLogsPlugin; From f78f57a37e783e35200cf9306ff16d4fad016931 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:49:39 +0300 Subject: [PATCH 51/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 13 +++ test/middleware.test.js | 110 ++++++++++----------- 2 files changed, 68 insertions(+), 55 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 6eb4b52dc..c59648ab4 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: +Error: Error in the \\"fs.mkdir\\" method.", + ], + ], +] +`; + exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 8271f46ad..07e8238b2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3447,61 +3447,61 @@ describe('middleware', () => { }); }); - //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let mkdirSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-mkdir-error' - // ), - // }, - // }); - // - // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.mkdir" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - // ); - // - // mkdirSpy.mockRestore(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); - // + describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let mkdirSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-mkdir-error' + ), + }, + }); + + mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.mkdir" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + ); + + mkdirSpy.mockRestore(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); + //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { // let compiler; // let getLogsPlugin; From 7c0fff3014e6c30bd61743727994e55e6c6c981b Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:54:14 +0300 Subject: [PATCH 52/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 13 +++ test/middleware.test.js | 122 ++++++++++----------- 2 files changed, 74 insertions(+), 61 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index c59648ab4..c91237e34 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -13,6 +13,19 @@ Error: Error in the \\"fs.mkdir\\" method.", ] `; +exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: +Error: Error in the \\"fs.writeFile\\" method.", + ], + ], +] +`; + exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 07e8238b2..ec770af6c 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3502,66 +3502,66 @@ describe('middleware', () => { }); }); - //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let writeFileSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ), - // }, - // }); - // - // writeFileSpy = jest - // .spyOn(fs, 'writeFile') - // .mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.writeFile" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // writeFileSpy.mockRestore(); - // - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ) - // ); - // - // close(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); + describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let writeFileSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ), + }, + }); + + writeFileSpy = jest + .spyOn(fs, 'writeFile') + .mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.writeFile" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + writeFileSpy.mockRestore(); + + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ) + ); + + close(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); }); }); From 921323451dae36832d23a674424d6ab7eccc3788 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 19:57:30 +0300 Subject: [PATCH 53/87] ci: improve --- test/middleware.test.js | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index ec770af6c..c5bb227ba 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,44 +3260,44 @@ describe('middleware', () => { // }); //}); - //describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From 812316aa8726c37eb9edf3903be7bf0543a4df1a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:00:55 +0300 Subject: [PATCH 54/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 116 +++++++++++++++++++++ test/middleware.test.js | 76 +++++++------- 2 files changed, 154 insertions(+), 38 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index c91237e34..eb6fd2f73 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -92,6 +92,60 @@ Array [ ] `; +exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ @@ -190,6 +244,68 @@ You may need an appropriate loader to handle this file type, currently no loader ] `; +exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index c5bb227ba..2fa19be1e 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,44 +3221,44 @@ describe('middleware', () => { // }); //}); - //describe('should logging on successfully build in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on unsuccessful build', () => { let compiler; From 69b5d4278a809aaa16f9cec7820da165f1858aa6 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:06:03 +0300 Subject: [PATCH 55/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 18 +---- test/middleware.test.js | 84 +++++++++++----------- 2 files changed, 44 insertions(+), 58 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index eb6fd2f73..9b925b7b9 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -92,20 +92,13 @@ Array [ ] `; -exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` +exports[`middleware logger should logging on successfully build should logging 1`] = ` Array [ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", + "wait until bundle finished: /bundle.js", ], ], Array [ @@ -136,13 +129,6 @@ Array [ "Compiled successfully.", ], ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], ] `; diff --git a/test/middleware.test.js b/test/middleware.test.js index 2fa19be1e..2cfa6166e 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,51 +3182,12 @@ describe('middleware', () => { //}); describe('logger', () => { - //describe('should logging on successfully build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - - describe('should logging on successfully build in multi-compiler mode', () => { + describe('should logging on successfully build', () => { let compiler; let getLogsPlugin; beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); + compiler = getCompiler(webpackConfig); getLogsPlugin = new GetLogsPlugin(); getLogsPlugin.apply(compiler); @@ -3243,7 +3204,7 @@ describe('middleware', () => { it('should logging', (done) => { request(app) - .get('/static-one/bundle.js') + .get('/bundle.js') .expect(200, (error) => { if (error) { return done(error); @@ -3260,6 +3221,45 @@ describe('middleware', () => { }); }); + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); + describe('should logging on unsuccessful build', () => { let compiler; let getLogsPlugin; From c700cc8a91849c498c1f416e94f2968400e5a371 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:10:16 +0300 Subject: [PATCH 56/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 328 +---------- test/middleware.test.js | 616 ++++++++++----------- 2 files changed, 312 insertions(+), 632 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 9b925b7b9..e64da1ae9 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,104 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: -Error: Error in the \\"fs.mkdir\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: -Error: Error in the \\"fs.writeFile\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Error: Error in Watch method", - ], - ], -] -`; - -exports[`middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - -exports[`middleware logger should logging on successfully build should logging 1`] = ` +exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /bundle.js", + "wait until bundle finished: /static-one/bundle.js", ], ], Array [ @@ -108,20 +16,6 @@ Array [ "Compiled successfully.", ], ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], Array [ "webpack-dev-middleware", "info", @@ -129,206 +23,6 @@ Array [ "Compiled successfully.", ], ], -] -`; - -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - -exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], Array [ "webpack-dev-middleware", "info", @@ -343,32 +37,18 @@ Array [ "wait until bundle finished", ], ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", + "Compiled successfully.", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Compiled successfully.", ], ], ] diff --git a/test/middleware.test.js b/test/middleware.test.js index 2cfa6166e..38c0401ce 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,51 +3182,12 @@ describe('middleware', () => { //}); describe('logger', () => { - describe('should logging on successfully build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - //describe('should logging on successfully build in multi-compiler mode', () => { + //describe('should logging on successfully build', () => { // let compiler; // let getLogsPlugin; // // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); + // compiler = getCompiler(webpackConfig); // // getLogsPlugin = new GetLogsPlugin(); // getLogsPlugin.apply(compiler); @@ -3243,7 +3204,7 @@ describe('middleware', () => { // // it('should logging', (done) => { // request(app) - // .get('/static-one/bundle.js') + // .get('/bundle.js') // .expect(200, (error) => { // if (error) { // return done(error); @@ -3260,51 +3221,12 @@ describe('middleware', () => { // }); //}); - describe('should logging on unsuccessful build', () => { + describe('should logging on successfully build in multi-compiler mode', () => { let compiler; let getLogsPlugin; beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging on unsuccessful build in multi-compiler ', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiErrorConfig); + compiler = getCompiler(webpackMultiConfig); getLogsPlugin = new GetLogsPlugin(); getLogsPlugin.apply(compiler); @@ -3338,230 +3260,308 @@ describe('middleware', () => { }); }); - describe('should logging an warning', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging warnings in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - describe('should logging an error in "watch" method', () => { - let getLogsPlugin; - - it('should logging on startup', () => { - const compiler = getCompiler(webpackConfig); - - const watchSpy = jest - .spyOn(compiler, 'watch') - .mockImplementation((watchOptions, callback) => { - const error = new Error('Error in Watch method'); - - error.stack = ''; - - callback(error); - - return { close: () => {} }; - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - instance.close(); - - watchSpy.mockRestore(); - }); - }); - - describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let mkdirSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-mkdir-error' - ), - }, - }); - - mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.mkdir" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - ); - - mkdirSpy.mockRestore(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); - - describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let writeFileSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ), - }, - }); - - writeFileSpy = jest - .spyOn(fs, 'writeFile') - .mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.writeFile" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - writeFileSpy.mockRestore(); - - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ) - ); - - close(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); + // describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should logging on unsuccessful build in multi-compiler ', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should logging an warning', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should logging warnings in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + // }); + // + // describe('should logging an error in "watch" method', () => { + // let getLogsPlugin; + // + // it('should logging on startup', () => { + // const compiler = getCompiler(webpackConfig); + // + // const watchSpy = jest + // .spyOn(compiler, 'watch') + // .mockImplementation((watchOptions, callback) => { + // const error = new Error('Error in Watch method'); + // + // error.stack = ''; + // + // callback(error); + // + // return { close: () => {} }; + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // instance.close(); + // + // watchSpy.mockRestore(); + // }); + // }); + // + // describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let mkdirSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-mkdir-error' + // ), + // }, + // }); + // + // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.mkdir" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + // ); + // + // mkdirSpy.mockRestore(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + // }); + // + // describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let writeFileSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ), + // }, + // }); + // + // writeFileSpy = jest + // .spyOn(fs, 'writeFile') + // .mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.writeFile" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // writeFileSpy.mockRestore(); + // + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ) + // ); + // + // close(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + // }); }); }); From 378207b187a09d5466d54cd9aa549767f36bd239 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:13:16 +0300 Subject: [PATCH 57/87] ci: improve --- test/middleware.test.js | 438 ++++++++++++++++++++-------------------- 1 file changed, 219 insertions(+), 219 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 38c0401ce..136dced33 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,308 +3260,308 @@ describe('middleware', () => { }); }); - // describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + //describe('should logging on unsuccessful build in multi-compiler ', () => { + // let compiler; + // let getLogsPlugin; // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiErrorConfig); // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // instance = middleware(compiler); + // instance = middleware(compiler); // - // app = express(); - // app.use(instance); + // app = express(); + // app.use(instance); // - // listen = listenShorthand(done); - // }); + // listen = listenShorthand(done); + // }); // - // afterAll(close); + // afterAll(close); // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } // - // instance.invalidate(); + // instance.invalidate(); // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // done(); - // }); + // done(); // }); - // }); + // }); // }); + //}); // - // describe('should logging on unsuccessful build in multi-compiler ', () => { - // let compiler; - // let getLogsPlugin; + //describe('should logging an warning', () => { + // let compiler; + // let getLogsPlugin; // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiErrorConfig); + // beforeAll((done) => { + // compiler = getCompiler(webpackWarningConfig); // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // instance = middleware(compiler); + // instance = middleware(compiler); // - // app = express(); - // app.use(instance); + // app = express(); + // app.use(instance); // - // listen = listenShorthand(done); - // }); + // listen = listenShorthand(done); + // }); // - // afterAll(close); + // afterAll(close); // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } // - // instance.invalidate(); + // instance.invalidate(); // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // done(); - // }); + // done(); // }); - // }); + // }); // }); + //}); // - // describe('should logging an warning', () => { - // let compiler; - // let getLogsPlugin; + //describe('should logging warnings in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; // - // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // instance = middleware(compiler); + // instance = middleware(compiler); // - // app = express(); - // app.use(instance); + // app = express(); + // app.use(instance); // - // listen = listenShorthand(done); - // }); + // listen = listenShorthand(done); + // }); // - // afterAll(close); + // afterAll(close); // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } // - // instance.invalidate(); + // instance.invalidate(); // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // done(); - // }); + // done(); // }); - // }); + // }); // }); + //}); // - // describe('should logging warnings in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; + //describe('should logging an error in "watch" method', () => { + // let getLogsPlugin; // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); + // it('should logging on startup', () => { + // const compiler = getCompiler(webpackConfig); // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // const watchSpy = jest + // .spyOn(compiler, 'watch') + // .mockImplementation((watchOptions, callback) => { + // const error = new Error('Error in Watch method'); // - // instance = middleware(compiler); + // error.stack = ''; // - // app = express(); - // app.use(instance); + // callback(error); // - // listen = listenShorthand(done); - // }); + // return { close: () => {} }; + // }); // - // afterAll(close); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } + // instance = middleware(compiler); // - // instance.invalidate(); + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // instance.close(); // - // done(); - // }); - // }); - // }); + // watchSpy.mockRestore(); // }); + //}); // - // describe('should logging an error in "watch" method', () => { - // let getLogsPlugin; - // - // it('should logging on startup', () => { - // const compiler = getCompiler(webpackConfig); + //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let mkdirSpy; // - // const watchSpy = jest - // .spyOn(compiler, 'watch') - // .mockImplementation((watchOptions, callback) => { - // const error = new Error('Error in Watch method'); + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-mkdir-error' + // ), + // }, + // }); // - // error.stack = ''; + // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + // const callback = args[args.length - 1]; // - // callback(error); + // return callback(new Error('Error in the "fs.mkdir" method.')); + // }); // - // return { close: () => {} }; - // }); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // instance = middleware(compiler, { writeToDisk: true }); // - // instance = middleware(compiler); + // app = express(); + // app.use(instance); // - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // listen = listenShorthand(done); + // }); // - // instance.close(); + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + // ); // - // watchSpy.mockRestore(); - // }); + // mkdirSpy.mockRestore(); // }); // - // describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let mkdirSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-mkdir-error' - // ), - // }, - // }); - // - // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - // const callback = args[args.length - 1]; + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // return callback(new Error('Error in the "fs.mkdir" method.')); + // listen.close(() => { + // done(); + // }); // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); // }); + // }); + //}); // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - // ); + //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let writeFileSpy; // - // mkdirSpy.mockRestore(); + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ), + // }, // }); // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - // }); + // writeFileSpy = jest + // .spyOn(fs, 'writeFile') + // .mockImplementation((...args) => { + // const callback = args[args.length - 1]; // - // describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let writeFileSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ), - // }, + // return callback(new Error('Error in the "fs.writeFile" method.')); // }); // - // writeFileSpy = jest - // .spyOn(fs, 'writeFile') - // .mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.writeFile" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); // - // instance = middleware(compiler, { writeToDisk: true }); + // instance = middleware(compiler, { writeToDisk: true }); // - // app = express(); - // app.use(instance); + // app = express(); + // app.use(instance); // - // listen = listenShorthand(done); - // }); + // listen = listenShorthand(done); + // }); // - // afterAll(() => { - // writeFileSpy.mockRestore(); + // afterAll(() => { + // writeFileSpy.mockRestore(); // - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ) - // ); + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ) + // ); // - // close(); - // }); + // close(); + // }); // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); // - // listen.close(() => { - // done(); - // }); + // listen.close(() => { + // done(); // }); // }); // }); // }); + //}); }); }); From 65ebd88a000fc16d7a34fe453a83eac3dd0b4aa3 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:18:38 +0300 Subject: [PATCH 58/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 334 +++++++++++++ test/middleware.test.js | 528 ++++++++++----------- 2 files changed, 598 insertions(+), 264 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index e64da1ae9..eb6fd2f73 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,97 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: +Error: Error in the \\"fs.mkdir\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: +Error: Error in the \\"fs.writeFile\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Error: Error in Watch method", + ], + ], +] +`; + +exports[`middleware logger should logging an warning should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ @@ -53,3 +145,245 @@ Array [ ], ] `; + +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + +exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; diff --git a/test/middleware.test.js b/test/middleware.test.js index 136dced33..2fa19be1e 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3299,269 +3299,269 @@ describe('middleware', () => { }); }); - //describe('should logging on unsuccessful build in multi-compiler ', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should logging an warning', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should logging warnings in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); - // - //describe('should logging an error in "watch" method', () => { - // let getLogsPlugin; - // - // it('should logging on startup', () => { - // const compiler = getCompiler(webpackConfig); - // - // const watchSpy = jest - // .spyOn(compiler, 'watch') - // .mockImplementation((watchOptions, callback) => { - // const error = new Error('Error in Watch method'); - // - // error.stack = ''; - // - // callback(error); - // - // return { close: () => {} }; - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // instance.close(); - // - // watchSpy.mockRestore(); - // }); - //}); - // - //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let mkdirSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-mkdir-error' - // ), - // }, - // }); - // - // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.mkdir" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - // ); - // - // mkdirSpy.mockRestore(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); - // - //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let writeFileSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ), - // }, - // }); - // - // writeFileSpy = jest - // .spyOn(fs, 'writeFile') - // .mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.writeFile" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // writeFileSpy.mockRestore(); - // - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ) - // ); - // - // close(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); + describe('should logging on unsuccessful build in multi-compiler ', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging an warning', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging warnings in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should logging an error in "watch" method', () => { + let getLogsPlugin; + + it('should logging on startup', () => { + const compiler = getCompiler(webpackConfig); + + const watchSpy = jest + .spyOn(compiler, 'watch') + .mockImplementation((watchOptions, callback) => { + const error = new Error('Error in Watch method'); + + error.stack = ''; + + callback(error); + + return { close: () => {} }; + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + instance.close(); + + watchSpy.mockRestore(); + }); + }); + + describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let mkdirSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-mkdir-error' + ), + }, + }); + + mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.mkdir" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + ); + + mkdirSpy.mockRestore(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); + + describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let writeFileSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ), + }, + }); + + writeFileSpy = jest + .spyOn(fs, 'writeFile') + .mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.writeFile" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + writeFileSpy.mockRestore(); + + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ) + ); + + close(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); }); }); From 7932fba1f0697f5761d0c695c9696d1f1dce96d4 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:21:16 +0300 Subject: [PATCH 59/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 13 --- test/middleware.test.js | 122 ++++++++++----------- 2 files changed, 61 insertions(+), 74 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index eb6fd2f73..5f843e40f 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -13,19 +13,6 @@ Error: Error in the \\"fs.mkdir\\" method.", ] `; -exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: -Error: Error in the \\"fs.writeFile\\" method.", - ], - ], -] -`; - exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 2fa19be1e..d6ab27145 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3502,66 +3502,66 @@ describe('middleware', () => { }); }); - describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let writeFileSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ), - }, - }); - - writeFileSpy = jest - .spyOn(fs, 'writeFile') - .mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.writeFile" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - writeFileSpy.mockRestore(); - - del.sync( - path.posix.resolve( - __dirname, - './outputs/write-to-disk-writeFile-error' - ) - ); - - close(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); + //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let writeFileSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ), + // }, + // }); + // + // writeFileSpy = jest + // .spyOn(fs, 'writeFile') + // .mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.writeFile" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // writeFileSpy.mockRestore(); + // + // del.sync( + // path.posix.resolve( + // __dirname, + // './outputs/write-to-disk-writeFile-error' + // ) + // ); + // + // close(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + //}); }); }); From 054751814af1ed9a64683f67338c23416f804b96 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:28:22 +0300 Subject: [PATCH 60/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 25 --- test/middleware.test.js | 170 ++++++++++----------- 2 files changed, 85 insertions(+), 110 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 5f843e40f..73d0af08a 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,30 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: -Error: Error in the \\"fs.mkdir\\" method.", - ], - ], -] -`; - -exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Error: Error in Watch method", - ], - ], -] -`; - exports[`middleware logger should logging an warning should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index d6ab27145..bc4e185ec 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3416,91 +3416,91 @@ describe('middleware', () => { }); }); - describe('should logging an error in "watch" method', () => { - let getLogsPlugin; - - it('should logging on startup', () => { - const compiler = getCompiler(webpackConfig); - - const watchSpy = jest - .spyOn(compiler, 'watch') - .mockImplementation((watchOptions, callback) => { - const error = new Error('Error in Watch method'); - - error.stack = ''; - - callback(error); - - return { close: () => {} }; - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - instance.close(); - - watchSpy.mockRestore(); - }); - }); - - describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - let compiler; - let getLogsPlugin; - let mkdirSpy; - - beforeAll((done) => { - compiler = getCompiler({ - ...webpackSimpleConfig, - output: { - filename: 'bundle.js', - path: path.resolve( - __dirname, - './outputs/write-to-disk-mkdir-error' - ), - }, - }); - - mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - const callback = args[args.length - 1]; - - return callback(new Error('Error in the "fs.mkdir" method.')); - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler, { writeToDisk: true }); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(() => { - del.sync( - path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - ); - - mkdirSpy.mockRestore(); - }); - - it('should logging', (done) => { - compiler.hooks.failed.tap('FailedCatcher', () => { - instance.close(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - listen.close(() => { - done(); - }); - }); - }); - }); - }); + //describe('should logging an error in "watch" method', () => { + // let getLogsPlugin; + // + // it('should logging on startup', () => { + // const compiler = getCompiler(webpackConfig); + // + // const watchSpy = jest + // .spyOn(compiler, 'watch') + // .mockImplementation((watchOptions, callback) => { + // const error = new Error('Error in Watch method'); + // + // error.stack = ''; + // + // callback(error); + // + // return { close: () => {} }; + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // instance.close(); + // + // watchSpy.mockRestore(); + // }); + //}); + // + //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + // let compiler; + // let getLogsPlugin; + // let mkdirSpy; + // + // beforeAll((done) => { + // compiler = getCompiler({ + // ...webpackSimpleConfig, + // output: { + // filename: 'bundle.js', + // path: path.resolve( + // __dirname, + // './outputs/write-to-disk-mkdir-error' + // ), + // }, + // }); + // + // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + // const callback = args[args.length - 1]; + // + // return callback(new Error('Error in the "fs.mkdir" method.')); + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler, { writeToDisk: true }); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(() => { + // del.sync( + // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + // ); + // + // mkdirSpy.mockRestore(); + // }); + // + // it('should logging', (done) => { + // compiler.hooks.failed.tap('FailedCatcher', () => { + // instance.close(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // listen.close(() => { + // done(); + // }); + // }); + // }); + // }); + //}); //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { // let compiler; From d76370e1d1957c99947d448bbd139678ffb04e30 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:32:27 +0300 Subject: [PATCH 61/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 12 +++++ test/middleware.test.js | 62 +++++++++++----------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 73d0af08a..8bd6a0c79 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Error: Error in Watch method", + ], + ], +] +`; + exports[`middleware logger should logging an warning should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index bc4e185ec..ce98b48eb 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3416,37 +3416,37 @@ describe('middleware', () => { }); }); - //describe('should logging an error in "watch" method', () => { - // let getLogsPlugin; - // - // it('should logging on startup', () => { - // const compiler = getCompiler(webpackConfig); - // - // const watchSpy = jest - // .spyOn(compiler, 'watch') - // .mockImplementation((watchOptions, callback) => { - // const error = new Error('Error in Watch method'); - // - // error.stack = ''; - // - // callback(error); - // - // return { close: () => {} }; - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // instance.close(); - // - // watchSpy.mockRestore(); - // }); - //}); - // + describe('should logging an error in "watch" method', () => { + let getLogsPlugin; + + it('should logging on startup', () => { + const compiler = getCompiler(webpackConfig); + + const watchSpy = jest + .spyOn(compiler, 'watch') + .mockImplementation((watchOptions, callback) => { + const error = new Error('Error in Watch method'); + + error.stack = ''; + + callback(error); + + return { close: () => {} }; + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + instance.close(); + + watchSpy.mockRestore(); + }); + }); + //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { // let compiler; // let getLogsPlugin; From b44c9b1092a15b851f9cc599c7136356321f969d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:36:49 +0300 Subject: [PATCH 62/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 52 ++++++-- test/middleware.test.js | 136 ++++++++++----------- 2 files changed, 108 insertions(+), 80 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 8bd6a0c79..aaaef7ffe 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,17 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "error", - Array [ - "Error: Error in Watch method", - ], - ], -] -`; - exports[`middleware logger should logging an warning should logging 1`] = ` Array [ Array [ @@ -120,6 +108,46 @@ Array [ ] `; +exports[`middleware logger should logging on successfully build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index ce98b48eb..ffecf00ee 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,44 +3182,44 @@ describe('middleware', () => { //}); describe('logger', () => { - //describe('should logging on successfully build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; @@ -3416,36 +3416,36 @@ describe('middleware', () => { }); }); - describe('should logging an error in "watch" method', () => { - let getLogsPlugin; - - it('should logging on startup', () => { - const compiler = getCompiler(webpackConfig); - - const watchSpy = jest - .spyOn(compiler, 'watch') - .mockImplementation((watchOptions, callback) => { - const error = new Error('Error in Watch method'); - - error.stack = ''; - - callback(error); - - return { close: () => {} }; - }); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - instance.close(); - - watchSpy.mockRestore(); - }); - }); + //describe('should logging an error in "watch" method', () => { + // let getLogsPlugin; + // + // it('should logging on startup', () => { + // const compiler = getCompiler(webpackConfig); + // + // const watchSpy = jest + // .spyOn(compiler, 'watch') + // .mockImplementation((watchOptions, callback) => { + // const error = new Error('Error in Watch method'); + // + // error.stack = ''; + // + // callback(error); + // + // return { close: () => {} }; + // }); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // instance.close(); + // + // watchSpy.mockRestore(); + // }); + //}); //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { // let compiler; From 80999100f6ffdadf4dd6e12a2c306df1efdfcc9e Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:49:42 +0300 Subject: [PATCH 63/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 54 --------------- test/middleware.test.js | 76 +++++++++++----------- 2 files changed, 38 insertions(+), 92 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index aaaef7ffe..9fdbe1bee 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,59 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging an warning should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled with warnings.", - ], - ], -] -`; - exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index ffecf00ee..422a2144b 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3338,44 +3338,44 @@ describe('middleware', () => { }); }); - describe('should logging an warning', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging an warning', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging warnings in multi-compiler mode', () => { let compiler; From 94a64a85aa28ae0983b9868449f0b7f7dbca8b76 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 20:56:33 +0300 Subject: [PATCH 64/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 62 ------------------ test/middleware.test.js | 76 +++++++++++----------- 2 files changed, 38 insertions(+), 100 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 9fdbe1bee..b72c89096 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -192,68 +192,6 @@ You may need an appropriate loader to handle this file type, currently no loader ] `; -exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], -] -`; - exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 422a2144b..bbe1073af 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3260,44 +3260,44 @@ describe('middleware', () => { }); }); - describe('should logging on unsuccessful build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on unsuccessful build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackErrorConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; From 773b5236cfedbaad9c47aa19bba8f0f2cbc90a34 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:02:34 +0300 Subject: [PATCH 65/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 40 ------------ test/middleware.test.js | 76 +++++++++++----------- 2 files changed, 38 insertions(+), 78 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index b72c89096..3d72d1b56 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -54,46 +54,6 @@ Array [ ] `; -exports[`middleware logger should logging on successfully build should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index bbe1073af..2f7e80c10 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,44 +3182,44 @@ describe('middleware', () => { //}); describe('logger', () => { - describe('should logging on successfully build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; From e1ed1cfc726ae29ce3928dd23c502799b5fc50ce Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:06:50 +0300 Subject: [PATCH 66/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 54 --------------- test/middleware.test.js | 76 +++++++++++----------- 2 files changed, 38 insertions(+), 92 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 3d72d1b56..bafb62d30 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,59 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` -Array [ - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiling...", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "wait until bundle finished", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Compiled successfully.", - ], - ], -] -`; - exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 2f7e80c10..b5391a070 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,44 +3221,44 @@ describe('middleware', () => { // }); //}); - describe('should logging on successfully build in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); //describe('should logging on unsuccessful build', () => { // let compiler; From ef3408f302a4ba7658bdb2c2c4a8575761f3bf96 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:09:42 +0300 Subject: [PATCH 67/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 96 +++++-------- test/middleware.test.js | 152 ++++++++++----------- 2 files changed, 110 insertions(+), 138 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index bafb62d30..23a4d2525 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ "webpack-dev-middleware", @@ -9,40 +9,18 @@ Array [ "wait until bundle finished: /static-one/bundle.js", ], ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "Compiled successfully.", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled successfully.", ], ], Array [ @@ -59,46 +37,24 @@ You may need an appropriate loader to handle this file type, currently no loader "wait until bundle finished", ], ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "Compiled successfully.", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled successfully.", ], ], ] `; -exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ "webpack-dev-middleware", @@ -109,30 +65,38 @@ Array [ ], Array [ "webpack-dev-middleware", - "warn", + "error", Array [ - "WARNING in Warning", + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Failed to compile.", ], ], Array [ "webpack-dev-middleware", - "warn", + "error", Array [ - "WARNING in Warning", + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Failed to compile.", ], ], Array [ @@ -151,30 +115,38 @@ Array [ ], Array [ "webpack-dev-middleware", - "warn", + "error", Array [ - "WARNING in Warning", + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Failed to compile.", ], ], Array [ "webpack-dev-middleware", - "warn", + "error", Array [ - "WARNING in Warning", + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Failed to compile.", ], ], ] diff --git a/test/middleware.test.js b/test/middleware.test.js index b5391a070..58652f413 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3221,44 +3221,44 @@ describe('middleware', () => { // }); //}); - //describe('should logging on successfully build in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); //describe('should logging on unsuccessful build', () => { // let compiler; @@ -3377,44 +3377,44 @@ describe('middleware', () => { // }); //}); - describe('should logging warnings in multi-compiler mode', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiWarningConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging warnings in multi-compiler mode', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackMultiWarningConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/static-one/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); //describe('should logging an error in "watch" method', () => { // let getLogsPlugin; From 94efd4a6f941bbdf712625568023d4a66beb6325 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:17:42 +0300 Subject: [PATCH 68/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 42 ++++------ test/middleware.test.js | 90 +++++++++++----------- 2 files changed, 58 insertions(+), 74 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 23a4d2525..ba41db34f 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -54,7 +54,7 @@ Array [ ] `; -exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` Array [ Array [ "webpack-dev-middleware", @@ -65,38 +65,30 @@ Array [ ], Array [ "webpack-dev-middleware", - "error", + "warn", Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled with warnings.", ], ], Array [ "webpack-dev-middleware", - "error", + "warn", Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled with warnings.", ], ], Array [ @@ -115,38 +107,30 @@ You may need an appropriate loader to handle this file type, currently no loader ], Array [ "webpack-dev-middleware", - "error", + "warn", Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled with warnings.", ], ], Array [ "webpack-dev-middleware", - "error", + "warn", Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Failed to compile.", + "Compiled with warnings.", ], ], ] diff --git a/test/middleware.test.js b/test/middleware.test.js index 58652f413..246dae008 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3299,51 +3299,12 @@ describe('middleware', () => { // }); //}); - describe('should logging on unsuccessful build in multi-compiler ', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackMultiErrorConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/static-one/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); - - //describe('should logging an warning', () => { + //describe('should logging on unsuccessful build in multi-compiler ', () => { // let compiler; // let getLogsPlugin; // // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); + // compiler = getCompiler(webpackMultiErrorConfig); // // getLogsPlugin = new GetLogsPlugin(); // getLogsPlugin.apply(compiler); @@ -3360,7 +3321,7 @@ describe('middleware', () => { // // it('should logging', (done) => { // request(app) - // .get('/bundle.js') + // .get('/static-one/bundle.js') // .expect(200, (error) => { // if (error) { // return done(error); @@ -3377,12 +3338,12 @@ describe('middleware', () => { // }); //}); - //describe('should logging warnings in multi-compiler mode', () => { + //describe('should logging an warning', () => { // let compiler; // let getLogsPlugin; // // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); + // compiler = getCompiler(webpackWarningConfig); // // getLogsPlugin = new GetLogsPlugin(); // getLogsPlugin.apply(compiler); @@ -3399,7 +3360,7 @@ describe('middleware', () => { // // it('should logging', (done) => { // request(app) - // .get('/static-one/bundle.js') + // .get('/bundle.js') // .expect(200, (error) => { // if (error) { // return done(error); @@ -3416,6 +3377,45 @@ describe('middleware', () => { // }); //}); + describe('should logging warnings in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); + //describe('should logging an error in "watch" method', () => { // let getLogsPlugin; // From 5e975c1a918508a38f359059a30dae63b144208e Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:20:51 +0300 Subject: [PATCH 69/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 98 ++++++++++++++++++++++ test/middleware.test.js | 76 ++++++++--------- 2 files changed, 136 insertions(+), 38 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index ba41db34f..3d72d1b56 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -54,6 +54,104 @@ Array [ ] `; +exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 246dae008..2f7e80c10 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3299,44 +3299,44 @@ describe('middleware', () => { // }); //}); - //describe('should logging on unsuccessful build in multi-compiler ', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on unsuccessful build in multi-compiler ', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); //describe('should logging an warning', () => { // let compiler; From cabbcd3354324e86b63b2d307449d3e31d6df06d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:50:38 +0300 Subject: [PATCH 70/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- test/middleware.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 014a606a8..262af4a48 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --verbose + run: node_modules/.bin/jest test/middleware.test.js --verbose || ls -l - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/test/middleware.test.js b/test/middleware.test.js index 2f7e80c10..9596a4bb9 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3249,9 +3249,13 @@ describe('middleware', () => { return done(error); } + fs.writeFile(path.resolve(process.cwd(), './1-1'), 'HERE'); + instance.invalidate(); return instance.waitUntilValid(() => { + fs.writeFile(path.resolve(process.cwd(), './1-2'), 'HERE'); + expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3327,9 +3331,13 @@ describe('middleware', () => { return done(error); } + fs.writeFile(path.resolve(process.cwd(), './2-1'), 'HERE'); + instance.invalidate(); return instance.waitUntilValid(() => { + fs.writeFile(path.resolve(process.cwd(), './2-2'), 'HERE'); + expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3405,9 +3413,13 @@ describe('middleware', () => { return done(error); } + fs.writeFile(path.resolve(process.cwd(), './3-1'), 'HERE'); + instance.invalidate(); return instance.waitUntilValid(() => { + fs.writeFile(path.resolve(process.cwd(), './3-2'), 'HERE'); + expect(getLogsPlugin.logs).toMatchSnapshot(); done(); From 2d19bd5ddd8358b60d42dd987d72b62bcafb8fbe Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 21:55:39 +0300 Subject: [PATCH 71/87] ci: improve --- test/middleware.test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 9596a4bb9..58fca6291 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3389,36 +3389,48 @@ describe('middleware', () => { let compiler; let getLogsPlugin; + fs.writeFile(path.resolve(process.cwd(), './3-1'), 'HERE'); + beforeAll((done) => { + fs.writeFile(path.resolve(process.cwd(), './3-2'), 'HERE'); compiler = getCompiler(webpackMultiWarningConfig); + fs.writeFile(path.resolve(process.cwd(), './3-3'), 'HERE'); getLogsPlugin = new GetLogsPlugin(); getLogsPlugin.apply(compiler); + fs.writeFile(path.resolve(process.cwd(), './3-4'), 'HERE'); instance = middleware(compiler); + fs.writeFile(path.resolve(process.cwd(), './3-5'), 'HERE'); app = express(); app.use(instance); + fs.writeFile(path.resolve(process.cwd(), './3-6'), 'HERE'); listen = listenShorthand(done); + fs.writeFile(path.resolve(process.cwd(), './3-7'), 'HERE'); }); afterAll(close); it('should logging', (done) => { + fs.writeFile(path.resolve(process.cwd(), './3-8'), 'HERE'); + request(app) .get('/static-one/bundle.js') .expect(200, (error) => { + fs.writeFile(path.resolve(process.cwd(), './3-9'), 'HERE'); + if (error) { return done(error); } - fs.writeFile(path.resolve(process.cwd(), './3-1'), 'HERE'); + fs.writeFile(path.resolve(process.cwd(), './3-10'), 'HERE'); instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFile(path.resolve(process.cwd(), './3-2'), 'HERE'); + fs.writeFile(path.resolve(process.cwd(), './3-11'), 'HERE'); expect(getLogsPlugin.logs).toMatchSnapshot(); From cb4494b445bf645e9fe64719f69ed741d6dea727 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:02:20 +0300 Subject: [PATCH 72/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 262af4a48..918f90ebe 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --verbose || ls -l + run: node_modules/.bin/jest test/middleware.test.js --verbose --runInBand || ls -l - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 From 34b0a2730e5948cdabc4d7eda370b3deb6fc3512 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:06:41 +0300 Subject: [PATCH 73/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 40 +++++++++++ test/middleware.test.js | 80 ++++++++++------------ 2 files changed, 78 insertions(+), 42 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 3d72d1b56..b72c89096 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -54,6 +54,46 @@ Array [ ] `; +exports[`middleware logger should logging on successfully build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + exports[`middleware logger should logging on unsuccessful build in multi-compiler should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index 58fca6291..0d249217d 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,44 +3182,44 @@ describe('middleware', () => { //}); describe('logger', () => { - //describe('should logging on successfully build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; @@ -3249,13 +3249,9 @@ describe('middleware', () => { return done(error); } - fs.writeFile(path.resolve(process.cwd(), './1-1'), 'HERE'); - instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFile(path.resolve(process.cwd(), './1-2'), 'HERE'); - expect(getLogsPlugin.logs).toMatchSnapshot(); done(); From 35f68d3509d5eef59dc481ea2ee4b3d055458bc6 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:10:51 +0300 Subject: [PATCH 74/87] ci: improve --- test/middleware.test.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index 0d249217d..cdcae362d 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3213,6 +3213,8 @@ describe('middleware', () => { instance.invalidate(); return instance.waitUntilValid(() => { + fs.writeFileSync(path.resolve(process.cwd(), './0-11'), 'HERE'); + expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3252,6 +3254,8 @@ describe('middleware', () => { instance.invalidate(); return instance.waitUntilValid(() => { + fs.writeFileSync(path.resolve(process.cwd(), './1-11'), 'HERE'); + expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3327,12 +3331,10 @@ describe('middleware', () => { return done(error); } - fs.writeFile(path.resolve(process.cwd(), './2-1'), 'HERE'); - instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFile(path.resolve(process.cwd(), './2-2'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './2-11'), 'HERE'); expect(getLogsPlugin.logs).toMatchSnapshot(); @@ -3385,48 +3387,48 @@ describe('middleware', () => { let compiler; let getLogsPlugin; - fs.writeFile(path.resolve(process.cwd(), './3-1'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-1'), 'HERE'); beforeAll((done) => { - fs.writeFile(path.resolve(process.cwd(), './3-2'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-2'), 'HERE'); compiler = getCompiler(webpackMultiWarningConfig); - fs.writeFile(path.resolve(process.cwd(), './3-3'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-3'), 'HERE'); getLogsPlugin = new GetLogsPlugin(); getLogsPlugin.apply(compiler); - fs.writeFile(path.resolve(process.cwd(), './3-4'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-4'), 'HERE'); instance = middleware(compiler); - fs.writeFile(path.resolve(process.cwd(), './3-5'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-5'), 'HERE'); app = express(); app.use(instance); - fs.writeFile(path.resolve(process.cwd(), './3-6'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-6'), 'HERE'); listen = listenShorthand(done); - fs.writeFile(path.resolve(process.cwd(), './3-7'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-7'), 'HERE'); }); afterAll(close); it('should logging', (done) => { - fs.writeFile(path.resolve(process.cwd(), './3-8'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-8'), 'HERE'); request(app) .get('/static-one/bundle.js') .expect(200, (error) => { - fs.writeFile(path.resolve(process.cwd(), './3-9'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-9'), 'HERE'); if (error) { return done(error); } - fs.writeFile(path.resolve(process.cwd(), './3-10'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-10'), 'HERE'); instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFile(path.resolve(process.cwd(), './3-11'), 'HERE'); + fs.writeFileSync(path.resolve(process.cwd(), './3-11'), 'HERE'); expect(getLogsPlugin.logs).toMatchSnapshot(); From 39e537a30258e142fa6038ea7e2221ff01763b84 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:14:32 +0300 Subject: [PATCH 75/87] ci: improve --- test/middleware.test.js | 78 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/test/middleware.test.js b/test/middleware.test.js index cdcae362d..4e951aec2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -3182,46 +3182,44 @@ describe('middleware', () => { //}); describe('logger', () => { - describe('should logging on successfully build', () => { - let compiler; - let getLogsPlugin; - - beforeAll((done) => { - compiler = getCompiler(webpackConfig); - - getLogsPlugin = new GetLogsPlugin(); - getLogsPlugin.apply(compiler); - - instance = middleware(compiler); - - app = express(); - app.use(instance); - - listen = listenShorthand(done); - }); - - afterAll(close); - - it('should logging', (done) => { - request(app) - .get('/bundle.js') - .expect(200, (error) => { - if (error) { - return done(error); - } - - instance.invalidate(); - - return instance.waitUntilValid(() => { - fs.writeFileSync(path.resolve(process.cwd(), './0-11'), 'HERE'); - - expect(getLogsPlugin.logs).toMatchSnapshot(); - - done(); - }); - }); - }); - }); + //describe('should logging on successfully build', () => { + // let compiler; + // let getLogsPlugin; + // + // beforeAll((done) => { + // compiler = getCompiler(webpackConfig); + // + // getLogsPlugin = new GetLogsPlugin(); + // getLogsPlugin.apply(compiler); + // + // instance = middleware(compiler); + // + // app = express(); + // app.use(instance); + // + // listen = listenShorthand(done); + // }); + // + // afterAll(close); + // + // it('should logging', (done) => { + // request(app) + // .get('/bundle.js') + // .expect(200, (error) => { + // if (error) { + // return done(error); + // } + // + // instance.invalidate(); + // + // return instance.waitUntilValid(() => { + // expect(getLogsPlugin.logs).toMatchSnapshot(); + // + // done(); + // }); + // }); + // }); + //}); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; From a8df4860b51cec80909860612b96f9e9a028046a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:23:20 +0300 Subject: [PATCH 76/87] ci: improve --- .github/workflows/nodejs.yml | 4 +++- package-lock.json | 17 ++++++++++++----- package.json | 1 + test/middleware.test.js | 4 ++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 918f90ebe..672c553ab 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,9 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --verbose --runInBand || ls -l + run: | + node_modules/.bin/jest test/middleware.test.js --verbose --runInBand || ls -l + cat crash.log - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/package-lock.json b/package-lock.json index d264ae82d..eb553a12a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2896,7 +2896,6 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, - "optional": true, "requires": { "file-uri-to-path": "1.0.0" } @@ -6048,8 +6047,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true + "dev": true }, "fill-range": { "version": "4.0.0", @@ -10398,8 +10396,7 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true + "dev": true }, "nanomatch": { "version": "1.2.13", @@ -11913,6 +11910,16 @@ "ajv-keywords": "^3.4.1" } }, + "segfault-handler": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/segfault-handler/-/segfault-handler-1.3.0.tgz", + "integrity": "sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg==", + "dev": true, + "requires": { + "bindings": "^1.2.1", + "nan": "^2.14.0" + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index 2293ba447..92ff24d46 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "lint-staged": "^10.1.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.3", + "segfault-handler": "^1.3.0", "standard-version": "^7.1.0", "supertest": "^4.0.2", "webpack": "^4.42.1" diff --git a/test/middleware.test.js b/test/middleware.test.js index 4e951aec2..ba648e060 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -26,6 +26,10 @@ import webpackMultiWarningConfig from './fixtures/webpack.array.warning.config'; import webpackOneErrorOneWarningOneSuccessConfig from './fixtures/webpack.array.one-error-one-warning-one-success'; import webpackOneErrorOneWarningOneSuccessWithNamesConfig from './fixtures/webpack.array.one-error-one-warning-one-success-with-names'; +const SegfaultHandler = require('segfault-handler'); + +SegfaultHandler.registerHandler("crash.log"); + describe('middleware', () => { let instance; let listen; From e1165c7f187dcd4cbf4463b11cf8ee8932d3144a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 22:36:47 +0300 Subject: [PATCH 77/87] ci: improve --- test/fixtures/webpack.array.config.js | 2 ++ test/fixtures/webpack.array.error.config.js | 2 ++ test/fixtures/webpack.array.warning.config.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/test/fixtures/webpack.array.config.js b/test/fixtures/webpack.array.config.js index 2c1a164ff..1f715a354 100644 --- a/test/fixtures/webpack.array.config.js +++ b/test/fixtures/webpack.array.config.js @@ -5,6 +5,7 @@ const path = require('path'); module.exports = [ { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './foo.js', output: { @@ -28,6 +29,7 @@ module.exports = [ }, { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './bar.js', output: { diff --git a/test/fixtures/webpack.array.error.config.js b/test/fixtures/webpack.array.error.config.js index 853919667..0d04c46f4 100644 --- a/test/fixtures/webpack.array.error.config.js +++ b/test/fixtures/webpack.array.error.config.js @@ -5,6 +5,7 @@ const path = require('path'); module.exports = [ { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './broken.js', output: { @@ -16,6 +17,7 @@ module.exports = [ }, { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './broken.js', output: { diff --git a/test/fixtures/webpack.array.warning.config.js b/test/fixtures/webpack.array.warning.config.js index be0a5557f..75c739193 100644 --- a/test/fixtures/webpack.array.warning.config.js +++ b/test/fixtures/webpack.array.warning.config.js @@ -5,6 +5,7 @@ const path = require('path'); module.exports = [ { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './warning.js', output: { @@ -27,6 +28,7 @@ module.exports = [ }, { mode: 'development', + devtool: false, context: path.resolve(__dirname), entry: './warning.js', output: { From 68ab31923028ac314972338eb80ee363c0b36b60 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 23:20:20 +0300 Subject: [PATCH 78/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- src/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 672c553ab..e32aebe4e 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -88,7 +88,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci run: | - node_modules/.bin/jest test/middleware.test.js --verbose --runInBand || ls -l + node_modules/.bin/jest test/middleware.test.js --verbose --runInBand --forceExit || ls -l cat crash.log - name: Submit coverage data to codecov diff --git a/src/index.js b/src/index.js index f16e4635f..6b9195e7f 100644 --- a/src/index.js +++ b/src/index.js @@ -88,7 +88,8 @@ export default function wdm(compiler, options = {}) { // eslint-disable-next-line no-param-reassign callback = callback || noop; - context.watching.close(callback); + callback(); + // context.watching.close(callback); }, context, From 10cefa5d6269a7beb005f9f074a004beef786cf8 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 7 Apr 2020 23:26:03 +0300 Subject: [PATCH 79/87] ci: improve --- .github/workflows/nodejs.yml | 4 +- package-lock.json | 17 +- package.json | 1 - test/__snapshots__/middleware.test.js.snap | 390 ++ test/middleware.test.js | 6838 ++++++++++---------- 5 files changed, 3803 insertions(+), 3447 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e32aebe4e..ec11edc8a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,9 +87,7 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: | - node_modules/.bin/jest test/middleware.test.js --verbose --runInBand --forceExit || ls -l - cat crash.log + run: node_modules/.bin/jest test/middleware.test.js --ci --verbose --runInBand --forceExit - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/package-lock.json b/package-lock.json index eb553a12a..d264ae82d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2896,6 +2896,7 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, + "optional": true, "requires": { "file-uri-to-path": "1.0.0" } @@ -6047,7 +6048,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true + "dev": true, + "optional": true }, "fill-range": { "version": "4.0.0", @@ -10396,7 +10398,8 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true + "dev": true, + "optional": true }, "nanomatch": { "version": "1.2.13", @@ -11910,16 +11913,6 @@ "ajv-keywords": "^3.4.1" } }, - "segfault-handler": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/segfault-handler/-/segfault-handler-1.3.0.tgz", - "integrity": "sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg==", - "dev": true, - "requires": { - "bindings": "^1.2.1", - "nan": "^2.14.0" - } - }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index 92ff24d46..2293ba447 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "lint-staged": "^10.1.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.3", - "segfault-handler": "^1.3.0", "standard-version": "^7.1.0", "supertest": "^4.0.2", "webpack": "^4.42.1" diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index b72c89096..c6de037ca 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -1,5 +1,333 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option should return the "200" code for "GET" requests to bundle files 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Child \\"broken\\": ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"broken\\": Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "Child \\"warning\\": WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"warning\\": Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Child \\"success\\": Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option from the configuration in multi-compiler mode should return the "200" code for the "GET" request to bundle files 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option in multi-compiler mode should return the "200" code for the "GET" requests to bundles file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Entrypoint main = bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "false" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "minimal" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "X modules", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should respect the "stats" option with the "none" value from the configuration should return the "200" code for the "GET" request to the bundle file 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled successfully.", + ], + ], +] +`; + +exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; + +exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; + +exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-mkdir-error\\" directory to disk: +Error: Error in the \\"fs.mkdir\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Unable to write \\"/absolute/path/to/test/outputs/write-to-disk-writeFile-error/bundle.js\\" asset to disk: +Error: Error in the \\"fs.writeFile\\" method.", + ], + ], +] +`; + +exports[`middleware logger should logging an error in "watch" method should logging on startup 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "error", + Array [ + "Error: Error in Watch method", + ], + ], +] +`; + +exports[`middleware logger should logging an warning should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", + ], + ], +] +`; + exports[`middleware logger should logging on successfully build in multi-compiler mode should logging 1`] = ` Array [ Array [ @@ -192,6 +520,68 @@ You may need an appropriate loader to handle this file type, currently no loader ] `; +exports[`middleware logger should logging on unsuccessful build should logging 1`] = ` +Array [ + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished: /bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiling...", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "wait until bundle finished", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Failed to compile.", + ], + ], +] +`; + exports[`middleware logger should logging warnings in multi-compiler mode should logging 1`] = ` Array [ Array [ diff --git a/test/middleware.test.js b/test/middleware.test.js index ba648e060..b01c0a9b2 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -26,3204 +26,3200 @@ import webpackMultiWarningConfig from './fixtures/webpack.array.warning.config'; import webpackOneErrorOneWarningOneSuccessConfig from './fixtures/webpack.array.one-error-one-warning-one-success'; import webpackOneErrorOneWarningOneSuccessWithNamesConfig from './fixtures/webpack.array.one-error-one-warning-one-success-with-names'; -const SegfaultHandler = require('segfault-handler'); +describe('middleware', () => { + let instance; + let listen; + let app; + + function listenShorthand(done) { + return app.listen((error) => { + if (error) { + return done(error); + } + + return done(); + }); + } + + function close(done) { + instance.close(); + + if (listen) { + listen.close(done); + } else { + done(); + } + } + + describe('basic', () => { + describe('should work', () => { + let compiler; + let codeLength; + + const outputPath = path.resolve(__dirname, './outputs/basic'); + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', (params) => { + codeLength = params.assets['bundle.js'].source().length; + done(); + }); + }); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'image.svg'), + 'svg image' + ); + instance.context.outputFileSystem.mkdirSync( + path.resolve(outputPath, 'directory/nested-directory'), + { recursive: true } + ); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'directory/nested-directory/index.html'), + 'My Index.' + ); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'throw-an-exception-on-readFileSync.txt'), + 'exception' + ); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'unknown'), + 'unknown' + ); + }); + + afterAll(close); + + it('should not find the bundle file on disk', (done) => { + request(app) + .get('/bundle.js') + .expect('Content-Type', 'application/javascript; charset=utf-8') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(fs.existsSync(path.resolve(outputPath, 'bundle.js'))).toBe( + false + ); + + return done(); + }); + }); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'bundle.js') + ); + + request(app) + .get('/bundle.js') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'application/javascript; charset=utf-8') + .expect(200, fileData.toString(), done); + }); + + it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { + request(app) + .head('/bundle.js') + .expect( + 'Content-Length', + instance.context.outputFileSystem + .readFileSync(path.resolve(outputPath, 'bundle.js')) + .byteLength.toString() + ) + .expect('Content-Type', 'application/javascript; charset=utf-8') + // eslint-disable-next-line no-undefined + .expect(200, undefined, done); + }); + + it('should return the "404" code for the "POST" request to the bundle file', (done) => { + request(app).post('/bundle.js').expect(404, done); + }); + + it('should return the "200" code for the "GET" request to the "image.svg" file', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'image.svg') + ); + + request(app) + .get('/image.svg') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'image/svg+xml') + .expect(200, fileData, done); + }); + + it('should return the "200" code for the "GET" request to the directory', (done) => { + const fileData = fs.readFileSync( + path.resolve(__dirname, './fixtures/index.html') + ); + + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect('Content-Length', fileData.byteLength.toString()) + .expect(200, fileData.toString(), done); + }); + + it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'directory/nested-directory/index.html') + ); + + request(app) + .get('/directory/nested-directory/') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, fileData.toString(), done); + }); + + it('should return the "200" code for the "GET" request to the subdirectory with "index.html" without trailing slash', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'directory/nested-directory/index.html') + ); + + request(app) + .get('/directory/nested-directory') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, fileData.toString(), done); + }); + + it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'directory/nested-directory/index.html') + ); + + request(app) + .get('/directory/nested-directory/index.html') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, fileData.toString(), done); + }); + + it('should return the "416" code for the "GET" request with the invalid range header', (done) => { + request(app) + .get('/bundle.js') + .set('Range', 'bytes=6000-') + .expect(416, done); + }); + + it('should return the "206" code for the "GET" request with the valid range header', (done) => { + request(app) + .get('/bundle.js') + .set('Range', 'bytes=3000-3500') + .expect('Content-Length', '501') + .expect('Content-Range', `bytes 3000-3500/${codeLength}`) + .expect(206, done); + }); + + it('should return the "404" code for the "GET" request with to the non-public path', (done) => { + request(app) + .get('/nonpublic/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + + it('should return the "404" code for the "GET" request to the deleted file', (done) => { + const spy = jest + .spyOn(instance.context.outputFileSystem, 'readFileSync') + .mockImplementation(() => { + throw new Error('error'); + }); + + request(app) + .get('/public/throw-an-exception-on-readFileSync.txt') + .expect(404, (error) => { + if (error) { + return done(error); + } + + spy.mockRestore(); + + return done(); + }); + }); + + it('should return "200" code code for the "GET" request to the file without extension', (done) => { + const fileData = instance.context.outputFileSystem.readFileSync( + path.resolve(outputPath, 'unknown') + ); + + request(app) + .get('/unknown') + .expect('Content-Length', fileData.byteLength.toString()) + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + }); + + describe('should not work with the broken "publicPath" option', () => { + let compiler; + + const outputPath = path.resolve(__dirname, './outputs/basic'); + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + publicPath: 'https://test:malfor%5Med@test.example.com', + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "400" code for the "GET" request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(404, done); + }); + }); + + describe('should work in multi-compiler mode', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackMultiConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/static-one/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a non existing file for the first compiler', (done) => { + request(app).get('/static-one/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + request(app) + .get('/static-one/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get('/static-one/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request for the bundle file for the second compiler', (done) => { + request(app).get('/static-two/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a non existing file for the second compiler', (done) => { + request(app).get('/static-two/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + request(app).get('/static-two/').expect(404, done); + }); + + it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + request(app).get('/static-two/index.html').expect(404, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app) + .get('/static-three/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app) + .get('/static-three/invalid.js') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + }); + + describe('should work with difference requests', () => { + const basicOutputPath = path.resolve(__dirname, './outputs/basic'); + const fixtures = [ + { + urls: [ + { + value: 'bundle.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + { + value: '', + contentType: 'text/html; charset=utf-8', + code: 200, + }, + { + value: 'index.html', + contentType: 'text/html; charset=utf-8', + code: 200, + }, + { + value: 'invalid.js', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + { + value: 'complex', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + { + value: 'complex/invalid.js', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + { + value: 'complex/complex', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + { + value: 'complex/complex/invalid.js', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + { + value: '%', + contentType: 'text/html; charset=utf-8', + code: 404, + }, + ], + }, + { + file: 'config.json', + data: JSON.stringify({ foo: 'bar' }), + urls: [ + { + value: 'config.json', + contentType: 'application/json; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'image.svg', + data: 'SVG', + urls: [ + { + value: 'image.svg', + contentType: 'image/svg+xml', + code: 200, + }, + ], + }, + { + file: 'foo.js', + data: 'console.log("foo");', + urls: [ + { + value: 'foo.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: '/complex/foo.js', + data: 'console.log("foo");', + urls: [ + { + value: 'complex/foo.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + { + value: 'complex/./foo.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + { + value: 'complex/foo/../foo.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: '/complex/complex/foo.js', + data: 'console.log("foo");', + urls: [ + { + value: 'complex/complex/foo.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: '/föö.js', + data: 'console.log("foo");', + urls: [ + // Express encodes the URI component, so we do the same + { + value: 'f%C3%B6%C3%B6.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: '/%foo%/%foo%.js', + data: 'console.log("foo");', + urls: [ + // Filenames can contain characters not allowed in URIs + { + value: '%foo%/%foo%.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'test.html', + data: '
test
', + urls: [ + { + value: 'test.html?foo=bar', + contentType: 'text/html; charset=utf-8', + code: 200, + }, + { + value: 'test.html?foo=bar#hash', + contentType: 'text/html; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'pathname with spaces.js', + data: 'console.log("foo");', + urls: [ + { + value: 'pathname%20with%20spaces.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'dirname with spaces/filename with spaces.js', + data: 'console.log("foo");', + urls: [ + { + value: 'dirname%20with%20spaces/filename%20with%20spaces.js', + contentType: 'application/javascript; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'filename-name-with-dots/mono-v6.x.x', + data: 'content with .', + urls: [ + { + value: 'filename-name-with-dots/mono-v6.x.x', + contentType: 'application/octet-stream', + code: 200, + }, + ], + }, + { + file: 'noextension', + data: 'noextension content', + urls: [ + { + value: 'noextension', + contentType: 'application/octet-stream', + code: 200, + }, + ], + }, + { + file: '3dAr.usdz', + data: '3dAr.usdz content', + urls: [ + { + value: '3dAr.usdz', + contentType: 'model/vnd.usdz+zip', + code: 200, + }, + ], + }, + { + file: 'hello.wasm', + data: 'hello.wasm content', + urls: [ + { + value: 'hello.wasm', + contentType: 'application/wasm', + code: 200, + }, + ], + }, + ]; + + const configurations = [ + { + output: { path: basicOutputPath, publicPath: '' }, + publicPathForRequest: '/', + }, + { + output: { path: path.join(basicOutputPath, 'dist'), publicPath: '' }, + publicPathForRequest: '/', + }, + { + output: { path: basicOutputPath, publicPath: '/' }, + publicPathForRequest: '/', + }, + { + output: { path: path.join(basicOutputPath, 'dist'), publicPath: '/' }, + publicPathForRequest: '/', + }, + { + output: { path: basicOutputPath, publicPath: '/static' }, + publicPathForRequest: '/static/', + }, + { + output: { + path: path.join(basicOutputPath, 'dist'), + publicPath: '/static', + }, + publicPathForRequest: '/static/', + }, + { + output: { path: basicOutputPath, publicPath: '/static/' }, + publicPathForRequest: '/static/', + }, + { + output: { + path: path.join(basicOutputPath, 'dist'), + publicPath: '/static/', + }, + publicPathForRequest: '/static/', + }, + { + output: { + path: path.join(basicOutputPath, 'dist/#leadinghash'), + publicPath: '/', + }, + publicPathForRequest: '/', + }, + { + output: { + path: basicOutputPath, + publicPath: 'http://127.0.0.1/', + }, + publicPathForRequest: '/', + }, + { + output: { + path: basicOutputPath, + publicPath: 'http://127.0.0.1:3000/', + }, + publicPathForRequest: '/', + }, + { + output: { + path: basicOutputPath, + publicPath: '//test.domain/', + }, + publicPathForRequest: '/', + }, + ]; + + const isWindows = process.platform === 'win32'; + + if (isWindows) { + fixtures.push( + { + file: 'windows.txt', + data: 'windows.txt content', + urls: [ + { + value: 'windows.txt', + contentType: 'text/plain; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'windows 2.txt', + data: 'windows 2.txt content', + urls: [ + { + value: 'windows%202.txt', + contentType: 'text/plain; charset=utf-8', + code: 200, + }, + ], + }, + { + file: 'test & test & %20.txt', + data: 'test & test & %20.txt content', + urls: [ + { + value: 'test%20%26%20test%20%26%20%2520.txt', + contentType: 'text/plain; charset=utf-8', + code: 200, + }, + ], + } + ); + + configurations.push( + { + output: { + path: path.join(basicOutputPath, 'my static'), + publicPath: '/static/', + }, + publicPathForRequest: '/static/', + }, + { + output: { + path: path.join(basicOutputPath, 'my%20static'), + publicPath: '/static/', + }, + publicPathForRequest: '/static/', + }, + { + output: { + path: path.join(basicOutputPath, 'my %20 static'), + publicPath: '/my%20static/', + }, + publicPathForRequest: '/my%20static/', + } + ); + } + + for (const configuration of configurations) { + // eslint-disable-next-line no-loop-func + describe('should work handle requests', () => { + const { output, publicPathForRequest } = configuration; + const { path: outputPath, publicPath } = output; + + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + publicPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + const { + context: { + outputFileSystem: { mkdirSync, writeFileSync }, + }, + } = instance; + + for (const { file, data } of fixtures) { + if (file) { + const fullPath = path.join(outputPath, file); + + mkdirSync(path.dirname(fullPath), { recursive: true }); + writeFileSync(fullPath, data); + } + } + }); + + afterAll(close); + + for (const { data, urls } of fixtures) { + for (const { value, contentType, code } of urls) { + // eslint-disable-next-line no-loop-func + it(`should return the "${code}" code for the "GET" request for the "${value}" url`, (done) => { + request(app) + .get(`${publicPathForRequest}${value}`) + .expect('Content-Type', contentType) + .expect('Content-Length', data ? String(data.length) : /\d+/) + .expect(code, done); + }); + } + } + }); + } + }); + + describe('should respect the value of the "Content-Type" header from other middleware', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + app = express(); + app.use((req, res, next) => { + res.set('Content-Type', 'application/octet-stream'); + next(); + }); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should not guess a MIME type if the "Content-Type" header is found', (done) => { + request(app) + .get('/bundle.js') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + }); + + describe('should not throw an error on the valid "output.path" value for linux', () => { + it('should be no error', (done) => { + expect(() => { + const compiler = getCompiler(); + + compiler.outputPath = '/my/path'; + + instance = middleware(compiler); + + instance.close(done); + }).not.toThrow(); + }); + }); + + describe('should not throw an error on the valid "output.path" value for windows', () => { + it('should be no error', (done) => { + expect(() => { + const compiler = getCompiler(); + + compiler.outputPath = 'C:/my/path'; + + instance = middleware(compiler); + + instance.close(done); + }).not.toThrow(); + }); + }); + + describe('should work without "output" options', () => { + beforeAll((done) => { + // eslint-disable-next-line no-undefined + const compiler = getCompiler({ ...webpackConfig, output: undefined }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/main.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should work with trailing slash at the end of the "option.path" option', () => { + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/basic/'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should respect empty "output.publicPath" and "output.path" options', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options', () => { + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + publicPath: '/static/', + path: path.resolve(__dirname, './outputs/other-basic'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { + let hash; + + beforeAll((done) => { + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + publicPath: isWebpack5() + ? '/static/[fullhash]/' + : '/static/[hash]/', + path: isWebpack5() + ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') + : path.resolve(__dirname, './outputs/other-basic-[hash]'), + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get(`/static/${hash}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the public path', (done) => { + request(app) + .get(`/static/${hash}/`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get(`/static/${hash}/index.html`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { + let hashOne; + let hashTwo; + + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle.js', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/array-[fullhash]/static-one' + ) + : path.resolve(__dirname, './outputs/array-[hash]/static-one'), + publicPath: isWebpack5() + ? '/static-one/[fullhash]/' + : '/static-one/[hash]/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle.js', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/array-[fullhash]/static-two' + ) + : path.resolve(__dirname, './outputs/array-[hash]/static-two'), + publicPath: isWebpack5() + ? '/static-two/[fullhash]/' + : '/static-two/[hash]/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.done.tap('wdm-test', (params) => { + const [one, two] = params.stats; + + hashOne = one.hash; + hashTwo = two.hash; + + done(); + }); + }); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); + }); + + it('should return "200" code for GET request for the second bundle file', (done) => { + request(app) + .get(`/static-one/${hashOne}/`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get(`/static-one/${hashOne}/index.html`) + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); + }); + + it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/`).expect(404, done); + }); + + it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { + request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackMultiConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/static-one/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { + request(app).get('/static-one/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + request(app) + .get('/static-one/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get('/static-one/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the second bundle file', (done) => { + request(app).get('/static-two/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { + request(app).get('/static-two/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + request(app).get('/static-two/').expect(404, done); + }); + + it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + request(app).get('/static-two/index.html').expect(404, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/my-public/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/array/static-two'), + publicPath: '/my-public/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/my-public/bundle-one.js').expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get('/my-public/bundle-two.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/my-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path', (done) => { + request(app) + .get('/my-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option', (done) => { + request(app) + .get('/my-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackMultiConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/one-public/', + }, + }, + { + ...webpackMultiConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/array/static-one'), + publicPath: '/two-public/', + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { + request(app).get('/one-public/bundle-one.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { + request(app).get('/one-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { + request(app) + .get('/one-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { + request(app) + .get('/one-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { + request(app).get('/two-public/bundle-two.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { + request(app).get('/two-public/invalid.js').expect(404, done); + }); + + it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { + request(app) + .get('/two-public/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { + request(app) + .get('/two-public/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackClientServerConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { + beforeAll((done) => { + const compiler = getCompiler([ + webpackClientServerConfig[1], + webpackClientServerConfig[0], + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle.js').expect(200, done); + }); + + it('should return "404" code for GET request to nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app) + .get('/static/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to non-public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { + beforeAll((done) => { + const compiler = getCompiler([ + { + ...webpackClientServerConfig[0], + output: { + filename: 'bundle-one.js', + path: path.resolve(__dirname, './outputs/client-server/same'), + publicPath: '/static/', + }, + }, + { + ...webpackClientServerConfig[1], + output: { + filename: 'bundle-two.js', + path: path.resolve(__dirname, './outputs/client-server/same'), + }, + }, + ]); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return "200" code for GET request to the bundle file', (done) => { + request(app).get('/static/bundle-one.js').expect(200, done); + }); + + it('should return "404" code for GET request to a nonexistent file', (done) => { + request(app).get('/static/invalid.js').expect(404, done); + }); + + it('should return "404" code for GET request to the public path', (done) => { + request(app).get('/static/').expect(200, done); + }); + + it('should return "200" code for GET request to the non-public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return "404" code for GET request to the "index" option', (done) => { + request(app) + .get('/static/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should respect the "stats" option with the "false" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: false }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + + describe('should respect the "stats" option with the "none" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: 'none' }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + + describe('should respect the "stats" option with the "minimal" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + + describe('should respect the "stats" option in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" requests to bundles file', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + return request(app) + .get('/static-three/bundle.js') + .expect(200, (thirdError) => { + if (thirdError) { + return done(thirdError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + }); + }); + + describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + stats: { all: false, entrypoints: true }, + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + + describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to bundle files', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + }); + + describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler( + webpackOneErrorOneWarningOneSuccessWithNamesConfig + ); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for "GET" requests to bundle files', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + return request(app) + .get('/static-three/bundle.js') + .expect(200, (thirdError) => { + if (thirdError) { + return done(thirdError); + } + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + return done(); + }); + }); + }); + }); + }); + + describe('should throw an error on "run" when we watching', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging an error', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + return compiler.run((runError) => { + expect(() => { + throw runError; + }).toThrowErrorMatchingSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should throw an error on "watch" when we watching', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging an error', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + return compiler.watch({}, (watchError) => { + expect(() => { + throw watchError; + }).toThrowErrorMatchingSnapshot(); + + done(); + }); + }); + }); + }); + + describe('should handle an earlier request if a change happened while compiling', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + let invalidated = false; + + compiler.hooks.done.tap('Invalidated', () => { + if (!invalidated) { + instance.invalidate(); + + invalidated = true; + } + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app).get('/bundle.js').expect(200, done); + }); + }); + }); + + describe('mimeTypes option', () => { + describe('should set the correct value for "Content-Type" header to known MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.html'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to "file.html"', (done) => { + request(app) + .get('/file.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); + }); + }); + + describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.phtml'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to "file.html"', (done) => { + request(app) + .get('/file.phtml') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + }); + + describe('should set the correct value for "Content-Type" header to specified MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler, { + mimeTypes: { + phtml: 'text/html', + }, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'file.phtml'), + 'welcome' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request "file.html"', (done) => { + request(app) + .get('/file.phtml') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, 'welcome', done); + }); + }); + }); + + describe('watchOptions option', () => { + describe('should work without value', () => { + let compiler; + let spy; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + spy = jest.spyOn(compiler, 'watch'); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + spy.mockRestore(); + + close(); + }); + + it('should pass arguments to the "watch" method', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual({}); + + return done(); + }); + }); + }); + + describe('should respect options from the configuration', () => { + let compiler; + let spy; + + beforeAll((done) => { + compiler = getCompiler(webpackWatchOptionsConfig); + + spy = jest.spyOn(compiler, 'watch'); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + spy.mockRestore(); + + close(); + }); + + it('should pass arguments to the "watch" method', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(done); + } + + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual({ + aggregateTimeout: 300, + poll: true, + }); + + return done(error); + }); + }); + }); + + describe('should respect options from the configuration in multi-compile mode', () => { + let compiler; + let spy; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiWatchOptionsConfig); + + spy = jest.spyOn(compiler, 'watch'); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + spy.mockRestore(); + + close(); + }); + + it('should pass arguments to the "watch" method', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0][0]).toEqual([ + { aggregateTimeout: 800, poll: false }, + { aggregateTimeout: 300, poll: true }, + ]); + + return done(); + }); + }); + }); + }); + }); + + describe('writeToDisk option', () => { + describe('should work with "true" value', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/write-to-disk-true'), + }, + }); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync(path.posix.resolve(__dirname, './outputs/write-to-disk-true')); + + close(); + }); + + it('should find the bundle file on disk', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-true/bundle.js' + ); + + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(1); + expect(fs.existsSync(bundlePath)).toBe(true); + + instance.invalidate(); + + return compiler.hooks.done.tap( + 'DevMiddlewareWriteToDiskTest', + () => { + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(1); + + done(); + } + ); + }); + }); + }); + + describe('should work with "false" value', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, './outputs/write-to-disk-false'), + }, + }); + + instance = middleware(compiler, { writeToDisk: false }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should not find the bundle file on disk', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-false/bundle.js' + ); + + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(0); + expect(fs.existsSync(bundlePath)).toBe(false); + + instance.invalidate(); + + return compiler.hooks.done.tap( + 'DevMiddlewareWriteToDiskTest', + () => { + expect( + compiler.hooks.assetEmitted.taps.filter( + (hook) => hook.name === 'DevMiddleware' + ).length + ).toBe(0); + + done(); + } + ); + }); + }); + }); + + describe('should work with "Function" value when it returns "true"', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-function-true' + ), + }, + }); + + instance = middleware(compiler, { + writeToDisk: (filePath) => /bundle\.js$/.test(filePath), + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-function-true') + ); + + close(); + }); + + it('should find the bundle file on disk', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-function-true/bundle.js' + ); + + expect(fs.existsSync(bundlePath)).toBe(true); + + return done(); + }); + }); + }); + + describe('should work with "Function" value when it returns "false"', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-function-false' + ), + }, + }); + + instance = middleware(compiler, { + writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-function-false' + ) + ); + + close(); + }); + + it('should not find the bundle file on disk', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-function-false/bundle.js' + ); + + expect(fs.existsSync(bundlePath)).toBe(false); + + return done(); + }); + }); + }); + + describe('should work when assets have query string', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackQueryStringConfig, + output: { + filename: 'bundle.js?[contenthash]', + path: path.resolve( + __dirname, + './outputs/write-to-disk-query-string' + ), + }, + }); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-query-string') + ); + + close(); + }); + + it('should find the bundle file on disk with no querystring', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + './outputs/write-to-disk-query-string/bundle.js' + ); + + expect(fs.existsSync(bundlePath)).toBe(true); + + return done(); + }); + }); + }); + + describe('should work in multi-compiler mode', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler([ + { + ...webpackMultiWatchOptionsConfig[0], + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/static-one' + ), + publicPath: '/static-one/', + }, + }, + { + ...webpackMultiWatchOptionsConfig[1], + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/static-two' + ), + publicPath: '/static-two/', + }, + }, + ]); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-multi-compiler/' + ) + ); + + close(); + }); + + it('should find the bundle files on disk', (done) => { + request(app) + .get('/static-one/bundle.js') + .expect(200, (firstError) => { + if (firstError) { + return done(firstError); + } + + return request(app) + .get('/static-two/bundle.js') + .expect(200, (secondError) => { + if (secondError) { + return done(secondError); + } + const bundleFiles = [ + './outputs/write-to-disk-multi-compiler/static-one/bundle.js', + './outputs/write-to-disk-multi-compiler/static-one/index.html', + './outputs/write-to-disk-multi-compiler/static-one/svg.svg', + './outputs/write-to-disk-multi-compiler/static-two/bundle.js', + ]; + + for (const bundleFile of bundleFiles) { + const bundlePath = path.resolve(__dirname, bundleFile); + + expect(fs.existsSync(bundlePath)).toBe(true); + } + + return done(); + }); + }); + }); + }); + + describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { + let compiler; + let hash; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackConfig, + ...{ + output: { + filename: 'bundle.js', + publicPath: isWebpack5() + ? '/static/[fullhash]/' + : '/static/[hash]/', + path: isWebpack5() + ? path.resolve( + __dirname, + './outputs/write-to-disk-with-hash/dist_[fullhash]' + ) + : path.resolve( + __dirname, + './outputs/write-to-disk-with-hash/dist_[hash]' + ), + }, + }, + }); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(() => { + compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { + hash = h; + done(); + }); + }); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') + ); + + close(); + }); + + it('should find the bundle file on disk', (done) => { + request(app) + .get(`/static/${hash}/bundle.js`) + .expect(200, (error) => { + if (error) { + return done(error); + } + + const bundlePath = path.resolve( + __dirname, + `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` + ); + + expect(fs.existsSync(bundlePath)).toBe(true); + + return done(); + }); + }); + }); + }); + + describe('methods option', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { + methods: ['POST'], + publicPath: '/public/', + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "POST" request to the bundle file', (done) => { + request(app).post('/public/bundle.js').expect(200, done); + }); + + it('should return the "404" code for the "GET" request to the bundle file', (done) => { + request(app).get('/public/bundle.js').expect(404, done); + }); + + it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { + request(app).head('/public/bundle.js').expect(404, done); + }); + }); + + describe('headers option', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { + headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { + request(app) + .get('/bundle.js') + .expect('X-nonsense-1', 'yes') + .expect('X-nonsense-2', 'no') + .expect(200, done); + }); + }); + + describe('publicPath option', () => { + describe('should work with "string" value', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { publicPath: '/public/' }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the bundle file', (done) => { + request(app).get('/public/bundle.js').expect(200, done); + }); + }); + }); + + describe('serverSideRender option', () => { + let locals; + + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { serverSideRender: true }); + + app = express(); + app.use(instance); + app.use((req, res) => { + // eslint-disable-next-line prefer-destructuring + locals = res.locals; + + res.sendStatus(200); + }); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request', (done) => { + request(app) + .get('/foo/bar') + .expect(200, (error) => { + if (error) { + return done(error); + } + + expect(locals.webpack.devMiddleware).toBeDefined(); + + return done(); + }); + }); + }); + + describe('outputFileSystem option', () => { + describe('should work with an unspecified value', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should use the "memfs" package by default', () => { + const { Stats } = memfs; + + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + }); + }); + + describe('should work with the configured value (native fs)', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + const configuredFs = fs; + + configuredFs.join = path.join.bind(path); + configuredFs.mkdirp = () => {}; + + instance = middleware(compiler, { + outputFileSystem: configuredFs, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should use the configurated output filesystem', () => { + const { Stats } = fs; + + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + }); + }); + + describe('should work with the configured value (memfs)', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + const configuredFs = createFsFromVolume(new Volume()); + + configuredFs.join = path.join.bind(path); + + instance = middleware(compiler, { + outputFileSystem: configuredFs, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should use the configured output filesystem', () => { + const { Stats } = memfs; + + expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(compiler.outputFileSystem).toHaveProperty('join'); + expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); + }); + }); + + describe('should work with the configured value in multi-compiler mode (native fs)', () => { + let compiler; + + beforeAll((done) => { + compiler = getCompiler(webpackMultiConfig); + + const configuredFs = fs; + + configuredFs.join = path.join.bind(path); + configuredFs.mkdirp = () => {}; + + instance = middleware(compiler, { + outputFileSystem: configuredFs, + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should use configured output filesystems', () => { + const { Stats } = fs; + + for (const childCompiler of compiler.compilers) { + expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(childCompiler.outputFileSystem).toHaveProperty('join'); + expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); + } + + expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( + Stats + ); + expect(instance.context.outputFileSystem).toHaveProperty('join'); + expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); + }); + }); + + describe('should throw an error on the invalid fs value - no join method', () => { + it('should throw an error', () => { + expect(() => { + const compiler = getCompiler(webpackConfig); + + middleware(compiler, { outputFileSystem: { mkdirp: () => {} } }); + }).toThrow( + 'Invalid options: options.outputFileSystem.join() method is expected' + ); + }); + }); + + describe('should throw an error on the invalid fs value - no mkdirp method', () => { + it('should throw an error', () => { + expect(() => { + const compiler = getCompiler(webpackConfig); + + middleware(compiler, { outputFileSystem: { join: () => {} } }); + }).toThrow( + 'Invalid options: options.outputFileSystem.mkdirp() method is expected' + ); + }); + }); + }); + + describe('index option', () => { + describe('should work with "false" value', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { index: false, publicPath: '/' }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "404" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(404, done); + }); + + it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should work with "true" value', () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { index: true, publicPath: '/' }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/index.html') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should work with "string" value', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler, { + index: 'default.html', + publicPath: '/', + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'default.html'), + 'hello' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); + + describe('should work with "string" value with a custom extension', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler, { + index: 'index.custom', + publicPath: '/', + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'index.custom'), + 'hello' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); + }); + + describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); + + instance = middleware(compiler, { + index: 'index.custom', + mimeTypes: { + custom: 'text/html', + }, + publicPath: '/', + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'index.custom'), + 'hello' + ); + }); -SegfaultHandler.registerHandler("crash.log"); + afterAll(close); -describe('middleware', () => { - let instance; - let listen; - let app; + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'text/html; charset=utf-8') + .expect(200, done); + }); + }); - function listenShorthand(done) { - return app.listen((error) => { - if (error) { - return done(error); - } + describe('should work with "string" value without an extension', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - return done(); + instance = middleware(compiler, { index: 'noextension' }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.writeFileSync( + path.resolve(outputPath, 'noextension'), + 'hello' + ); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request to the public path', (done) => { + request(app) + .get('/') + .expect('Content-Type', 'application/octet-stream') + .expect(200, done); + }); }); - } - function close(done) { - instance.close(); + describe('should work with "string" value but the "index" option is a directory', () => { + beforeAll((done) => { + const outputPath = path.resolve(__dirname, './outputs/basic'); + const compiler = getCompiler({ + ...webpackConfig, + output: { + filename: 'bundle.js', + path: outputPath, + }, + }); - if (listen) { - listen.close(done); - } else { - done(); - } - } + instance = middleware(compiler, { + index: 'custom.html', + publicPath: '/', + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + + instance.context.outputFileSystem.mkdirSync(outputPath, { + recursive: true, + }); + instance.context.outputFileSystem.mkdirSync( + path.resolve(outputPath, 'custom.html') + ); + }); + + afterAll(close); + + it('should return the "404" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + + describe('should not handle request when index is neither a file nor a directory', () => { + let compiler; + let isDirectory; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { + index: 'default.html', + publicPath: '/', + }); + + isDirectory = jest + .spyOn(instance.context.outputFileSystem, 'statSync') + .mockImplementation(() => { + return { + isFile: () => false, + isDirectory: () => false, + }; + }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + isDirectory.mockRestore(); - //describe('basic', () => { - // describe('should work', () => { - // let compiler; - // let codeLength; - // - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.afterCompile.tap('wdm-test', (params) => { - // codeLength = params.assets['bundle.js'].source().length; - // done(); - // }); - // }); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'image.svg'), - // 'svg image' - // ); - // instance.context.outputFileSystem.mkdirSync( - // path.resolve(outputPath, 'directory/nested-directory'), - // { recursive: true } - // ); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'directory/nested-directory/index.html'), - // 'My Index.' - // ); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'throw-an-exception-on-readFileSync.txt'), - // 'exception' - // ); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'unknown'), - // 'unknown' - // ); - // }); - // - // afterAll(close); - // - // it('should not find the bundle file on disk', (done) => { - // request(app) - // .get('/bundle.js') - // .expect('Content-Type', 'application/javascript; charset=utf-8') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(fs.existsSync(path.resolve(outputPath, 'bundle.js'))).toBe( - // false - // ); - // - // return done(); - // }); - // }); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'bundle.js') - // ); - // - // request(app) - // .get('/bundle.js') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'application/javascript; charset=utf-8') - // .expect(200, fileData.toString(), done); - // }); - // - // it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { - // request(app) - // .head('/bundle.js') - // .expect( - // 'Content-Length', - // instance.context.outputFileSystem - // .readFileSync(path.resolve(outputPath, 'bundle.js')) - // .byteLength.toString() - // ) - // .expect('Content-Type', 'application/javascript; charset=utf-8') - // // eslint-disable-next-line no-undefined - // .expect(200, undefined, done); - // }); - // - // it('should return the "404" code for the "POST" request to the bundle file', (done) => { - // request(app).post('/bundle.js').expect(404, done); - // }); - // - // it('should return the "200" code for the "GET" request to the "image.svg" file', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'image.svg') - // ); - // - // request(app) - // .get('/image.svg') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'image/svg+xml') - // .expect(200, fileData, done); - // }); - // - // it('should return the "200" code for the "GET" request to the directory', (done) => { - // const fileData = fs.readFileSync( - // path.resolve(__dirname, './fixtures/index.html') - // ); - // - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect(200, fileData.toString(), done); - // }); - // - // it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'directory/nested-directory/index.html') - // ); - // - // request(app) - // .get('/directory/nested-directory/') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, fileData.toString(), done); - // }); - // - // it('should return the "200" code for the "GET" request to the subdirectory with "index.html" without trailing slash', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'directory/nested-directory/index.html') - // ); - // - // request(app) - // .get('/directory/nested-directory') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, fileData.toString(), done); - // }); - // - // it('should return the "200" code for the "GET" request to the subdirectory with "index.html"', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'directory/nested-directory/index.html') - // ); - // - // request(app) - // .get('/directory/nested-directory/index.html') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, fileData.toString(), done); - // }); - // - // it('should return the "416" code for the "GET" request with the invalid range header', (done) => { - // request(app) - // .get('/bundle.js') - // .set('Range', 'bytes=6000-') - // .expect(416, done); - // }); - // - // it('should return the "206" code for the "GET" request with the valid range header', (done) => { - // request(app) - // .get('/bundle.js') - // .set('Range', 'bytes=3000-3500') - // .expect('Content-Length', '501') - // .expect('Content-Range', `bytes 3000-3500/${codeLength}`) - // .expect(206, done); - // }); - // - // it('should return the "404" code for the "GET" request with to the non-public path', (done) => { - // request(app) - // .get('/nonpublic/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // - // it('should return the "404" code for the "GET" request to the deleted file', (done) => { - // const spy = jest - // .spyOn(instance.context.outputFileSystem, 'readFileSync') - // .mockImplementation(() => { - // throw new Error('error'); - // }); - // - // request(app) - // .get('/public/throw-an-exception-on-readFileSync.txt') - // .expect(404, (error) => { - // if (error) { - // return done(error); - // } - // - // spy.mockRestore(); - // - // return done(); - // }); - // }); - // - // it('should return "200" code code for the "GET" request to the file without extension', (done) => { - // const fileData = instance.context.outputFileSystem.readFileSync( - // path.resolve(outputPath, 'unknown') - // ); - // - // request(app) - // .get('/unknown') - // .expect('Content-Length', fileData.byteLength.toString()) - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should not work with the broken "publicPath" option', () => { - // let compiler; - // - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // publicPath: 'https://test:malfor%5Med@test.example.com', - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "400" code for the "GET" request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(404, done); - // }); - // }); - // - // describe('should work in multi-compiler mode', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackMultiConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/static-one/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a non existing file for the first compiler', (done) => { - // request(app).get('/static-one/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - // request(app) - // .get('/static-one/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get('/static-one/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request for the bundle file for the second compiler', (done) => { - // request(app).get('/static-two/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a non existing file for the second compiler', (done) => { - // request(app).get('/static-two/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - // request(app).get('/static-two/').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - // request(app).get('/static-two/index.html').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/static-three/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/static-three/invalid.js') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // }); - // - // describe('should work with difference requests', () => { - // const basicOutputPath = path.resolve(__dirname, './outputs/basic'); - // const fixtures = [ - // { - // urls: [ - // { - // value: 'bundle.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // { - // value: '', - // contentType: 'text/html; charset=utf-8', - // code: 200, - // }, - // { - // value: 'index.html', - // contentType: 'text/html; charset=utf-8', - // code: 200, - // }, - // { - // value: 'invalid.js', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // { - // value: 'complex', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // { - // value: 'complex/invalid.js', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // { - // value: 'complex/complex', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // { - // value: 'complex/complex/invalid.js', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // { - // value: '%', - // contentType: 'text/html; charset=utf-8', - // code: 404, - // }, - // ], - // }, - // { - // file: 'config.json', - // data: JSON.stringify({ foo: 'bar' }), - // urls: [ - // { - // value: 'config.json', - // contentType: 'application/json; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'image.svg', - // data: 'SVG', - // urls: [ - // { - // value: 'image.svg', - // contentType: 'image/svg+xml', - // code: 200, - // }, - // ], - // }, - // { - // file: 'foo.js', - // data: 'console.log("foo");', - // urls: [ - // { - // value: 'foo.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: '/complex/foo.js', - // data: 'console.log("foo");', - // urls: [ - // { - // value: 'complex/foo.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // { - // value: 'complex/./foo.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // { - // value: 'complex/foo/../foo.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: '/complex/complex/foo.js', - // data: 'console.log("foo");', - // urls: [ - // { - // value: 'complex/complex/foo.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: '/föö.js', - // data: 'console.log("foo");', - // urls: [ - // // Express encodes the URI component, so we do the same - // { - // value: 'f%C3%B6%C3%B6.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: '/%foo%/%foo%.js', - // data: 'console.log("foo");', - // urls: [ - // // Filenames can contain characters not allowed in URIs - // { - // value: '%foo%/%foo%.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'test.html', - // data: '
test
', - // urls: [ - // { - // value: 'test.html?foo=bar', - // contentType: 'text/html; charset=utf-8', - // code: 200, - // }, - // { - // value: 'test.html?foo=bar#hash', - // contentType: 'text/html; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'pathname with spaces.js', - // data: 'console.log("foo");', - // urls: [ - // { - // value: 'pathname%20with%20spaces.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'dirname with spaces/filename with spaces.js', - // data: 'console.log("foo");', - // urls: [ - // { - // value: 'dirname%20with%20spaces/filename%20with%20spaces.js', - // contentType: 'application/javascript; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'filename-name-with-dots/mono-v6.x.x', - // data: 'content with .', - // urls: [ - // { - // value: 'filename-name-with-dots/mono-v6.x.x', - // contentType: 'application/octet-stream', - // code: 200, - // }, - // ], - // }, - // { - // file: 'noextension', - // data: 'noextension content', - // urls: [ - // { - // value: 'noextension', - // contentType: 'application/octet-stream', - // code: 200, - // }, - // ], - // }, - // { - // file: '3dAr.usdz', - // data: '3dAr.usdz content', - // urls: [ - // { - // value: '3dAr.usdz', - // contentType: 'model/vnd.usdz+zip', - // code: 200, - // }, - // ], - // }, - // { - // file: 'hello.wasm', - // data: 'hello.wasm content', - // urls: [ - // { - // value: 'hello.wasm', - // contentType: 'application/wasm', - // code: 200, - // }, - // ], - // }, - // ]; - // - // const configurations = [ - // { - // output: { path: basicOutputPath, publicPath: '' }, - // publicPathForRequest: '/', - // }, - // { - // output: { path: path.join(basicOutputPath, 'dist'), publicPath: '' }, - // publicPathForRequest: '/', - // }, - // { - // output: { path: basicOutputPath, publicPath: '/' }, - // publicPathForRequest: '/', - // }, - // { - // output: { path: path.join(basicOutputPath, 'dist'), publicPath: '/' }, - // publicPathForRequest: '/', - // }, - // { - // output: { path: basicOutputPath, publicPath: '/static' }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { - // path: path.join(basicOutputPath, 'dist'), - // publicPath: '/static', - // }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { path: basicOutputPath, publicPath: '/static/' }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { - // path: path.join(basicOutputPath, 'dist'), - // publicPath: '/static/', - // }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { - // path: path.join(basicOutputPath, 'dist/#leadinghash'), - // publicPath: '/', - // }, - // publicPathForRequest: '/', - // }, - // { - // output: { - // path: basicOutputPath, - // publicPath: 'http://127.0.0.1/', - // }, - // publicPathForRequest: '/', - // }, - // { - // output: { - // path: basicOutputPath, - // publicPath: 'http://127.0.0.1:3000/', - // }, - // publicPathForRequest: '/', - // }, - // { - // output: { - // path: basicOutputPath, - // publicPath: '//test.domain/', - // }, - // publicPathForRequest: '/', - // }, - // ]; - // - // const isWindows = process.platform === 'win32'; - // - // if (isWindows) { - // fixtures.push( - // { - // file: 'windows.txt', - // data: 'windows.txt content', - // urls: [ - // { - // value: 'windows.txt', - // contentType: 'text/plain; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'windows 2.txt', - // data: 'windows 2.txt content', - // urls: [ - // { - // value: 'windows%202.txt', - // contentType: 'text/plain; charset=utf-8', - // code: 200, - // }, - // ], - // }, - // { - // file: 'test & test & %20.txt', - // data: 'test & test & %20.txt content', - // urls: [ - // { - // value: 'test%20%26%20test%20%26%20%2520.txt', - // contentType: 'text/plain; charset=utf-8', - // code: 200, - // }, - // ], - // } - // ); - // - // configurations.push( - // { - // output: { - // path: path.join(basicOutputPath, 'my static'), - // publicPath: '/static/', - // }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { - // path: path.join(basicOutputPath, 'my%20static'), - // publicPath: '/static/', - // }, - // publicPathForRequest: '/static/', - // }, - // { - // output: { - // path: path.join(basicOutputPath, 'my %20 static'), - // publicPath: '/my%20static/', - // }, - // publicPathForRequest: '/my%20static/', - // } - // ); - // } - // - // for (const configuration of configurations) { - // // eslint-disable-next-line no-loop-func - // describe('should work handle requests', () => { - // const { output, publicPathForRequest } = configuration; - // const { path: outputPath, publicPath } = output; - // - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // publicPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // const { - // context: { - // outputFileSystem: { mkdirSync, writeFileSync }, - // }, - // } = instance; - // - // for (const { file, data } of fixtures) { - // if (file) { - // const fullPath = path.join(outputPath, file); - // - // mkdirSync(path.dirname(fullPath), { recursive: true }); - // writeFileSync(fullPath, data); - // } - // } - // }); - // - // afterAll(close); - // - // for (const { data, urls } of fixtures) { - // for (const { value, contentType, code } of urls) { - // // eslint-disable-next-line no-loop-func - // it(`should return the "${code}" code for the "GET" request for the "${value}" url`, (done) => { - // request(app) - // .get(`${publicPathForRequest}${value}`) - // .expect('Content-Type', contentType) - // .expect('Content-Length', data ? String(data.length) : /\d+/) - // .expect(code, done); - // }); - // } - // } - // }); - // } - // }); - // - // describe('should respect the value of the "Content-Type" header from other middleware', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use((req, res, next) => { - // res.set('Content-Type', 'application/octet-stream'); - // next(); - // }); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should not guess a MIME type if the "Content-Type" header is found', (done) => { - // request(app) - // .get('/bundle.js') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should not throw an error on the valid "output.path" value for linux', () => { - // it('should be no error', (done) => { - // expect(() => { - // const compiler = getCompiler(); - // - // compiler.outputPath = '/my/path'; - // - // instance = middleware(compiler); - // - // instance.close(done); - // }).not.toThrow(); - // }); - // }); - // - // describe('should not throw an error on the valid "output.path" value for windows', () => { - // it('should be no error', (done) => { - // expect(() => { - // const compiler = getCompiler(); - // - // compiler.outputPath = 'C:/my/path'; - // - // instance = middleware(compiler); - // - // instance.close(done); - // }).not.toThrow(); - // }); - // }); - // - // describe('should work without "output" options', () => { - // beforeAll((done) => { - // // eslint-disable-next-line no-undefined - // const compiler = getCompiler({ ...webpackConfig, output: undefined }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/main.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should work with trailing slash at the end of the "option.path" option', () => { - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve(__dirname, './outputs/basic/'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should respect empty "output.publicPath" and "output.path" options', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options', () => { - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // publicPath: '/static/', - // path: path.resolve(__dirname, './outputs/other-basic'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options with hash substitutions', () => { - // let hash; - // - // beforeAll((done) => { - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // publicPath: isWebpack5() - // ? '/static/[fullhash]/' - // : '/static/[hash]/', - // path: isWebpack5() - // ? path.resolve(__dirname, './outputs/other-basic-[fullhash]') - // : path.resolve(__dirname, './outputs/other-basic-[hash]'), - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - // hash = h; - // done(); - // }); - // }); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get(`/static/${hash}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the public path', (done) => { - // request(app) - // .get(`/static/${hash}/`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get(`/static/${hash}/index.html`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with hash substitutions', () => { - // let hashOne; - // let hashTwo; - // - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle.js', - // path: isWebpack5() - // ? path.resolve( - // __dirname, - // './outputs/array-[fullhash]/static-one' - // ) - // : path.resolve(__dirname, './outputs/array-[hash]/static-one'), - // publicPath: isWebpack5() - // ? '/static-one/[fullhash]/' - // : '/static-one/[hash]/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle.js', - // path: isWebpack5() - // ? path.resolve( - // __dirname, - // './outputs/array-[fullhash]/static-two' - // ) - // : path.resolve(__dirname, './outputs/array-[hash]/static-two'), - // publicPath: isWebpack5() - // ? '/static-two/[fullhash]/' - // : '/static-two/[hash]/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.done.tap('wdm-test', (params) => { - // const [one, two] = params.stats; - // - // hashOne = one.hash; - // hashTwo = two.hash; - // - // done(); - // }); - // }); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get(`/static-one/${hashOne}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - // request(app).get(`/static-one/${hashOne}/invalid.js`).expect(404, done); - // }); - // - // it('should return "200" code for GET request for the second bundle file', (done) => { - // request(app) - // .get(`/static-one/${hashOne}/`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get(`/static-one/${hashOne}/index.html`) - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/bundle.js`).expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/invalid.js`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "public" path for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to the "index" option for the second compiler', (done) => { - // request(app).get(`/static-two/${hashTwo}/index.html`).expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with difference "publicPath" and "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackMultiConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/static-one/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the first compiler', (done) => { - // request(app).get('/static-one/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - // request(app) - // .get('/static-one/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get('/static-one/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the second bundle file', (done) => { - // request(app).get('/static-two/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file for the second compiler', (done) => { - // request(app).get('/static-two/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - // request(app).get('/static-two/').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - // request(app).get('/static-two/index.html').expect(404, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "publicPath"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/my-public/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/array/static-two'), - // publicPath: '/my-public/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/my-public/bundle-one.js').expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get('/my-public/bundle-two.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/my-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path', (done) => { - // request(app) - // .get('/my-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/my-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode with same "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackMultiConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/one-public/', - // }, - // }, - // { - // ...webpackMultiConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/array/static-one'), - // publicPath: '/two-public/', - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file for the first compiler', (done) => { - // request(app).get('/one-public/bundle-one.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file to the first bundle file', (done) => { - // request(app).get('/one-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the first compiler', (done) => { - // request(app) - // .get('/one-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the first compiler', (done) => { - // request(app) - // .get('/one-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the bundle file for the second compiler', (done) => { - // request(app).get('/two-public/bundle-two.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file to the second bundle file', (done) => { - // request(app).get('/two-public/invalid.js').expect(404, done); - // }); - // - // it('should return "200" code for GET request to the "public" path for the second compiler', (done) => { - // request(app) - // .get('/two-public/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "200" code for GET request to the "index" option for the second compiler', (done) => { - // request(app) - // .get('/two-public/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in first)', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackClientServerConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration (in second)', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // webpackClientServerConfig[1], - // webpackClientServerConfig[0], - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app) - // .get('/static/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to non-public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should respect "output.publicPath" and "output.path" options in multi-compiler mode, when the "output.publicPath" option presented in only one configuration with same "path"', () => { - // beforeAll((done) => { - // const compiler = getCompiler([ - // { - // ...webpackClientServerConfig[0], - // output: { - // filename: 'bundle-one.js', - // path: path.resolve(__dirname, './outputs/client-server/same'), - // publicPath: '/static/', - // }, - // }, - // { - // ...webpackClientServerConfig[1], - // output: { - // filename: 'bundle-two.js', - // path: path.resolve(__dirname, './outputs/client-server/same'), - // }, - // }, - // ]); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return "200" code for GET request to the bundle file', (done) => { - // request(app).get('/static/bundle-one.js').expect(200, done); - // }); - // - // it('should return "404" code for GET request to a nonexistent file', (done) => { - // request(app).get('/static/invalid.js').expect(404, done); - // }); - // - // it('should return "404" code for GET request to the public path', (done) => { - // request(app).get('/static/').expect(200, done); - // }); - // - // it('should return "200" code for GET request to the non-public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return "404" code for GET request to the "index" option', (done) => { - // request(app) - // .get('/static/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should respect the "stats" option with the "false" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: false }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // - // describe('should respect the "stats" option with the "none" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: 'none' }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // - // describe('should respect the "stats" option with the "minimal" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ ...webpackConfig, stats: 'minimal' }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // - // describe('should respect the "stats" option in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackOneErrorOneWarningOneSuccessConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" requests to bundles file', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // return request(app) - // .get('/static-three/bundle.js') - // .expect(200, (thirdError) => { - // if (thirdError) { - // return done(thirdError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // }); - // }); - // - // describe('should respect the "stats" option with the "{ all: false, entrypoints: true }" value from the configuration', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // stats: { all: false, entrypoints: true }, - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // - // describe('should respect the "stats" option from the configuration in multi-compiler mode', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to bundle files', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // }); - // - // describe('should respect the "stats" option from the configuration in multi-compiler mode and use the "name" option', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler( - // webpackOneErrorOneWarningOneSuccessWithNamesConfig - // ); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for "GET" requests to bundle files', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // return request(app) - // .get('/static-three/bundle.js') - // .expect(200, (thirdError) => { - // if (thirdError) { - // return done(thirdError); - // } - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // return done(); - // }); - // }); - // }); - // }); - // }); - // - // describe('should throw an error on "run" when we watching', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging an error', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // return compiler.run((runError) => { - // expect(() => { - // throw runError; - // }).toThrowErrorMatchingSnapshot(); - // - // done(); - // }); - // }); - // }); - // }); - // - // describe('should throw an error on "watch" when we watching', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging an error', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // return compiler.watch({}, (watchError) => { - // expect(() => { - // throw watchError; - // }).toThrowErrorMatchingSnapshot(); - // - // done(); - // }); - // }); - // }); - // }); - // - // describe('should handle an earlier request if a change happened while compiling', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // let invalidated = false; - // - // compiler.hooks.done.tap('Invalidated', () => { - // if (!invalidated) { - // instance.invalidate(); - // - // invalidated = true; - // } - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app).get('/bundle.js').expect(200, done); - // }); - // }); - //}); - // - //describe('mimeTypes option', () => { - // describe('should set the correct value for "Content-Type" header to known MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.html'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to "file.html"', (done) => { - // request(app) - // .get('/file.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, 'welcome', done); - // }); - // }); - // - // describe('should set the correct value for "Content-Type" header to unknown MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.phtml'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to "file.html"', (done) => { - // request(app) - // .get('/file.phtml') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should set the correct value for "Content-Type" header to specified MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // mimeTypes: { - // phtml: 'text/html', - // }, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'file.phtml'), - // 'welcome' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request "file.html"', (done) => { - // request(app) - // .get('/file.phtml') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, 'welcome', done); - // }); - // }); - //}); - // - //describe('watchOptions option', () => { - // describe('should work without value', () => { - // let compiler; - // let spy; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // spy = jest.spyOn(compiler, 'watch'); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // spy.mockRestore(); - // - // close(); - // }); - // - // it('should pass arguments to the "watch" method', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(spy).toHaveBeenCalledTimes(1); - // expect(spy.mock.calls[0][0]).toEqual({}); - // - // return done(); - // }); - // }); - // }); - // - // describe('should respect options from the configuration', () => { - // let compiler; - // let spy; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackWatchOptionsConfig); - // - // spy = jest.spyOn(compiler, 'watch'); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // spy.mockRestore(); - // - // close(); - // }); - // - // it('should pass arguments to the "watch" method', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(done); - // } - // - // expect(spy).toHaveBeenCalledTimes(1); - // expect(spy.mock.calls[0][0]).toEqual({ - // aggregateTimeout: 300, - // poll: true, - // }); - // - // return done(error); - // }); - // }); - // }); - // - // describe('should respect options from the configuration in multi-compile mode', () => { - // let compiler; - // let spy; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiWatchOptionsConfig); - // - // spy = jest.spyOn(compiler, 'watch'); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // spy.mockRestore(); - // - // close(); - // }); - // - // it('should pass arguments to the "watch" method', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // - // expect(spy).toHaveBeenCalledTimes(1); - // expect(spy.mock.calls[0][0]).toEqual([ - // { aggregateTimeout: 800, poll: false }, - // { aggregateTimeout: 300, poll: true }, - // ]); - // - // return done(); - // }); - // }); - // }); - // }); - //}); - // - //describe('writeToDisk option', () => { - // describe('should work with "true" value', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve(__dirname, './outputs/write-to-disk-true'), - // }, - // }); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync(path.posix.resolve(__dirname, './outputs/write-to-disk-true')); - // - // close(); - // }); - // - // it('should find the bundle file on disk', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // './outputs/write-to-disk-true/bundle.js' - // ); - // - // expect( - // compiler.hooks.assetEmitted.taps.filter( - // (hook) => hook.name === 'DevMiddleware' - // ).length - // ).toBe(1); - // expect(fs.existsSync(bundlePath)).toBe(true); - // - // instance.invalidate(); - // - // return compiler.hooks.done.tap( - // 'DevMiddlewareWriteToDiskTest', - // () => { - // expect( - // compiler.hooks.assetEmitted.taps.filter( - // (hook) => hook.name === 'DevMiddleware' - // ).length - // ).toBe(1); - // - // done(); - // } - // ); - // }); - // }); - // }); - // - // describe('should work with "false" value', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve(__dirname, './outputs/write-to-disk-false'), - // }, - // }); - // - // instance = middleware(compiler, { writeToDisk: false }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should not find the bundle file on disk', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // './outputs/write-to-disk-false/bundle.js' - // ); - // - // expect( - // compiler.hooks.assetEmitted.taps.filter( - // (hook) => hook.name === 'DevMiddleware' - // ).length - // ).toBe(0); - // expect(fs.existsSync(bundlePath)).toBe(false); - // - // instance.invalidate(); - // - // return compiler.hooks.done.tap( - // 'DevMiddlewareWriteToDiskTest', - // () => { - // expect( - // compiler.hooks.assetEmitted.taps.filter( - // (hook) => hook.name === 'DevMiddleware' - // ).length - // ).toBe(0); - // - // done(); - // } - // ); - // }); - // }); - // }); - // - // describe('should work with "Function" value when it returns "true"', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-function-true' - // ), - // }, - // }); - // - // instance = middleware(compiler, { - // writeToDisk: (filePath) => /bundle\.js$/.test(filePath), - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-function-true') - // ); - // - // close(); - // }); - // - // it('should find the bundle file on disk', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // './outputs/write-to-disk-function-true/bundle.js' - // ); - // - // expect(fs.existsSync(bundlePath)).toBe(true); - // - // return done(); - // }); - // }); - // }); - // - // describe('should work with "Function" value when it returns "false"', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-function-false' - // ), - // }, - // }); - // - // instance = middleware(compiler, { - // writeToDisk: (filePath) => !/bundle\.js$/.test(filePath), - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-function-false' - // ) - // ); - // - // close(); - // }); - // - // it('should not find the bundle file on disk', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // './outputs/write-to-disk-function-false/bundle.js' - // ); - // - // expect(fs.existsSync(bundlePath)).toBe(false); - // - // return done(); - // }); - // }); - // }); - // - // describe('should work when assets have query string', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackQueryStringConfig, - // output: { - // filename: 'bundle.js?[contenthash]', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-query-string' - // ), - // }, - // }); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-query-string') - // ); - // - // close(); - // }); - // - // it('should find the bundle file on disk with no querystring', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // './outputs/write-to-disk-query-string/bundle.js' - // ); - // - // expect(fs.existsSync(bundlePath)).toBe(true); - // - // return done(); - // }); - // }); - // }); - // - // describe('should work in multi-compiler mode', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler([ - // { - // ...webpackMultiWatchOptionsConfig[0], - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-multi-compiler/static-one' - // ), - // publicPath: '/static-one/', - // }, - // }, - // { - // ...webpackMultiWatchOptionsConfig[1], - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-multi-compiler/static-two' - // ), - // publicPath: '/static-two/', - // }, - // }, - // ]); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-multi-compiler/' - // ) - // ); - // - // close(); - // }); - // - // it('should find the bundle files on disk', (done) => { - // request(app) - // .get('/static-one/bundle.js') - // .expect(200, (firstError) => { - // if (firstError) { - // return done(firstError); - // } - // - // return request(app) - // .get('/static-two/bundle.js') - // .expect(200, (secondError) => { - // if (secondError) { - // return done(secondError); - // } - // const bundleFiles = [ - // './outputs/write-to-disk-multi-compiler/static-one/bundle.js', - // './outputs/write-to-disk-multi-compiler/static-one/index.html', - // './outputs/write-to-disk-multi-compiler/static-one/svg.svg', - // './outputs/write-to-disk-multi-compiler/static-two/bundle.js', - // ]; - // - // for (const bundleFile of bundleFiles) { - // const bundlePath = path.resolve(__dirname, bundleFile); - // - // expect(fs.existsSync(bundlePath)).toBe(true); - // } - // - // return done(); - // }); - // }); - // }); - // }); - // - // describe('should work with "[hash]"/"[fullhash]" in the "output.path" and "output.publicPath" option', () => { - // let compiler; - // let hash; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackConfig, - // ...{ - // output: { - // filename: 'bundle.js', - // publicPath: isWebpack5() - // ? '/static/[fullhash]/' - // : '/static/[hash]/', - // path: isWebpack5() - // ? path.resolve( - // __dirname, - // './outputs/write-to-disk-with-hash/dist_[fullhash]' - // ) - // : path.resolve( - // __dirname, - // './outputs/write-to-disk-with-hash/dist_[hash]' - // ), - // }, - // }, - // }); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(() => { - // compiler.hooks.afterCompile.tap('wdm-test', ({ hash: h }) => { - // hash = h; - // done(); - // }); - // }); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-with-hash/') - // ); - // - // close(); - // }); - // - // it('should find the bundle file on disk', (done) => { - // request(app) - // .get(`/static/${hash}/bundle.js`) - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // const bundlePath = path.resolve( - // __dirname, - // `./outputs/write-to-disk-with-hash/dist_${hash}/bundle.js` - // ); - // - // expect(fs.existsSync(bundlePath)).toBe(true); - // - // return done(); - // }); - // }); - // }); - //}); - // - //describe('methods option', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { - // methods: ['POST'], - // publicPath: '/public/', - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "POST" request to the bundle file', (done) => { - // request(app).post('/public/bundle.js').expect(200, done); - // }); - // - // it('should return the "404" code for the "GET" request to the bundle file', (done) => { - // request(app).get('/public/bundle.js').expect(404, done); - // }); - // - // it('should return the "200" code for the "HEAD" request to the bundle file', (done) => { - // request(app).head('/public/bundle.js').expect(404, done); - // }); - //}); - // - //describe('headers option', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { - // headers: { 'X-nonsense-1': 'yes', 'X-nonsense-2': 'no' }, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file and return headers', (done) => { - // request(app) - // .get('/bundle.js') - // .expect('X-nonsense-1', 'yes') - // .expect('X-nonsense-2', 'no') - // .expect(200, done); - // }); - //}); - // - //describe('publicPath option', () => { - // describe('should work with "string" value', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { publicPath: '/public/' }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the bundle file', (done) => { - // request(app).get('/public/bundle.js').expect(200, done); - // }); - // }); - //}); - // - //describe('serverSideRender option', () => { - // let locals; - // - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { serverSideRender: true }); - // - // app = express(); - // app.use(instance); - // app.use((req, res) => { - // // eslint-disable-next-line prefer-destructuring - // locals = res.locals; - // - // res.sendStatus(200); - // }); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request', (done) => { - // request(app) - // .get('/foo/bar') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // expect(locals.webpack.devMiddleware).toBeDefined(); - // - // return done(); - // }); - // }); - //}); - // - //describe('outputFileSystem option', () => { - // describe('should work with an unspecified value', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should use the "memfs" package by default', () => { - // const { Stats } = memfs; - // - // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - // Stats - // ); - // expect(compiler.outputFileSystem).toHaveProperty('join'); - // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - // }); - // }); - // - // describe('should work with the configured value (native fs)', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // const configuredFs = fs; - // - // configuredFs.join = path.join.bind(path); - // configuredFs.mkdirp = () => {}; - // - // instance = middleware(compiler, { - // outputFileSystem: configuredFs, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should use the configurated output filesystem', () => { - // const { Stats } = fs; - // - // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - // Stats - // ); - // expect(compiler.outputFileSystem).toHaveProperty('join'); - // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - // }); - // }); - // - // describe('should work with the configured value (memfs)', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // const configuredFs = createFsFromVolume(new Volume()); - // - // configuredFs.join = path.join.bind(path); - // - // instance = middleware(compiler, { - // outputFileSystem: configuredFs, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should use the configured output filesystem', () => { - // const { Stats } = memfs; - // - // expect(new compiler.outputFileSystem.Stats()).toBeInstanceOf(Stats); - // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - // Stats - // ); - // expect(compiler.outputFileSystem).toHaveProperty('join'); - // expect(compiler.outputFileSystem).toHaveProperty('mkdirp'); - // }); - // }); - // - // describe('should work with the configured value in multi-compiler mode (native fs)', () => { - // let compiler; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackMultiConfig); - // - // const configuredFs = fs; - // - // configuredFs.join = path.join.bind(path); - // configuredFs.mkdirp = () => {}; - // - // instance = middleware(compiler, { - // outputFileSystem: configuredFs, - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should use configured output filesystems', () => { - // const { Stats } = fs; - // - // for (const childCompiler of compiler.compilers) { - // expect(new childCompiler.outputFileSystem.Stats()).toBeInstanceOf( - // Stats - // ); - // expect(childCompiler.outputFileSystem).toHaveProperty('join'); - // expect(childCompiler.outputFileSystem).toHaveProperty('mkdirp'); - // } - // - // expect(new instance.context.outputFileSystem.Stats()).toBeInstanceOf( - // Stats - // ); - // expect(instance.context.outputFileSystem).toHaveProperty('join'); - // expect(instance.context.outputFileSystem).toHaveProperty('mkdirp'); - // }); - // }); - // - // describe('should throw an error on the invalid fs value - no join method', () => { - // it('should throw an error', () => { - // expect(() => { - // const compiler = getCompiler(webpackConfig); - // - // middleware(compiler, { outputFileSystem: { mkdirp: () => {} } }); - // }).toThrow( - // 'Invalid options: options.outputFileSystem.join() method is expected' - // ); - // }); - // }); - // - // describe('should throw an error on the invalid fs value - no mkdirp method', () => { - // it('should throw an error', () => { - // expect(() => { - // const compiler = getCompiler(webpackConfig); - // - // middleware(compiler, { outputFileSystem: { join: () => {} } }); - // }).toThrow( - // 'Invalid options: options.outputFileSystem.mkdirp() method is expected' - // ); - // }); - // }); - //}); - // - //describe('index option', () => { - // describe('should work with "false" value', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { index: false, publicPath: '/' }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "404" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(404, done); - // }); - // - // it('should return the "200" code for the "GET" request to the "index.html" file', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "true" value', () => { - // beforeAll((done) => { - // const compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { index: true, publicPath: '/' }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/index.html') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "string" value', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // index: 'default.html', - // publicPath: '/', - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'default.html'), - // 'hello' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "string" value with a custom extension', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // index: 'index.custom', - // publicPath: '/', - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'index.custom'), - // 'hello' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "string" value with a custom extension and defined a custom MIME type', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // index: 'index.custom', - // mimeTypes: { - // custom: 'text/html', - // }, - // publicPath: '/', - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'index.custom'), - // 'hello' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'text/html; charset=utf-8') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "string" value without an extension', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { index: 'noextension' }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.writeFileSync( - // path.resolve(outputPath, 'noextension'), - // 'hello' - // ); - // }); - // - // afterAll(close); - // - // it('should return the "200" code for the "GET" request to the public path', (done) => { - // request(app) - // .get('/') - // .expect('Content-Type', 'application/octet-stream') - // .expect(200, done); - // }); - // }); - // - // describe('should work with "string" value but the "index" option is a directory', () => { - // beforeAll((done) => { - // const outputPath = path.resolve(__dirname, './outputs/basic'); - // const compiler = getCompiler({ - // ...webpackConfig, - // output: { - // filename: 'bundle.js', - // path: outputPath, - // }, - // }); - // - // instance = middleware(compiler, { - // index: 'custom.html', - // publicPath: '/', - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // - // instance.context.outputFileSystem.mkdirSync(outputPath, { - // recursive: true, - // }); - // instance.context.outputFileSystem.mkdirSync( - // path.resolve(outputPath, 'custom.html') - // ); - // }); - // - // afterAll(close); - // - // it('should return the "404" code for the "GET" request to the public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - // - // describe('should not handle request when index is neither a file nor a directory', () => { - // let compiler; - // let isDirectory; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // instance = middleware(compiler, { - // index: 'default.html', - // publicPath: '/', - // }); - // - // isDirectory = jest - // .spyOn(instance.context.outputFileSystem, 'statSync') - // .mockImplementation(() => { - // return { - // isFile: () => false, - // isDirectory: () => false, - // }; - // }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // isDirectory.mockRestore(); - // - // close(); - // }); - // - // it('should return the "404" code for the "GET" request to the public path', (done) => { - // request(app).get('/').expect(404, done); - // }); - // }); - //}); + close(); + }); + + it('should return the "404" code for the "GET" request to the public path', (done) => { + request(app).get('/').expect(404, done); + }); + }); + }); describe('logger', () => { - //describe('should logging on successfully build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on successfully build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on successfully build in multi-compiler mode', () => { let compiler; @@ -3256,8 +3252,6 @@ describe('middleware', () => { instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFileSync(path.resolve(process.cwd(), './1-11'), 'HERE'); - expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3266,44 +3260,44 @@ describe('middleware', () => { }); }); - //describe('should logging on unsuccessful build', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackErrorConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging on unsuccessful build', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackErrorConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging on unsuccessful build in multi-compiler ', () => { let compiler; @@ -3336,8 +3330,6 @@ describe('middleware', () => { instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFileSync(path.resolve(process.cwd(), './2-11'), 'HERE'); - expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3346,92 +3338,76 @@ describe('middleware', () => { }); }); - //describe('should logging an warning', () => { - // let compiler; - // let getLogsPlugin; - // - // beforeAll((done) => { - // compiler = getCompiler(webpackWarningConfig); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(close); - // - // it('should logging', (done) => { - // request(app) - // .get('/bundle.js') - // .expect(200, (error) => { - // if (error) { - // return done(error); - // } - // - // instance.invalidate(); - // - // return instance.waitUntilValid(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // done(); - // }); - // }); - // }); - //}); + describe('should logging an warning', () => { + let compiler; + let getLogsPlugin; + + beforeAll((done) => { + compiler = getCompiler(webpackWarningConfig); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should logging', (done) => { + request(app) + .get('/bundle.js') + .expect(200, (error) => { + if (error) { + return done(error); + } + + instance.invalidate(); + + return instance.waitUntilValid(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + done(); + }); + }); + }); + }); describe('should logging warnings in multi-compiler mode', () => { let compiler; let getLogsPlugin; - fs.writeFileSync(path.resolve(process.cwd(), './3-1'), 'HERE'); - beforeAll((done) => { - fs.writeFileSync(path.resolve(process.cwd(), './3-2'), 'HERE'); compiler = getCompiler(webpackMultiWarningConfig); - fs.writeFileSync(path.resolve(process.cwd(), './3-3'), 'HERE'); getLogsPlugin = new GetLogsPlugin(); getLogsPlugin.apply(compiler); - fs.writeFileSync(path.resolve(process.cwd(), './3-4'), 'HERE'); instance = middleware(compiler); - fs.writeFileSync(path.resolve(process.cwd(), './3-5'), 'HERE'); app = express(); app.use(instance); - fs.writeFileSync(path.resolve(process.cwd(), './3-6'), 'HERE'); listen = listenShorthand(done); - fs.writeFileSync(path.resolve(process.cwd(), './3-7'), 'HERE'); }); afterAll(close); it('should logging', (done) => { - fs.writeFileSync(path.resolve(process.cwd(), './3-8'), 'HERE'); - request(app) .get('/static-one/bundle.js') .expect(200, (error) => { - fs.writeFileSync(path.resolve(process.cwd(), './3-9'), 'HERE'); - if (error) { return done(error); } - fs.writeFileSync(path.resolve(process.cwd(), './3-10'), 'HERE'); - instance.invalidate(); return instance.waitUntilValid(() => { - fs.writeFileSync(path.resolve(process.cwd(), './3-11'), 'HERE'); - expect(getLogsPlugin.logs).toMatchSnapshot(); done(); @@ -3440,152 +3416,152 @@ describe('middleware', () => { }); }); - //describe('should logging an error in "watch" method', () => { - // let getLogsPlugin; - // - // it('should logging on startup', () => { - // const compiler = getCompiler(webpackConfig); - // - // const watchSpy = jest - // .spyOn(compiler, 'watch') - // .mockImplementation((watchOptions, callback) => { - // const error = new Error('Error in Watch method'); - // - // error.stack = ''; - // - // callback(error); - // - // return { close: () => {} }; - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler); - // - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // instance.close(); - // - // watchSpy.mockRestore(); - // }); - //}); - - //describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let mkdirSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-mkdir-error' - // ), - // }, - // }); - // - // mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.mkdir" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // del.sync( - // path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') - // ); - // - // mkdirSpy.mockRestore(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); - - //describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { - // let compiler; - // let getLogsPlugin; - // let writeFileSpy; - // - // beforeAll((done) => { - // compiler = getCompiler({ - // ...webpackSimpleConfig, - // output: { - // filename: 'bundle.js', - // path: path.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ), - // }, - // }); - // - // writeFileSpy = jest - // .spyOn(fs, 'writeFile') - // .mockImplementation((...args) => { - // const callback = args[args.length - 1]; - // - // return callback(new Error('Error in the "fs.writeFile" method.')); - // }); - // - // getLogsPlugin = new GetLogsPlugin(); - // getLogsPlugin.apply(compiler); - // - // instance = middleware(compiler, { writeToDisk: true }); - // - // app = express(); - // app.use(instance); - // - // listen = listenShorthand(done); - // }); - // - // afterAll(() => { - // writeFileSpy.mockRestore(); - // - // del.sync( - // path.posix.resolve( - // __dirname, - // './outputs/write-to-disk-writeFile-error' - // ) - // ); - // - // close(); - // }); - // - // it('should logging', (done) => { - // compiler.hooks.failed.tap('FailedCatcher', () => { - // instance.close(() => { - // expect(getLogsPlugin.logs).toMatchSnapshot(); - // - // listen.close(() => { - // done(); - // }); - // }); - // }); - // }); - //}); + describe('should logging an error in "watch" method', () => { + let getLogsPlugin; + + it('should logging on startup', () => { + const compiler = getCompiler(webpackConfig); + + const watchSpy = jest + .spyOn(compiler, 'watch') + .mockImplementation((watchOptions, callback) => { + const error = new Error('Error in Watch method'); + + error.stack = ''; + + callback(error); + + return { close: () => {} }; + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler); + + expect(getLogsPlugin.logs).toMatchSnapshot(); + + instance.close(); + + watchSpy.mockRestore(); + }); + }); + + describe('should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let mkdirSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-mkdir-error' + ), + }, + }); + + mkdirSpy = jest.spyOn(fs, 'mkdir').mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.mkdir" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + del.sync( + path.posix.resolve(__dirname, './outputs/write-to-disk-mkdir-error') + ); + + mkdirSpy.mockRestore(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); + + describe('should logging an error from the "fs.writeFile" method when the "writeToDisk" option is "true" ', () => { + let compiler; + let getLogsPlugin; + let writeFileSpy; + + beforeAll((done) => { + compiler = getCompiler({ + ...webpackSimpleConfig, + output: { + filename: 'bundle.js', + path: path.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ), + }, + }); + + writeFileSpy = jest + .spyOn(fs, 'writeFile') + .mockImplementation((...args) => { + const callback = args[args.length - 1]; + + return callback(new Error('Error in the "fs.writeFile" method.')); + }); + + getLogsPlugin = new GetLogsPlugin(); + getLogsPlugin.apply(compiler); + + instance = middleware(compiler, { writeToDisk: true }); + + app = express(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(() => { + writeFileSpy.mockRestore(); + + del.sync( + path.posix.resolve( + __dirname, + './outputs/write-to-disk-writeFile-error' + ) + ); + + close(); + }); + + it('should logging', (done) => { + compiler.hooks.failed.tap('FailedCatcher', () => { + instance.close(() => { + expect(getLogsPlugin.logs).toMatchSnapshot(); + + listen.close(() => { + done(); + }); + }); + }); + }); + }); }); }); From 01d718331469cf2e319a8de3c9b8d9c8be57df93 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 8 Apr 2020 19:31:43 +0300 Subject: [PATCH 80/87] ci: improve --- .github/workflows/nodejs.yml | 4 +- patch.js | 755 +++++++++++++++++++++++++++++++++++ src/index.js | 3 +- 3 files changed, 759 insertions(+), 3 deletions(-) create mode 100644 patch.js diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index ec11edc8a..b6787b4cc 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -87,7 +87,9 @@ jobs: - name: Run tests for webpack version ${{ matrix.webpack-version }} # run: npm run test:coverage -- --ci - run: node_modules/.bin/jest test/middleware.test.js --ci --verbose --runInBand --forceExit + run: | + node patch.js + node_modules/.bin/jest test/middleware.test.js --ci --verbose --runInBand --forceExit - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/patch.js b/patch.js new file mode 100644 index 000000000..7b50f08bb --- /dev/null +++ b/patch.js @@ -0,0 +1,755 @@ +const fs = require('fs'); +const path = require('path'); + +fs.writeFileSync( + path.resolve(__dirname, './node_modules/chokidar/index.js'), + `'use strict'; +var EventEmitter = require('events').EventEmitter; +var fs = require('fs'); +var sysPath = require('path'); +var asyncEach = require('async-each'); +var anymatch = require('anymatch'); +var globParent = require('glob-parent'); +var isGlob = require('is-glob'); +var isAbsolute = require('path-is-absolute'); +var inherits = require('inherits'); +var braces = require('braces'); +var normalizePath = require('normalize-path'); +var upath = require('upath'); + +var NodeFsHandler = require('./lib/nodefs-handler'); +var FsEventsHandler = require('./lib/fsevents-handler'); + +var arrify = function(value) { + if (value == null) return []; + return Array.isArray(value) ? value : [value]; +}; + +var flatten = function(list, result) { + if (result == null) result = []; + list.forEach(function(item) { + if (Array.isArray(item)) { + flatten(item, result); + } else { + result.push(item); + } + }); + return result; +}; + +// Little isString util for use in Array#every. +var isString = function(thing) { + return typeof thing === 'string'; +}; + +// Public: Main class. +// Watches files & directories for changes. +// +// * _opts - object, chokidar options hash +// +// Emitted events: +// \`add\`, \`addDir\`, \`change\`, \`unlink\`, \`unlinkDir\`, \`all\`, \`error\` +// +// Examples +// +// var watcher = new FSWatcher() +// .add(directories) +// .on('add', path => console.log('File', path, 'was added')) +// .on('change', path => console.log('File', path, 'was changed')) +// .on('unlink', path => console.log('File', path, 'was removed')) +// .on('all', (event, path) => console.log(path, ' emitted ', event)) +// +function FSWatcher(_opts) { + EventEmitter.call(this); + var opts = {}; + // in case _opts that is passed in is a frozen object + if (_opts) for (var opt in _opts) opts[opt] = _opts[opt]; + this._watched = Object.create(null); + this._closers = Object.create(null); + this._ignoredPaths = Object.create(null); + Object.defineProperty(this, '_globIgnored', { + get: function() { return Object.keys(this._ignoredPaths); } + }); + this.closed = false; + this._throttled = Object.create(null); + this._symlinkPaths = Object.create(null); + + function undef(key) { + return opts[key] === undefined; + } + + // Set up default options. + if (undef('persistent')) opts.persistent = true; + if (undef('ignoreInitial')) opts.ignoreInitial = false; + if (undef('ignorePermissionErrors')) opts.ignorePermissionErrors = false; + if (undef('interval')) opts.interval = 100; + if (undef('binaryInterval')) opts.binaryInterval = 300; + if (undef('disableGlobbing')) opts.disableGlobbing = false; + this.enableBinaryInterval = opts.binaryInterval !== opts.interval; + + // Enable fsevents on OS X when polling isn't explicitly enabled. + if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling; + + // If we can't use fsevents, ensure the options reflect it's disabled. + if (false) opts.useFsEvents = false; + + // Use polling on Mac if not using fsevents. + // Other platforms use non-polling fs.watch. + if (undef('usePolling') && !opts.useFsEvents) { + opts.usePolling = process.platform === 'darwin'; + } + + // Global override (useful for end-developers that need to force polling for all + // instances of chokidar, regardless of usage/dependency depth) + var envPoll = process.env.CHOKIDAR_USEPOLLING; + if (envPoll !== undefined) { + var envLower = envPoll.toLowerCase(); + + if (envLower === 'false' || envLower === '0') { + opts.usePolling = false; + } else if (envLower === 'true' || envLower === '1') { + opts.usePolling = true; + } else { + opts.usePolling = !!envLower + } + } + var envInterval = process.env.CHOKIDAR_INTERVAL; + if (envInterval) { + opts.interval = parseInt(envInterval); + } + + // Editor atomic write normalization enabled by default with fs.watch + if (undef('atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; + if (opts.atomic) this._pendingUnlinks = Object.create(null); + + if (undef('followSymlinks')) opts.followSymlinks = true; + + if (undef('awaitWriteFinish')) opts.awaitWriteFinish = false; + if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; + var awf = opts.awaitWriteFinish; + if (awf) { + if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; + if (!awf.pollInterval) awf.pollInterval = 100; + + this._pendingWrites = Object.create(null); + } + if (opts.ignored) opts.ignored = arrify(opts.ignored); + + this._isntIgnored = function(path, stat) { + return !this._isIgnored(path, stat); + }.bind(this); + + var readyCalls = 0; + this._emitReady = function() { + if (++readyCalls >= this._readyCount) { + this._emitReady = Function.prototype; + this._readyEmitted = true; + // use process.nextTick to allow time for listener to be bound + process.nextTick(this.emit.bind(this, 'ready')); + } + }.bind(this); + + this.options = opts; + + // You’re frozen when your heart’s not open. + Object.freeze(opts); +} + +inherits(FSWatcher, EventEmitter); + +// Common helpers +// -------------- + +// Private method: Normalize and emit events +// +// * event - string, type of event +// * path - string, file or directory path +// * val[1..3] - arguments to be passed with event +// +// Returns the error if defined, otherwise the value of the +// FSWatcher instance's \`closed\` flag +FSWatcher.prototype._emit = function(event, path, val1, val2, val3) { + if (this.options.cwd) path = sysPath.relative(this.options.cwd, path); + var args = [event, path]; + if (val3 !== undefined) args.push(val1, val2, val3); + else if (val2 !== undefined) args.push(val1, val2); + else if (val1 !== undefined) args.push(val1); + + var awf = this.options.awaitWriteFinish; + if (awf && this._pendingWrites[path]) { + this._pendingWrites[path].lastChange = new Date(); + return this; + } + + if (this.options.atomic) { + if (event === 'unlink') { + this._pendingUnlinks[path] = args; + setTimeout(function() { + Object.keys(this._pendingUnlinks).forEach(function(path) { + this.emit.apply(this, this._pendingUnlinks[path]); + this.emit.apply(this, ['all'].concat(this._pendingUnlinks[path])); + delete this._pendingUnlinks[path]; + }.bind(this)); + }.bind(this), typeof this.options.atomic === "number" + ? this.options.atomic + : 100); + return this; + } else if (event === 'add' && this._pendingUnlinks[path]) { + event = args[0] = 'change'; + delete this._pendingUnlinks[path]; + } + } + + var emitEvent = function() { + this.emit.apply(this, args); + if (event !== 'error') this.emit.apply(this, ['all'].concat(args)); + }.bind(this); + + if (awf && (event === 'add' || event === 'change') && this._readyEmitted) { + var awfEmit = function(err, stats) { + if (err) { + event = args[0] = 'error'; + args[1] = err; + emitEvent(); + } else if (stats) { + // if stats doesn't exist the file must have been deleted + if (args.length > 2) { + args[2] = stats; + } else { + args.push(stats); + } + emitEvent(); + } + }; + + this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); + return this; + } + + if (event === 'change') { + if (!this._throttle('change', path, 50)) return this; + } + + if ( + this.options.alwaysStat && val1 === undefined && + (event === 'add' || event === 'addDir' || event === 'change') + ) { + var fullPath = this.options.cwd ? sysPath.join(this.options.cwd, path) : path; + fs.stat(fullPath, function(error, stats) { + // Suppress event when fs.stat fails, to avoid sending undefined 'stat' + if (error || !stats) return; + + args.push(stats); + emitEvent(); + }); + } else { + emitEvent(); + } + + return this; +}; + +// Private method: Common handler for errors +// +// * error - object, Error instance +// +// Returns the error if defined, otherwise the value of the +// FSWatcher instance's \`closed\` flag +FSWatcher.prototype._handleError = function(error) { + var code = error && error.code; + var ipe = this.options.ignorePermissionErrors; + if (error && + code !== 'ENOENT' && + code !== 'ENOTDIR' && + (!ipe || (code !== 'EPERM' && code !== 'EACCES')) + ) this.emit('error', error); + return error || this.closed; +}; + +// Private method: Helper utility for throttling +// +// * action - string, type of action being throttled +// * path - string, path being acted upon +// * timeout - int, duration of time to suppress duplicate actions +// +// Returns throttle tracking object or false if action should be suppressed +FSWatcher.prototype._throttle = function(action, path, timeout) { + if (!(action in this._throttled)) { + this._throttled[action] = Object.create(null); + } + var throttled = this._throttled[action]; + if (path in throttled) { + throttled[path].count++; + return false; + } + function clear() { + var count = throttled[path] ? throttled[path].count : 0; + delete throttled[path]; + clearTimeout(timeoutObject); + return count; + } + var timeoutObject = setTimeout(clear, timeout); + throttled[path] = {timeoutObject: timeoutObject, clear: clear, count: 0}; + return throttled[path]; +}; + +// Private method: Awaits write operation to finish +// +// * path - string, path being acted upon +// * threshold - int, time in milliseconds a file size must be fixed before +// acknowledging write operation is finished +// * awfEmit - function, to be called when ready for event to be emitted +// Polls a newly created file for size variations. When files size does not +// change for 'threshold' milliseconds calls callback. +FSWatcher.prototype._awaitWriteFinish = function(path, threshold, event, awfEmit) { + var timeoutHandler; + + var fullPath = path; + if (this.options.cwd && !isAbsolute(path)) { + fullPath = sysPath.join(this.options.cwd, path); + } + + var now = new Date(); + + var awaitWriteFinish = (function (prevStat) { + fs.stat(fullPath, function(err, curStat) { + if (err || !(path in this._pendingWrites)) { + if (err && err.code !== 'ENOENT') awfEmit(err); + return; + } + + var now = new Date(); + + if (prevStat && curStat.size != prevStat.size) { + this._pendingWrites[path].lastChange = now; + } + + if (now - this._pendingWrites[path].lastChange >= threshold) { + delete this._pendingWrites[path]; + awfEmit(null, curStat); + } else { + timeoutHandler = setTimeout( + awaitWriteFinish.bind(this, curStat), + this.options.awaitWriteFinish.pollInterval + ); + } + }.bind(this)); + }.bind(this)); + + if (!(path in this._pendingWrites)) { + this._pendingWrites[path] = { + lastChange: now, + cancelWait: function() { + delete this._pendingWrites[path]; + clearTimeout(timeoutHandler); + return event; + }.bind(this) + }; + timeoutHandler = setTimeout( + awaitWriteFinish.bind(this), + this.options.awaitWriteFinish.pollInterval + ); + } +}; + +// Private method: Determines whether user has asked to ignore this path +// +// * path - string, path to file or directory +// * stats - object, result of fs.stat +// +// Returns boolean +var dotRe = /\\..*\\.(sw[px])$|\\~$|\\.subl.*\\.tmp/; +FSWatcher.prototype._isIgnored = function(path, stats) { + if (this.options.atomic && dotRe.test(path)) return true; + + if (!this._userIgnored) { + var cwd = this.options.cwd; + var ignored = this.options.ignored; + if (cwd && ignored) { + ignored = ignored.map(function (path) { + if (typeof path !== 'string') return path; + return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path)); + }); + } + var paths = arrify(ignored) + .filter(function(path) { + return typeof path === 'string' && !isGlob(path); + }).map(function(path) { + return path + '/**'; + }); + this._userIgnored = anymatch( + this._globIgnored.concat(ignored).concat(paths) + ); + } + + return this._userIgnored([path, stats]); +}; + +// Private method: Provides a set of common helpers and properties relating to +// symlink and glob handling +// +// * path - string, file, directory, or glob pattern being watched +// * depth - int, at any depth > 0, this isn't a glob +// +// Returns object containing helpers for this path +var replacerRe = /^\\.[\\/\\\\]/; +FSWatcher.prototype._getWatchHelpers = function(path, depth) { + path = path.replace(replacerRe, ''); + var watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); + var fullWatchPath = sysPath.resolve(watchPath); + var hasGlob = watchPath !== path; + var globFilter = hasGlob ? anymatch(path) : false; + var follow = this.options.followSymlinks; + var globSymlink = hasGlob && follow ? null : false; + + var checkGlobSymlink = function(entry) { + // only need to resolve once + // first entry should always have entry.parentDir === '' + if (globSymlink == null) { + globSymlink = entry.fullParentDir === fullWatchPath ? false : { + realPath: entry.fullParentDir, + linkPath: fullWatchPath + }; + } + + if (globSymlink) { + return entry.fullPath.replace(globSymlink.realPath, globSymlink.linkPath); + } + + return entry.fullPath; + }; + + var entryPath = function(entry) { + return sysPath.join(watchPath, + sysPath.relative(watchPath, checkGlobSymlink(entry)) + ); + }; + + var filterPath = function(entry) { + if (entry.stat && entry.stat.isSymbolicLink()) return filterDir(entry); + var resolvedPath = entryPath(entry); + return (!hasGlob || globFilter(resolvedPath)) && + this._isntIgnored(resolvedPath, entry.stat) && + (this.options.ignorePermissionErrors || + this._hasReadPermissions(entry.stat)); + }.bind(this); + + var getDirParts = function(path) { + if (!hasGlob) return false; + var parts = []; + var expandedPath = braces.expand(path); + expandedPath.forEach(function(path) { + parts.push(sysPath.relative(watchPath, path).split(/[\\/\\\\]/)); + }); + return parts; + }; + + var dirParts = getDirParts(path); + if (dirParts) { + dirParts.forEach(function(parts) { + if (parts.length > 1) parts.pop(); + }); + } + var unmatchedGlob; + + var filterDir = function(entry) { + if (hasGlob) { + var entryParts = getDirParts(checkGlobSymlink(entry)); + var globstar = false; + unmatchedGlob = !dirParts.some(function(parts) { + return parts.every(function(part, i) { + if (part === '**') globstar = true; + return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i]); + }); + }); + } + return !unmatchedGlob && this._isntIgnored(entryPath(entry), entry.stat); + }.bind(this); + + return { + followSymlinks: follow, + statMethod: follow ? 'stat' : 'lstat', + path: path, + watchPath: watchPath, + entryPath: entryPath, + hasGlob: hasGlob, + globFilter: globFilter, + filterPath: filterPath, + filterDir: filterDir + }; +}; + +// Directory helpers +// ----------------- + +// Private method: Provides directory tracking objects +// +// * directory - string, path of the directory +// +// Returns the directory's tracking object +FSWatcher.prototype._getWatchedDir = function(directory) { + var dir = sysPath.resolve(directory); + var watcherRemove = this._remove.bind(this); + if (!(dir in this._watched)) this._watched[dir] = { + _items: Object.create(null), + add: function(item) { + if (item !== '.' && item !== '..') this._items[item] = true; + }, + remove: function(item) { + delete this._items[item]; + if (!this.children().length) { + fs.readdir(dir, function(err) { + if (err) watcherRemove(sysPath.dirname(dir), sysPath.basename(dir)); + }); + } + }, + has: function(item) {return item in this._items;}, + children: function() {return Object.keys(this._items);} + }; + return this._watched[dir]; +}; + +// File helpers +// ------------ + +// Private method: Check for read permissions +// Based on this answer on SO: http://stackoverflow.com/a/11781404/1358405 +// +// * stats - object, result of fs.stat +// +// Returns boolean +FSWatcher.prototype._hasReadPermissions = function(stats) { + return Boolean(4 & parseInt(((stats && stats.mode) & 0x1ff).toString(8)[0], 10)); +}; + +// Private method: Handles emitting unlink events for +// files and directories, and via recursion, for +// files and directories within directories that are unlinked +// +// * directory - string, directory within which the following item is located +// * item - string, base path of item/directory +// +// Returns nothing +FSWatcher.prototype._remove = function(directory, item) { + // if what is being deleted is a directory, get that directory's paths + // for recursive deleting and cleaning of watched object + // if it is not a directory, nestedDirectoryChildren will be empty array + var path = sysPath.join(directory, item); + var fullPath = sysPath.resolve(path); + var isDirectory = this._watched[path] || this._watched[fullPath]; + + // prevent duplicate handling in case of arriving here nearly simultaneously + // via multiple paths (such as _handleFile and _handleDir) + if (!this._throttle('remove', path, 100)) return; + + // if the only watched file is removed, watch for its return + var watchedDirs = Object.keys(this._watched); + if (!isDirectory && !this.options.useFsEvents && watchedDirs.length === 1) { + this.add(directory, item, true); + } + + // This will create a new entry in the watched object in either case + // so we got to do the directory check beforehand + var nestedDirectoryChildren = this._getWatchedDir(path).children(); + + // Recursively remove children directories / files. + nestedDirectoryChildren.forEach(function(nestedItem) { + this._remove(path, nestedItem); + }, this); + + // Check if item was on the watched list and remove it + var parent = this._getWatchedDir(directory); + var wasTracked = parent.has(item); + parent.remove(item); + + // If we wait for this file to be fully written, cancel the wait. + var relPath = path; + if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); + if (this.options.awaitWriteFinish && this._pendingWrites[relPath]) { + var event = this._pendingWrites[relPath].cancelWait(); + if (event === 'add') return; + } + + // The Entry will either be a directory that just got removed + // or a bogus entry to a file, in either case we have to remove it + delete this._watched[path]; + delete this._watched[fullPath]; + var eventName = isDirectory ? 'unlinkDir' : 'unlink'; + if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); + + // Avoid conflicts if we later create another file with the same name + if (!this.options.useFsEvents) { + this._closePath(path); + } +}; + +FSWatcher.prototype._closePath = function(path) { + if (!this._closers[path]) return; + this._closers[path].forEach(function(closer) { + closer(); + }); + delete this._closers[path]; + this._getWatchedDir(sysPath.dirname(path)).remove(sysPath.basename(path)); +} + +// Public method: Adds paths to be watched on an existing FSWatcher instance + +// * paths - string or array of strings, file/directory paths and/or globs +// * _origAdd - private boolean, for handling non-existent paths to be watched +// * _internal - private boolean, indicates a non-user add + +// Returns an instance of FSWatcher for chaining. +FSWatcher.prototype.add = function(paths, _origAdd, _internal) { + var disableGlobbing = this.options.disableGlobbing; + var cwd = this.options.cwd; + this.closed = false; + paths = flatten(arrify(paths)); + + if (!paths.every(isString)) { + throw new TypeError('Non-string provided as watch path: ' + paths); + } + + if (cwd) paths = paths.map(function(path) { + var absPath; + if (isAbsolute(path)) { + absPath = path; + } else if (path[0] === '!') { + absPath = '!' + sysPath.join(cwd, path.substring(1)); + } else { + absPath = sysPath.join(cwd, path); + } + + // Check \`path\` instead of \`absPath\` because the cwd portion can't be a glob + if (disableGlobbing || !isGlob(path)) { + return absPath; + } else { + return normalizePath(absPath); + } + }); + + // set aside negated glob strings + paths = paths.filter(function(path) { + if (path[0] === '!') { + this._ignoredPaths[path.substring(1)] = true; + } else { + // if a path is being added that was previously ignored, stop ignoring it + delete this._ignoredPaths[path]; + delete this._ignoredPaths[path + '/**']; + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = null; + + return true; + } + }, this); + + if (false) { + if (!this._readyCount) this._readyCount = paths.length; + if (this.options.persistent) this._readyCount *= 2; + paths.forEach(this._addToFsEvents, this); + } else { + if (!this._readyCount) this._readyCount = 0; + this._readyCount += paths.length; + asyncEach(paths, function(path, next) { + this._addToNodeFs(path, !_internal, 0, 0, _origAdd, function(err, res) { + if (res) this._emitReady(); + next(err, res); + }.bind(this)); + }.bind(this), function(error, results) { + results.forEach(function(item) { + if (!item || this.closed) return; + this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); + }, this); + }.bind(this)); + } + + return this; +}; + +// Public method: Close watchers or start ignoring events from specified paths. + +// * paths - string or array of strings, file/directory paths and/or globs + +// Returns instance of FSWatcher for chaining. +FSWatcher.prototype.unwatch = function(paths) { + if (this.closed) return this; + paths = flatten(arrify(paths)); + + paths.forEach(function(path) { + // convert to absolute path unless relative path already matches + if (!isAbsolute(path) && !this._closers[path]) { + if (this.options.cwd) path = sysPath.join(this.options.cwd, path); + path = sysPath.resolve(path); + } + + this._closePath(path); + + this._ignoredPaths[path] = true; + if (path in this._watched) { + this._ignoredPaths[path + '/**'] = true; + } + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = null; + }, this); + + return this; +}; + +// Public method: Close watchers and remove all listeners from watched paths. + +// Returns instance of FSWatcher for chaining. +FSWatcher.prototype.close = function() { + if (this.closed) return this; + + this.closed = true; + Object.keys(this._closers).forEach(function(watchPath) { + this._closers[watchPath].forEach(function(closer) { + closer(); + }); + delete this._closers[watchPath]; + }, this); + this._watched = Object.create(null); + + this.removeAllListeners(); + return this; +}; + +// Public method: Expose list of watched paths + +// Returns object w/ dir paths as keys and arrays of contained paths as values. +FSWatcher.prototype.getWatched = function() { + var watchList = {}; + Object.keys(this._watched).forEach(function(dir) { + var key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; + watchList[key || '.'] = Object.keys(this._watched[dir]._items).sort(); + }.bind(this)); + return watchList; +}; + +// Attach watch handler prototype methods +function importHandler(handler) { + Object.keys(handler.prototype).forEach(function(method) { + FSWatcher.prototype[method] = handler.prototype[method]; + }); +} +importHandler(NodeFsHandler); +if (false) importHandler(FsEventsHandler); + +// Export FSWatcher class +exports.FSWatcher = FSWatcher; + +// Public function: Instantiates watcher with paths to be tracked. + +// * paths - string or array of strings, file/directory paths and/or globs +// * options - object, chokidar options + +// Returns an instance of FSWatcher for chaining. +exports.watch = function(paths, options) { + return new FSWatcher(options).add(paths); +}; + +` +); diff --git a/src/index.js b/src/index.js index 6b9195e7f..f16e4635f 100644 --- a/src/index.js +++ b/src/index.js @@ -88,8 +88,7 @@ export default function wdm(compiler, options = {}) { // eslint-disable-next-line no-param-reassign callback = callback || noop; - callback(); - // context.watching.close(callback); + context.watching.close(callback); }, context, From 609eee4fd8c7b133e4268a8b569be265460a9a23 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 8 Apr 2020 21:15:23 +0300 Subject: [PATCH 81/87] ci: improve --- .github/workflows/nodejs.yml | 88 ++- patch.js | 755 --------------------- test/__snapshots__/middleware.test.js.snap | 58 +- 3 files changed, 47 insertions(+), 854 deletions(-) delete mode 100644 patch.js diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b6787b4cc..352660f6b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,55 +11,52 @@ on: - next jobs: - # lint: - # name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} - # - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - # strategy: - # matrix: - # os: [ubuntu-latest] - # node-version: [12.x] - # - # runs-on: ${{ matrix.os }} - # - # steps: - # - uses: actions/checkout@v2 - # with: - # fetch-depth: 0 - # - # - name: Use Node.js ${{ env.node-version }} - # uses: actions/setup-node@v1 - # with: - # node-version: ${{ env.node-version }} - # - # - name: Use latest NPM - # run: sudo npm i -g npm - # - # - name: Install dependencies - # run: npm ci - # - # - name: Lint - # run: npm run lint - # - # - name: Security audit - # run: npm run security - # - # - name: Check commit message - # uses: wagoid/commitlint-github-action@v1 + lint: + name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [12.x] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.node-version }} + + - name: Use latest NPM + run: sudo npm i -g npm + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Security audit + run: npm run security + + - name: Check commit message + uses: wagoid/commitlint-github-action@v1 test: name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} strategy: matrix: - # os: [ubuntu-latest, windows-latest, macos-latest] - os: [macos-latest] - # node-version: [10.x, 12.x, 13.x] - node-version: [13.x] - # webpack-version: [latest, next] - webpack-version: [latest] + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [10.x, 12.x, 13.x] + webpack-version: [latest, next] runs-on: ${{ matrix.os }} @@ -86,10 +83,7 @@ jobs: run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - # run: npm run test:coverage -- --ci - run: | - node patch.js - node_modules/.bin/jest test/middleware.test.js --ci --verbose --runInBand --forceExit + run: npm run test:coverage -- --ci - name: Submit coverage data to codecov uses: codecov/codecov-action@v1 diff --git a/patch.js b/patch.js deleted file mode 100644 index 7b50f08bb..000000000 --- a/patch.js +++ /dev/null @@ -1,755 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -fs.writeFileSync( - path.resolve(__dirname, './node_modules/chokidar/index.js'), - `'use strict'; -var EventEmitter = require('events').EventEmitter; -var fs = require('fs'); -var sysPath = require('path'); -var asyncEach = require('async-each'); -var anymatch = require('anymatch'); -var globParent = require('glob-parent'); -var isGlob = require('is-glob'); -var isAbsolute = require('path-is-absolute'); -var inherits = require('inherits'); -var braces = require('braces'); -var normalizePath = require('normalize-path'); -var upath = require('upath'); - -var NodeFsHandler = require('./lib/nodefs-handler'); -var FsEventsHandler = require('./lib/fsevents-handler'); - -var arrify = function(value) { - if (value == null) return []; - return Array.isArray(value) ? value : [value]; -}; - -var flatten = function(list, result) { - if (result == null) result = []; - list.forEach(function(item) { - if (Array.isArray(item)) { - flatten(item, result); - } else { - result.push(item); - } - }); - return result; -}; - -// Little isString util for use in Array#every. -var isString = function(thing) { - return typeof thing === 'string'; -}; - -// Public: Main class. -// Watches files & directories for changes. -// -// * _opts - object, chokidar options hash -// -// Emitted events: -// \`add\`, \`addDir\`, \`change\`, \`unlink\`, \`unlinkDir\`, \`all\`, \`error\` -// -// Examples -// -// var watcher = new FSWatcher() -// .add(directories) -// .on('add', path => console.log('File', path, 'was added')) -// .on('change', path => console.log('File', path, 'was changed')) -// .on('unlink', path => console.log('File', path, 'was removed')) -// .on('all', (event, path) => console.log(path, ' emitted ', event)) -// -function FSWatcher(_opts) { - EventEmitter.call(this); - var opts = {}; - // in case _opts that is passed in is a frozen object - if (_opts) for (var opt in _opts) opts[opt] = _opts[opt]; - this._watched = Object.create(null); - this._closers = Object.create(null); - this._ignoredPaths = Object.create(null); - Object.defineProperty(this, '_globIgnored', { - get: function() { return Object.keys(this._ignoredPaths); } - }); - this.closed = false; - this._throttled = Object.create(null); - this._symlinkPaths = Object.create(null); - - function undef(key) { - return opts[key] === undefined; - } - - // Set up default options. - if (undef('persistent')) opts.persistent = true; - if (undef('ignoreInitial')) opts.ignoreInitial = false; - if (undef('ignorePermissionErrors')) opts.ignorePermissionErrors = false; - if (undef('interval')) opts.interval = 100; - if (undef('binaryInterval')) opts.binaryInterval = 300; - if (undef('disableGlobbing')) opts.disableGlobbing = false; - this.enableBinaryInterval = opts.binaryInterval !== opts.interval; - - // Enable fsevents on OS X when polling isn't explicitly enabled. - if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling; - - // If we can't use fsevents, ensure the options reflect it's disabled. - if (false) opts.useFsEvents = false; - - // Use polling on Mac if not using fsevents. - // Other platforms use non-polling fs.watch. - if (undef('usePolling') && !opts.useFsEvents) { - opts.usePolling = process.platform === 'darwin'; - } - - // Global override (useful for end-developers that need to force polling for all - // instances of chokidar, regardless of usage/dependency depth) - var envPoll = process.env.CHOKIDAR_USEPOLLING; - if (envPoll !== undefined) { - var envLower = envPoll.toLowerCase(); - - if (envLower === 'false' || envLower === '0') { - opts.usePolling = false; - } else if (envLower === 'true' || envLower === '1') { - opts.usePolling = true; - } else { - opts.usePolling = !!envLower - } - } - var envInterval = process.env.CHOKIDAR_INTERVAL; - if (envInterval) { - opts.interval = parseInt(envInterval); - } - - // Editor atomic write normalization enabled by default with fs.watch - if (undef('atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; - if (opts.atomic) this._pendingUnlinks = Object.create(null); - - if (undef('followSymlinks')) opts.followSymlinks = true; - - if (undef('awaitWriteFinish')) opts.awaitWriteFinish = false; - if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; - var awf = opts.awaitWriteFinish; - if (awf) { - if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; - if (!awf.pollInterval) awf.pollInterval = 100; - - this._pendingWrites = Object.create(null); - } - if (opts.ignored) opts.ignored = arrify(opts.ignored); - - this._isntIgnored = function(path, stat) { - return !this._isIgnored(path, stat); - }.bind(this); - - var readyCalls = 0; - this._emitReady = function() { - if (++readyCalls >= this._readyCount) { - this._emitReady = Function.prototype; - this._readyEmitted = true; - // use process.nextTick to allow time for listener to be bound - process.nextTick(this.emit.bind(this, 'ready')); - } - }.bind(this); - - this.options = opts; - - // You’re frozen when your heart’s not open. - Object.freeze(opts); -} - -inherits(FSWatcher, EventEmitter); - -// Common helpers -// -------------- - -// Private method: Normalize and emit events -// -// * event - string, type of event -// * path - string, file or directory path -// * val[1..3] - arguments to be passed with event -// -// Returns the error if defined, otherwise the value of the -// FSWatcher instance's \`closed\` flag -FSWatcher.prototype._emit = function(event, path, val1, val2, val3) { - if (this.options.cwd) path = sysPath.relative(this.options.cwd, path); - var args = [event, path]; - if (val3 !== undefined) args.push(val1, val2, val3); - else if (val2 !== undefined) args.push(val1, val2); - else if (val1 !== undefined) args.push(val1); - - var awf = this.options.awaitWriteFinish; - if (awf && this._pendingWrites[path]) { - this._pendingWrites[path].lastChange = new Date(); - return this; - } - - if (this.options.atomic) { - if (event === 'unlink') { - this._pendingUnlinks[path] = args; - setTimeout(function() { - Object.keys(this._pendingUnlinks).forEach(function(path) { - this.emit.apply(this, this._pendingUnlinks[path]); - this.emit.apply(this, ['all'].concat(this._pendingUnlinks[path])); - delete this._pendingUnlinks[path]; - }.bind(this)); - }.bind(this), typeof this.options.atomic === "number" - ? this.options.atomic - : 100); - return this; - } else if (event === 'add' && this._pendingUnlinks[path]) { - event = args[0] = 'change'; - delete this._pendingUnlinks[path]; - } - } - - var emitEvent = function() { - this.emit.apply(this, args); - if (event !== 'error') this.emit.apply(this, ['all'].concat(args)); - }.bind(this); - - if (awf && (event === 'add' || event === 'change') && this._readyEmitted) { - var awfEmit = function(err, stats) { - if (err) { - event = args[0] = 'error'; - args[1] = err; - emitEvent(); - } else if (stats) { - // if stats doesn't exist the file must have been deleted - if (args.length > 2) { - args[2] = stats; - } else { - args.push(stats); - } - emitEvent(); - } - }; - - this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); - return this; - } - - if (event === 'change') { - if (!this._throttle('change', path, 50)) return this; - } - - if ( - this.options.alwaysStat && val1 === undefined && - (event === 'add' || event === 'addDir' || event === 'change') - ) { - var fullPath = this.options.cwd ? sysPath.join(this.options.cwd, path) : path; - fs.stat(fullPath, function(error, stats) { - // Suppress event when fs.stat fails, to avoid sending undefined 'stat' - if (error || !stats) return; - - args.push(stats); - emitEvent(); - }); - } else { - emitEvent(); - } - - return this; -}; - -// Private method: Common handler for errors -// -// * error - object, Error instance -// -// Returns the error if defined, otherwise the value of the -// FSWatcher instance's \`closed\` flag -FSWatcher.prototype._handleError = function(error) { - var code = error && error.code; - var ipe = this.options.ignorePermissionErrors; - if (error && - code !== 'ENOENT' && - code !== 'ENOTDIR' && - (!ipe || (code !== 'EPERM' && code !== 'EACCES')) - ) this.emit('error', error); - return error || this.closed; -}; - -// Private method: Helper utility for throttling -// -// * action - string, type of action being throttled -// * path - string, path being acted upon -// * timeout - int, duration of time to suppress duplicate actions -// -// Returns throttle tracking object or false if action should be suppressed -FSWatcher.prototype._throttle = function(action, path, timeout) { - if (!(action in this._throttled)) { - this._throttled[action] = Object.create(null); - } - var throttled = this._throttled[action]; - if (path in throttled) { - throttled[path].count++; - return false; - } - function clear() { - var count = throttled[path] ? throttled[path].count : 0; - delete throttled[path]; - clearTimeout(timeoutObject); - return count; - } - var timeoutObject = setTimeout(clear, timeout); - throttled[path] = {timeoutObject: timeoutObject, clear: clear, count: 0}; - return throttled[path]; -}; - -// Private method: Awaits write operation to finish -// -// * path - string, path being acted upon -// * threshold - int, time in milliseconds a file size must be fixed before -// acknowledging write operation is finished -// * awfEmit - function, to be called when ready for event to be emitted -// Polls a newly created file for size variations. When files size does not -// change for 'threshold' milliseconds calls callback. -FSWatcher.prototype._awaitWriteFinish = function(path, threshold, event, awfEmit) { - var timeoutHandler; - - var fullPath = path; - if (this.options.cwd && !isAbsolute(path)) { - fullPath = sysPath.join(this.options.cwd, path); - } - - var now = new Date(); - - var awaitWriteFinish = (function (prevStat) { - fs.stat(fullPath, function(err, curStat) { - if (err || !(path in this._pendingWrites)) { - if (err && err.code !== 'ENOENT') awfEmit(err); - return; - } - - var now = new Date(); - - if (prevStat && curStat.size != prevStat.size) { - this._pendingWrites[path].lastChange = now; - } - - if (now - this._pendingWrites[path].lastChange >= threshold) { - delete this._pendingWrites[path]; - awfEmit(null, curStat); - } else { - timeoutHandler = setTimeout( - awaitWriteFinish.bind(this, curStat), - this.options.awaitWriteFinish.pollInterval - ); - } - }.bind(this)); - }.bind(this)); - - if (!(path in this._pendingWrites)) { - this._pendingWrites[path] = { - lastChange: now, - cancelWait: function() { - delete this._pendingWrites[path]; - clearTimeout(timeoutHandler); - return event; - }.bind(this) - }; - timeoutHandler = setTimeout( - awaitWriteFinish.bind(this), - this.options.awaitWriteFinish.pollInterval - ); - } -}; - -// Private method: Determines whether user has asked to ignore this path -// -// * path - string, path to file or directory -// * stats - object, result of fs.stat -// -// Returns boolean -var dotRe = /\\..*\\.(sw[px])$|\\~$|\\.subl.*\\.tmp/; -FSWatcher.prototype._isIgnored = function(path, stats) { - if (this.options.atomic && dotRe.test(path)) return true; - - if (!this._userIgnored) { - var cwd = this.options.cwd; - var ignored = this.options.ignored; - if (cwd && ignored) { - ignored = ignored.map(function (path) { - if (typeof path !== 'string') return path; - return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path)); - }); - } - var paths = arrify(ignored) - .filter(function(path) { - return typeof path === 'string' && !isGlob(path); - }).map(function(path) { - return path + '/**'; - }); - this._userIgnored = anymatch( - this._globIgnored.concat(ignored).concat(paths) - ); - } - - return this._userIgnored([path, stats]); -}; - -// Private method: Provides a set of common helpers and properties relating to -// symlink and glob handling -// -// * path - string, file, directory, or glob pattern being watched -// * depth - int, at any depth > 0, this isn't a glob -// -// Returns object containing helpers for this path -var replacerRe = /^\\.[\\/\\\\]/; -FSWatcher.prototype._getWatchHelpers = function(path, depth) { - path = path.replace(replacerRe, ''); - var watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); - var fullWatchPath = sysPath.resolve(watchPath); - var hasGlob = watchPath !== path; - var globFilter = hasGlob ? anymatch(path) : false; - var follow = this.options.followSymlinks; - var globSymlink = hasGlob && follow ? null : false; - - var checkGlobSymlink = function(entry) { - // only need to resolve once - // first entry should always have entry.parentDir === '' - if (globSymlink == null) { - globSymlink = entry.fullParentDir === fullWatchPath ? false : { - realPath: entry.fullParentDir, - linkPath: fullWatchPath - }; - } - - if (globSymlink) { - return entry.fullPath.replace(globSymlink.realPath, globSymlink.linkPath); - } - - return entry.fullPath; - }; - - var entryPath = function(entry) { - return sysPath.join(watchPath, - sysPath.relative(watchPath, checkGlobSymlink(entry)) - ); - }; - - var filterPath = function(entry) { - if (entry.stat && entry.stat.isSymbolicLink()) return filterDir(entry); - var resolvedPath = entryPath(entry); - return (!hasGlob || globFilter(resolvedPath)) && - this._isntIgnored(resolvedPath, entry.stat) && - (this.options.ignorePermissionErrors || - this._hasReadPermissions(entry.stat)); - }.bind(this); - - var getDirParts = function(path) { - if (!hasGlob) return false; - var parts = []; - var expandedPath = braces.expand(path); - expandedPath.forEach(function(path) { - parts.push(sysPath.relative(watchPath, path).split(/[\\/\\\\]/)); - }); - return parts; - }; - - var dirParts = getDirParts(path); - if (dirParts) { - dirParts.forEach(function(parts) { - if (parts.length > 1) parts.pop(); - }); - } - var unmatchedGlob; - - var filterDir = function(entry) { - if (hasGlob) { - var entryParts = getDirParts(checkGlobSymlink(entry)); - var globstar = false; - unmatchedGlob = !dirParts.some(function(parts) { - return parts.every(function(part, i) { - if (part === '**') globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i]); - }); - }); - } - return !unmatchedGlob && this._isntIgnored(entryPath(entry), entry.stat); - }.bind(this); - - return { - followSymlinks: follow, - statMethod: follow ? 'stat' : 'lstat', - path: path, - watchPath: watchPath, - entryPath: entryPath, - hasGlob: hasGlob, - globFilter: globFilter, - filterPath: filterPath, - filterDir: filterDir - }; -}; - -// Directory helpers -// ----------------- - -// Private method: Provides directory tracking objects -// -// * directory - string, path of the directory -// -// Returns the directory's tracking object -FSWatcher.prototype._getWatchedDir = function(directory) { - var dir = sysPath.resolve(directory); - var watcherRemove = this._remove.bind(this); - if (!(dir in this._watched)) this._watched[dir] = { - _items: Object.create(null), - add: function(item) { - if (item !== '.' && item !== '..') this._items[item] = true; - }, - remove: function(item) { - delete this._items[item]; - if (!this.children().length) { - fs.readdir(dir, function(err) { - if (err) watcherRemove(sysPath.dirname(dir), sysPath.basename(dir)); - }); - } - }, - has: function(item) {return item in this._items;}, - children: function() {return Object.keys(this._items);} - }; - return this._watched[dir]; -}; - -// File helpers -// ------------ - -// Private method: Check for read permissions -// Based on this answer on SO: http://stackoverflow.com/a/11781404/1358405 -// -// * stats - object, result of fs.stat -// -// Returns boolean -FSWatcher.prototype._hasReadPermissions = function(stats) { - return Boolean(4 & parseInt(((stats && stats.mode) & 0x1ff).toString(8)[0], 10)); -}; - -// Private method: Handles emitting unlink events for -// files and directories, and via recursion, for -// files and directories within directories that are unlinked -// -// * directory - string, directory within which the following item is located -// * item - string, base path of item/directory -// -// Returns nothing -FSWatcher.prototype._remove = function(directory, item) { - // if what is being deleted is a directory, get that directory's paths - // for recursive deleting and cleaning of watched object - // if it is not a directory, nestedDirectoryChildren will be empty array - var path = sysPath.join(directory, item); - var fullPath = sysPath.resolve(path); - var isDirectory = this._watched[path] || this._watched[fullPath]; - - // prevent duplicate handling in case of arriving here nearly simultaneously - // via multiple paths (such as _handleFile and _handleDir) - if (!this._throttle('remove', path, 100)) return; - - // if the only watched file is removed, watch for its return - var watchedDirs = Object.keys(this._watched); - if (!isDirectory && !this.options.useFsEvents && watchedDirs.length === 1) { - this.add(directory, item, true); - } - - // This will create a new entry in the watched object in either case - // so we got to do the directory check beforehand - var nestedDirectoryChildren = this._getWatchedDir(path).children(); - - // Recursively remove children directories / files. - nestedDirectoryChildren.forEach(function(nestedItem) { - this._remove(path, nestedItem); - }, this); - - // Check if item was on the watched list and remove it - var parent = this._getWatchedDir(directory); - var wasTracked = parent.has(item); - parent.remove(item); - - // If we wait for this file to be fully written, cancel the wait. - var relPath = path; - if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); - if (this.options.awaitWriteFinish && this._pendingWrites[relPath]) { - var event = this._pendingWrites[relPath].cancelWait(); - if (event === 'add') return; - } - - // The Entry will either be a directory that just got removed - // or a bogus entry to a file, in either case we have to remove it - delete this._watched[path]; - delete this._watched[fullPath]; - var eventName = isDirectory ? 'unlinkDir' : 'unlink'; - if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); - - // Avoid conflicts if we later create another file with the same name - if (!this.options.useFsEvents) { - this._closePath(path); - } -}; - -FSWatcher.prototype._closePath = function(path) { - if (!this._closers[path]) return; - this._closers[path].forEach(function(closer) { - closer(); - }); - delete this._closers[path]; - this._getWatchedDir(sysPath.dirname(path)).remove(sysPath.basename(path)); -} - -// Public method: Adds paths to be watched on an existing FSWatcher instance - -// * paths - string or array of strings, file/directory paths and/or globs -// * _origAdd - private boolean, for handling non-existent paths to be watched -// * _internal - private boolean, indicates a non-user add - -// Returns an instance of FSWatcher for chaining. -FSWatcher.prototype.add = function(paths, _origAdd, _internal) { - var disableGlobbing = this.options.disableGlobbing; - var cwd = this.options.cwd; - this.closed = false; - paths = flatten(arrify(paths)); - - if (!paths.every(isString)) { - throw new TypeError('Non-string provided as watch path: ' + paths); - } - - if (cwd) paths = paths.map(function(path) { - var absPath; - if (isAbsolute(path)) { - absPath = path; - } else if (path[0] === '!') { - absPath = '!' + sysPath.join(cwd, path.substring(1)); - } else { - absPath = sysPath.join(cwd, path); - } - - // Check \`path\` instead of \`absPath\` because the cwd portion can't be a glob - if (disableGlobbing || !isGlob(path)) { - return absPath; - } else { - return normalizePath(absPath); - } - }); - - // set aside negated glob strings - paths = paths.filter(function(path) { - if (path[0] === '!') { - this._ignoredPaths[path.substring(1)] = true; - } else { - // if a path is being added that was previously ignored, stop ignoring it - delete this._ignoredPaths[path]; - delete this._ignoredPaths[path + '/**']; - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = null; - - return true; - } - }, this); - - if (false) { - if (!this._readyCount) this._readyCount = paths.length; - if (this.options.persistent) this._readyCount *= 2; - paths.forEach(this._addToFsEvents, this); - } else { - if (!this._readyCount) this._readyCount = 0; - this._readyCount += paths.length; - asyncEach(paths, function(path, next) { - this._addToNodeFs(path, !_internal, 0, 0, _origAdd, function(err, res) { - if (res) this._emitReady(); - next(err, res); - }.bind(this)); - }.bind(this), function(error, results) { - results.forEach(function(item) { - if (!item || this.closed) return; - this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); - }, this); - }.bind(this)); - } - - return this; -}; - -// Public method: Close watchers or start ignoring events from specified paths. - -// * paths - string or array of strings, file/directory paths and/or globs - -// Returns instance of FSWatcher for chaining. -FSWatcher.prototype.unwatch = function(paths) { - if (this.closed) return this; - paths = flatten(arrify(paths)); - - paths.forEach(function(path) { - // convert to absolute path unless relative path already matches - if (!isAbsolute(path) && !this._closers[path]) { - if (this.options.cwd) path = sysPath.join(this.options.cwd, path); - path = sysPath.resolve(path); - } - - this._closePath(path); - - this._ignoredPaths[path] = true; - if (path in this._watched) { - this._ignoredPaths[path + '/**'] = true; - } - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = null; - }, this); - - return this; -}; - -// Public method: Close watchers and remove all listeners from watched paths. - -// Returns instance of FSWatcher for chaining. -FSWatcher.prototype.close = function() { - if (this.closed) return this; - - this.closed = true; - Object.keys(this._closers).forEach(function(watchPath) { - this._closers[watchPath].forEach(function(closer) { - closer(); - }); - delete this._closers[watchPath]; - }, this); - this._watched = Object.create(null); - - this.removeAllListeners(); - return this; -}; - -// Public method: Expose list of watched paths - -// Returns object w/ dir paths as keys and arrays of contained paths as values. -FSWatcher.prototype.getWatched = function() { - var watchList = {}; - Object.keys(this._watched).forEach(function(dir) { - var key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; - watchList[key || '.'] = Object.keys(this._watched[dir]._items).sort(); - }.bind(this)); - return watchList; -}; - -// Attach watch handler prototype methods -function importHandler(handler) { - Object.keys(handler.prototype).forEach(function(method) { - FSWatcher.prototype[method] = handler.prototype[method]; - }); -} -importHandler(NodeFsHandler); -if (false) importHandler(FsEventsHandler); - -// Export FSWatcher class -exports.FSWatcher = FSWatcher; - -// Public function: Instantiates watcher with paths to be tracked. - -// * paths - string or array of strings, file/directory paths and/or globs -// * options - object, chokidar options - -// Returns an instance of FSWatcher for chaining. -exports.watch = function(paths, options) { - return new FSWatcher(options).add(paths); -}; - -` -); diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index c6de037ca..486c55db6 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -57,35 +57,21 @@ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", + "wait until bundle finished: /bundle.js", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", + "Entrypoint main = bundle.js", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "Compiled successfully.", ], ], ] @@ -97,39 +83,14 @@ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /static-one/bundle.js", - ], - ], - Array [ - "webpack-dev-middleware", - "error", - Array [ - "ERROR in ./broken.js 1:3 -Module parse failed: Unexpected token (1:3) -You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders -> 1()2()3() -|", - ], - ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "Failed to compile.", - ], - ], - Array [ - "webpack-dev-middleware", - "warn", - Array [ - "WARNING in Warning", + "wait until bundle finished: /bundle.js", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled with warnings.", + "X modules", ], ], Array [ @@ -196,13 +157,6 @@ Array [ "wait until bundle finished: /bundle.js", ], ], - Array [ - "webpack-dev-middleware", - "info", - Array [ - "X modules", - ], - ], Array [ "webpack-dev-middleware", "info", @@ -234,7 +188,7 @@ Array [ exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; -exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; +exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"Cannot read property 'message' of null"`; exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` Array [ From 28eaa15ee7d76dc24ea8f60f1f70294a358ac5dd Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 8 Apr 2020 21:19:26 +0300 Subject: [PATCH 82/87] ci: improve --- test/__snapshots__/middleware.test.js.snap | 58 +++++++++++++++++-- test/fixtures/webpack.array.config.js | 2 - test/fixtures/webpack.array.error.config.js | 2 - test/fixtures/webpack.array.warning.config.js | 2 - 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/test/__snapshots__/middleware.test.js.snap b/test/__snapshots__/middleware.test.js.snap index 486c55db6..c6de037ca 100644 --- a/test/__snapshots__/middleware.test.js.snap +++ b/test/__snapshots__/middleware.test.js.snap @@ -57,21 +57,35 @@ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /bundle.js", + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Entrypoint main = bundle.js", + "Compiled with warnings.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "Compiled successfully.", + "Compiled with warnings.", ], ], ] @@ -83,14 +97,39 @@ Array [ "webpack-dev-middleware", "info", Array [ - "wait until bundle finished: /bundle.js", + "wait until bundle finished: /static-one/bundle.js", + ], + ], + Array [ + "webpack-dev-middleware", + "error", + Array [ + "ERROR in ./broken.js 1:3 +Module parse failed: Unexpected token (1:3) +You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders +> 1()2()3() +|", ], ], Array [ "webpack-dev-middleware", "info", Array [ - "X modules", + "Failed to compile.", + ], + ], + Array [ + "webpack-dev-middleware", + "warn", + Array [ + "WARNING in Warning", + ], + ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "Compiled with warnings.", ], ], Array [ @@ -157,6 +196,13 @@ Array [ "wait until bundle finished: /bundle.js", ], ], + Array [ + "webpack-dev-middleware", + "info", + Array [ + "X modules", + ], + ], Array [ "webpack-dev-middleware", "info", @@ -188,7 +234,7 @@ Array [ exports[`middleware basic should throw an error on "run" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; -exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"Cannot read property 'message' of null"`; +exports[`middleware basic should throw an error on "watch" when we watching should logging an error 1`] = `"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."`; exports[`middleware logger should logging an error from the "fs.mkdir" method when the "writeToDisk" option is "true" should logging 1`] = ` Array [ diff --git a/test/fixtures/webpack.array.config.js b/test/fixtures/webpack.array.config.js index 1f715a354..2c1a164ff 100644 --- a/test/fixtures/webpack.array.config.js +++ b/test/fixtures/webpack.array.config.js @@ -5,7 +5,6 @@ const path = require('path'); module.exports = [ { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './foo.js', output: { @@ -29,7 +28,6 @@ module.exports = [ }, { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './bar.js', output: { diff --git a/test/fixtures/webpack.array.error.config.js b/test/fixtures/webpack.array.error.config.js index 0d04c46f4..853919667 100644 --- a/test/fixtures/webpack.array.error.config.js +++ b/test/fixtures/webpack.array.error.config.js @@ -5,7 +5,6 @@ const path = require('path'); module.exports = [ { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './broken.js', output: { @@ -17,7 +16,6 @@ module.exports = [ }, { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './broken.js', output: { diff --git a/test/fixtures/webpack.array.warning.config.js b/test/fixtures/webpack.array.warning.config.js index 75c739193..be0a5557f 100644 --- a/test/fixtures/webpack.array.warning.config.js +++ b/test/fixtures/webpack.array.warning.config.js @@ -5,7 +5,6 @@ const path = require('path'); module.exports = [ { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './warning.js', output: { @@ -28,7 +27,6 @@ module.exports = [ }, { mode: 'development', - devtool: false, context: path.resolve(__dirname), entry: './warning.js', output: { From f9f671cfb7539deeb19092799f5a9198745ebe6a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 8 Apr 2020 21:25:11 +0300 Subject: [PATCH 83/87] ci: improve --- .github/workflows/nodejs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 352660f6b..3c1e5d7f1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -57,6 +57,11 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] node-version: [10.x, 12.x, 13.x] webpack-version: [latest, next] + exclude: + # See https://github.com/fsevents/fsevents/issues/314 + - os: macos-latest + node: 4 + webpack-version: latest runs-on: ${{ matrix.os }} From a221ad97b9a354ac54165dd3e04081fde41d5777 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 8 Apr 2020 21:26:08 +0300 Subject: [PATCH 84/87] ci: improve --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 2293ba447..f30b4d6cc 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,10 @@ "homepage": "https://github.com/webpack/webpack-dev-middleware", "bugs": "https://github.com/webpack/webpack-dev-middleware/issues", "main": "dist/index.js", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, "engines": { "node": ">= 10.13" }, From bf99c0e8103b601a73c3217cd20100492fc684d1 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 9 Apr 2020 14:36:24 +0300 Subject: [PATCH 85/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 3c1e5d7f1..88b3d2ab8 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -60,7 +60,7 @@ jobs: exclude: # See https://github.com/fsevents/fsevents/issues/314 - os: macos-latest - node: 4 + node-version: 4 webpack-version: latest runs-on: ${{ matrix.os }} From 174ba703cde6e9fba6e8623c25ad1bf8e24d592f Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 9 Apr 2020 15:17:05 +0300 Subject: [PATCH 86/87] ci: improve --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 88b3d2ab8..8e4c047c6 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -60,7 +60,7 @@ jobs: exclude: # See https://github.com/fsevents/fsevents/issues/314 - os: macos-latest - node-version: 4 + node-version: [12.x, 13.x] webpack-version: latest runs-on: ${{ matrix.os }} From 5aebf98a49cf8aac781557585e703b05bbfae7ae Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 9 Apr 2020 15:35:33 +0300 Subject: [PATCH 87/87] ci: improve --- .github/workflows/nodejs.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8e4c047c6..45bb37e45 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -60,7 +60,10 @@ jobs: exclude: # See https://github.com/fsevents/fsevents/issues/314 - os: macos-latest - node-version: [12.x, 13.x] + node-version: 12.x + webpack-version: latest + - os: macos-latest + node-version: 13.x webpack-version: latest runs-on: ${{ matrix.os }}