From cbb48a027d1831a0e3aafbd8a503adef0417777c Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Fri, 3 Apr 2020 22:34:21 +0900 Subject: [PATCH] test(middleware): use setImmediate for MacOS CI --- jest.config.js | 1 - package-lock.json | 98 ++++++++++++++++++++--------------------- package.json | 4 +- test/middleware.test.js | 15 ++++--- 4 files changed, 61 insertions(+), 57 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 f1c929cb7..670075df1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2404,21 +2404,21 @@ } }, "@jest/transform": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.2.1.tgz", - "integrity": "sha512-puoD5EfqPeZ5m0dV9l8+PMdOVdRjeWcaEjGkH+eG45l0nPJ2vRcxu8J6CRl/6nQ5ZTHgg7LuM9C6FauNpdRpUA==", + "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.1", + "@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.1", - "jest-regex-util": "^25.2.1", - "jest-util": "^25.2.1", + "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", @@ -2535,9 +2535,9 @@ } }, "@jest/types": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.2.1.tgz", - "integrity": "sha512-WuGFGJ3Rrycg+5ZwQTWKjr21M9psANPAWYD28K42hSeUzhv1H591VXIoq0tjs00mydhNOgVOkKSpzRS3CrOYFw==", + "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", @@ -3417,16 +3417,16 @@ } }, "babel-jest": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.2.1.tgz", - "integrity": "sha512-OiBpQGYtV4rWMuFneIaEsqJB0VdoOBw4SqwO4hA2EhDY/O8RylQ20JwALkxv8iv+CYnyrZZfF+DELPgrdrkRIw==", + "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.1", - "@jest/types": "^25.2.1", + "@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.1", + "babel-preset-jest": "^25.2.6", "chalk": "^3.0.0", "slash": "^3.0.0" }, @@ -3512,9 +3512,9 @@ } }, "babel-plugin-jest-hoist": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.2.1.tgz", - "integrity": "sha512-HysbCQfJhxLlyxDbKcB2ucGYV0LjqK4h6dBoI3RtFuOxTiTWK6XGZMsHb0tGh8iJdV4hC6Z2GCHzVvDeh9i0lQ==", + "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" @@ -3540,14 +3540,14 @@ } }, "babel-preset-jest": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.2.1.tgz", - "integrity": "sha512-zXHJBM5iR8oEO4cvdF83AQqqJf3tJrXy3x8nfu2Nlqvn4cneg4Ca8M7cQvC5S9BzDDy1O0tZ9iXru9J6E3ym+A==", + "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.1" + "babel-plugin-jest-hoist": "^25.2.6" } }, "babel-runtime": { @@ -5692,9 +5692,9 @@ } }, "eslint-module-utils": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz", - "integrity": "sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", "dev": true, "requires": { "debug": "^2.6.9", @@ -5702,9 +5702,9 @@ } }, "eslint-plugin-import": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz", - "integrity": "sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==", + "version": "2.20.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.2.tgz", + "integrity": "sha512-FObidqpXrR8OnCh4iNsxy+WACztJLXAHBO5hK79T1Hc77PgQZkyDGA5Ag9xAvRpglvLNxhH/zSmZ70/pZ31dHg==", "dev": true, "requires": { "array-includes": "^3.0.3", @@ -9617,19 +9617,19 @@ "dev": true }, "jest-haste-map": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.2.1.tgz", - "integrity": "sha512-svz3KbQmv9qeomR0LlRjQfoi7lQbZQkC39m7uHFKhqyEuX4F6DH6HayNPSEbTCZDx6d9/ljxfAcxlPpgQvrpvQ==", + "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.1", + "@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.1", - "jest-util": "^25.2.1", - "jest-worker": "^25.2.1", + "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", @@ -10193,9 +10193,9 @@ "dev": true }, "jest-regex-util": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.1.tgz", - "integrity": "sha512-wroFVJw62LdqTdkL508ZLV82FrJJWVJMIuYG7q4Uunl1WAPTf4ftPKrqqfec4SvOIlvRZUdEX2TFpWR356YG/w==", + "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-resolve": { @@ -10858,9 +10858,9 @@ } }, "jest-serializer": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.1.tgz", - "integrity": "sha512-fibDi7M5ffx6c/P66IkvR4FKkjG5ldePAK1WlbNoaU4GZmIAkS9Le/frAwRUFEX0KdnisSPWf+b1RC5jU7EYJQ==", + "version": "25.2.6", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.2.6.tgz", + "integrity": "sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ==", "dev": true }, "jest-snapshot": { @@ -10965,12 +10965,12 @@ } }, "jest-util": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.2.1.tgz", - "integrity": "sha512-oFVMSY/7flrSgEE/B+RApaBZOdLURXRnXCf4COV5td9uRidxudyjA64I1xk2h9Pf3jloSArm96e2FKAbFs0DYg==", + "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.1", + "@jest/types": "^25.2.6", "chalk": "^3.0.0", "is-ci": "^2.0.0", "make-dir": "^3.0.0" @@ -11233,9 +11233,9 @@ } }, "jest-worker": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.2.1.tgz", - "integrity": "sha512-IHnpekk8H/hCUbBlfeaPZzU6v75bqwJp3n4dUrQuQOAgOneI4tx3jV2o8pvlXnDfcRsfkFIUD//HWXpCmR+evQ==", + "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", diff --git a/package.json b/package.json index 351982094..5d51d1df4 100644 --- a/package.json +++ b/package.json @@ -48,14 +48,14 @@ "@commitlint/config-conventional": "^8.3.4", "@webpack-contrib/defaults": "^6.3.0", "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^25.2.1", + "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", "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.1", - "eslint-plugin-import": "^2.20.1", + "eslint-plugin-import": "^2.20.2", "eslint-plugin-prettier": "^3.1.2", "express": "^4.17.1", "file-loader": "^6.0.0", diff --git a/test/middleware.test.js b/test/middleware.test.js index 1ef821287..53530c595 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -775,11 +775,16 @@ describe('middleware', () => { 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); + setTimeout(() => { + request(app) + .get(`${publicPathForRequest}${value}`) + .expect('Content-Type', contentType) + .expect( + 'Content-Length', + data ? String(data.length) : /\d+/ + ) + .expect(code, done); + }); }); } }