From b4bb3f6e3678e876f33c3a87dacbf4c5ae897c0e Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Sun, 1 Aug 2021 21:00:07 +0200 Subject: [PATCH] Add failing test cases for #23 and #24 and fix jasmine warnings caused by mixing `async` and `done` usage --- .github/workflows/nodejs.yml | 64 +++--- package.json | 4 +- src/jasmine.js | 46 +++-- src/jest-environment-polly.js | 64 +++--- .../recording.har | 64 +++--- .../recording.har | 61 +++--- .../recording.har | 182 ++++++++++++++++++ .../recording.har | 182 ++++++++++++++++++ .../recording.har | 182 ++++++++++++++++++ .../recording.har | 61 +++--- .../should-work_3457346403/recording.har | 61 +++--- .../recording.har | 60 +++--- .../recording.har | 61 +++--- .../recording.har | 61 +++--- .../recording.har | 61 +++--- .../recording.har | 61 +++--- .../recording.har | 61 +++--- .../should-record_255246347/recording.har | 53 +++-- test/integration/jest/getPost.js | 11 ++ test/integration/jest/index.test.js | 10 +- test/integration/jest/polly-register.test.js | 31 +++ test/integration/jest/test-only.test.js | 13 +- test/integration/jest/test-skip.test.js | 35 ++++ test/unit/__mocks__/global.js | 6 + test/unit/setup-polly-jasmine.test.js | 19 +- 25 files changed, 1124 insertions(+), 390 deletions(-) rename test/integration/{jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815 => jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815}/recording.har (75%) create mode 100644 test/integration/jest/__recordings__/Polly-register_1263522794/setup-polly-jest-works-when-adapters-and-persisters-are-registered-with-Polly-register_638723674/recording.har create mode 100644 test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-after-skip-and-not-fail_765957330/recording.har create mode 100644 test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-before-skip-and-not-fail_2822192507/recording.har rename test/integration/jest/__recordings__/{setup-polly-should-work-with-it-only-_1150278111 => setup-polly-should-work-with-it-only_1150278111}/recording.har (75%) rename test/integration/jest/__recordings__/setupPolly_466486458/{should-have-polly-running-with-it-_2136411752 => should-have-polly-running-with-it_2136411752}/recording.har (75%) rename test/integration/{jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815 => jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815}/recording.har (75%) create mode 100644 test/integration/jest/getPost.js create mode 100644 test/integration/jest/polly-register.test.js create mode 100644 test/integration/jest/test-skip.test.js diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e1e8c62..05a66a2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,13 +1,13 @@ -name: Node CI +name: Node.JS CI on: push: - branches: - - master + branches: + - main pull_request: - branches: - - master + branches: + - main jobs: build: @@ -18,26 +18,38 @@ jobs: strategy: matrix: - # jest >= 26 does not support node8 anymore so it is removed from the - # test matrix - # node-version: [8.x, 10.x, 12.x] - node-version: [10.x, 12.x] + node_version: [8, 10, 12, 14] + test_framework: [jasmine@2, jasmine@3, jest@25, jest@latest] steps: - - uses: actions/checkout@v1 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: | - rm -rf node_modules - # We don't have package-lock file in the repo so will be installing - # with good ol `install` and not `ci` - # npm ci - npm install - - - name: Run test suite - run: npm run test + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v2 + with: + node_version: ${{ matrix.node_version }} + + - name: Install dependencies + run: | + npm install + + - name: Install test framework + run: | + npm install ${{ matrix.test_framework }} + + - name: Run unit tests + run: | + npm run test:unit + + - name: Run jasmine tests + if: | + ${{ matrix.test_framework == 'jasmine@2' || matrix.test_framework == 'jasmine@3' }} + run: | + npm run test:jasmine + + - name: Run jest tests + if: | + ${{ (matrix.test_framework == 'jest@25' || matrix.test_framework == 'jest@latest') && matrix.node_version > 8 }} + run: | + npm run test:jest-jasmine2 + npm run test:jest-circus diff --git a/package.json b/package.json index 573c220..f305b4a 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "test:jest-circus": "jest -c ./test/jest-circus-integration.config.json", "test": "npm run test:unit && npm run test:jest-jasmine2 && npm run test:jest-circus && npm run test:jasmine", "clear": "rm -rf lib", - "prepare": "npm run clear && npm run build && npm run test", - "prepublishOnly": "npm run prepare" + "prepare": "npm run clear && npm run build", + "prepublishOnly": "npm run test" }, "files": [ "LICENSE", diff --git a/src/jasmine.js b/src/jasmine.js index cd5e7c4..ad28e64 100644 --- a/src/jasmine.js +++ b/src/jasmine.js @@ -93,7 +93,14 @@ function createTestFnProxy(PollyConstructor, fn, jasmineEnv, ctx) { */ const { befores, afters } = specHooks.apply(spec, arguments); - const before = async function before(done) { + /** + * NB: Using `done` and `done.fail` so that we support jasmine2 that + * doesn't handle returned promises in before/after and also passing + * `error` to `done` in some versions + * + * @type {JasmineSpec['queueableFn']['fn']} done + */ + const before = function before(done) { try { if (globals.isPollyActive) { const topSuite = jasmineEnv.topSuite(); @@ -113,25 +120,30 @@ function createTestFnProxy(PollyConstructor, fn, jasmineEnv, ctx) { ); } - done && done(); + done(); } catch (error) { // If we caught instance of the polly error, we will save it for the // reference and continue with the tests to print the error at the end // of the spec where it's more visible if (error.name === 'PollyError') { pollyError = error; - done && done(); - } else if (done) { - // Otherwise let's just fail spec/throw error, there is nothing - // special we can do in that case - done.fail(error); + done(); } else { - throw error; + // Otherwise let's just fail spec, there is nothing special we can + // do in that case + done.fail(error); } } }; - const after = async function after(done) { + /** + * NB: Using `done` and `done.fail` so that we support jasmine2 that + * doesn't handle returned promises in before/after and also passing + * `error` to `done` in some versions + * + * @type {JasmineSpec['queueableFn']['fn']} done + */ + const after = function after(done) { try { // We want to throw polly error here so it's shown as the last one in the // list of possible errors that happend during the test run @@ -144,17 +156,15 @@ function createTestFnProxy(PollyConstructor, fn, jasmineEnv, ctx) { } if (globals.pollyContext.polly) { - await globals.pollyContext.polly.stop(); - globals.pollyContext.polly = null; - } - - done && done(); - } catch (error) { - if (done) { - done.fail(error); + globals.pollyContext.polly.stop().then(() => { + globals.pollyContext.polly = null; + done(); + }); } else { - throw error; + done(); } + } catch (error) { + done.fail(error); } }; diff --git a/src/jest-environment-polly.js b/src/jest-environment-polly.js index 95f50bf..51b64d0 100644 --- a/src/jest-environment-polly.js +++ b/src/jest-environment-polly.js @@ -56,36 +56,46 @@ export function PollyEnvironmentFactory( await super.setup(); this.pollyGlobals = new JestPollyGlobals(this.global); this.pollyGlobals.isJestPollyEnvironment = true; - } - /** - * - * @param {CircusEvent} event - * @param {CircusState} state - */ - async handleTestEvent(event, state) { - if (super.handleTestEvent) { - await super.handleTestEvent(event, state); - } + /** + * NB: TS types demand that this is an instance property, not a method on + * a prototype + * + * @param {CircusEvent} event + * @param {CircusState} state + */ + this.handleTestEvent = async (event, state) => { + if (super.handleTestEvent) { + // TS is confused because we are explicitly awaiting (to cover both + // sync and async handlers) but it really wants us to handle only one + // of those + // + // @ts-expect-error + await super.handleTestEvent(event, state); + } - // Start Polly instance at the beginning of the test run (before hooks) if - // Polly is active (setupPolly was called in this describe block) - if (event.name === 'test_start' && this.pollyGlobals.isPollyActive) { - const recordingName = getRecordingName( - event.test, - state.rootDescribeBlock - ); - this.pollyGlobals.pollyContext.polly = new PollyConstructor( - recordingName, - this.pollyGlobals.pollyContext.options - ); - } + // Start Polly instance at the beginning of the test run (before hooks) if + // Polly is active (setupPolly was called in this describe block) + if (event.name === 'test_start' && this.pollyGlobals.isPollyActive) { + const recordingName = getRecordingName( + event.test, + state.rootDescribeBlock + ); + this.pollyGlobals.pollyContext.polly = new PollyConstructor( + recordingName, + this.pollyGlobals.pollyContext.options + ); + } - // Stop Polly instance if there is one running - if (event.name === 'test_done' && this.pollyGlobals.pollyContext.polly) { - await this.pollyGlobals.pollyContext.polly.stop(); - this.pollyGlobals.pollyContext.polly = null; - } + // Stop Polly instance if there is one running + if ( + event.name === 'test_done' && + this.pollyGlobals.pollyContext.polly + ) { + await this.pollyGlobals.pollyContext.polly.stop(); + this.pollyGlobals.pollyContext.polly = null; + } + }; } }; } diff --git a/test/integration/jasmine/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har b/test/integration/jasmine/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har index 13aea48..e306679 100644 --- a/test/integration/jasmine/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har +++ b/test/integration/jasmine/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -53,20 +53,11 @@ "size": 2, "text": "{}" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:15.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d140d7b80dde6e698ca271bfcebfde0891568449395" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:15 GMT" + "value": "Sun, 01 Aug 2021 18:58:01 GMT" }, { "name": "content-type", @@ -80,15 +71,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d140d7b80dde6e698ca271bfcebfde0891568449395; expires=Sun, 13-Sep-20 08:23:15 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "998" + }, + { + "name": "x-ratelimit-reset", + "value": "1627844303" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +97,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +105,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:15 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -123,33 +121,41 @@ }, { "name": "cf-cache-status", - "value": "HIT" - }, - { - "name": "age", - "value": "0" + "value": "MISS" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=4eVbvFQriXBSIIeeoeGTB6fmz%2Bkm8Y2eMjJqpaYu3f%2B3uXhQHiMXGXIi3TEe%2Bl4lrGyNBzm9XV%2F6tlDwcXS7BZwrl%2FCMkG7eN%2B%2BMbzlVX1EmweeBRsm1shn4Csk8W3TFrJztRzqhrNLVF21ext8C\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f533cca2c29f-FRA" + "value": "67814ba67f3a175e-FRA" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 727, + "headersSize": 1054, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 404, "statusText": "Not Found" }, - "startedDateTime": "2019-09-14T08:23:15.735Z", - "time": 92, + "startedDateTime": "2021-08-01T18:56:42.365Z", + "time": 303, "timings": { "blocked": -1, "connect": -1, @@ -157,7 +163,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 92 + "wait": 303 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har b/test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har similarity index 75% rename from test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har rename to test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har index 8d2dd95..c4e632b 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har +++ b/test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 408, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 408, "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d46433851e6ca6e37124c26a3e45f13451568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:58:01 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d46433851e6ca6e37124c26a3e45f13451568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1619224788" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "1256" + "value": "21541" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=XcSzwpw9WJqaWxyveHRmuL2O2EIM3ShKDlBNP%2B0sz78TOh7eXg4rUT5LKGQ09VX5Jv7G%2BdAAUacMZrd%2FGryNUOQIsqR%2FPOa2E6yrcaB%2Fv04aRtm0T4wJgPP0UFvpyGA24hvvty7vgWvtG9YgXPBm\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52adde2c290-FRA" + "value": "67814ba5ec5b4a9d-FRA" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1096, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.307Z", - "time": 86, + "startedDateTime": "2021-08-01T18:56:42.226Z", + "time": 123, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 86 + "wait": 123 } } ], diff --git a/test/integration/jest/__recordings__/Polly-register_1263522794/setup-polly-jest-works-when-adapters-and-persisters-are-registered-with-Polly-register_638723674/recording.har b/test/integration/jest/__recordings__/Polly-register_1263522794/setup-polly-jest-works-when-adapters-and-persisters-are-registered-with-Polly-register_638723674/recording.har new file mode 100644 index 0000000..8626b36 --- /dev/null +++ b/test/integration/jest/__recordings__/Polly-register_1263522794/setup-polly-jest-works-when-adapters-and-persisters-are-registered-with-Polly-register_638723674/recording.har @@ -0,0 +1,182 @@ +{ + "log": { + "_recordingName": "Polly.register/setup-polly-jest works when adapters and persisters are registered with Polly.register", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "5.1.1" + }, + "entries": [ + { + "_id": "662efe612dbf05c41ce55a78acc5872f", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + }, + { + "_fromType": "array", + "name": "user-agent", + "value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" + }, + { + "_fromType": "array", + "name": "accept-encoding", + "value": "gzip,deflate" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "jsonplaceholder.typicode.com" + } + ], + "headersSize": 228, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://jsonplaceholder.typicode.com/posts/1" + }, + "response": { + "bodySize": 408, + "content": { + "_isBinary": true, + "mimeType": "application/json; charset=utf-8", + "size": 408, + "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" + }, + "cookies": [], + "headers": [ + { + "name": "date", + "value": "Sun, 01 Aug 2021 18:57:56 GMT" + }, + { + "name": "content-type", + "value": "application/json; charset=utf-8" + }, + { + "name": "transfer-encoding", + "value": "chunked" + }, + { + "name": "connection", + "value": "close" + }, + { + "name": "x-powered-by", + "value": "Express" + }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1623347254" + }, + { + "name": "vary", + "value": "Origin, Accept-Encoding" + }, + { + "name": "access-control-allow-credentials", + "value": "true" + }, + { + "name": "cache-control", + "value": "max-age=43200" + }, + { + "name": "pragma", + "value": "no-cache" + }, + { + "name": "expires", + "value": "-1" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "etag", + "value": "W/\"124-yiKdLzqO5gfBrJFrcdJ8Yq0LGnU\"" + }, + { + "name": "via", + "value": "1.1 vegur" + }, + { + "name": "cf-cache-status", + "value": "HIT" + }, + { + "name": "age", + "value": "8809" + }, + { + "name": "expect-ct", + "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" + }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=GwgjDlnzJppoaa%2BGhDrNxUbBJsi%2FOM4m5Dld2ryxht52yxciIFz2Gt9ERKv%2BEumo%2FpFmoVaJeKihDnCNfVf%2FSLCCKOnxGO%2FRw%2FrtOYdc1Ze%2BpgZH0i7OYee84P2QjtxLgQFlaeY6kv%2BJPMHLILgs\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "server", + "value": "cloudflare" + }, + { + "name": "cf-ray", + "value": "67814b864a114174-HAM" + }, + { + "name": "content-encoding", + "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" + } + ], + "headersSize": 1103, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-08-01T18:56:37.221Z", + "time": 62, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 62 + } + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-after-skip-and-not-fail_765957330/recording.har b/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-after-skip-and-not-fail_765957330/recording.har new file mode 100644 index 0000000..d555ec9 --- /dev/null +++ b/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-after-skip-and-not-fail_765957330/recording.har @@ -0,0 +1,182 @@ +{ + "log": { + "_recordingName": "it.skip/should run test after .skip and not fail", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "5.1.1" + }, + "entries": [ + { + "_id": "4da0ad841cbd2b68368a694196131a3f", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + }, + { + "_fromType": "array", + "name": "user-agent", + "value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" + }, + { + "_fromType": "array", + "name": "accept-encoding", + "value": "gzip,deflate" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "jsonplaceholder.typicode.com" + } + ], + "headersSize": 228, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://jsonplaceholder.typicode.com/posts/3" + }, + "response": { + "bodySize": 402, + "content": { + "_isBinary": true, + "mimeType": "application/json; charset=utf-8", + "size": 402, + "text": "[\"1f8b0800000000000003558e316ac4401004f37b45a3d88971763ff01f2e19ed366660b523edcc081be3bf1f2becc0593534457ddf80259de3bd2e77bcbecca913df2e0c8dc6e58e8582cd1a3d541c478a2bf8c9513424d43a370cee6c4d02472a7477816b403296cbb45afdba44014d0f83b3e24883e6e0a39fd6720f096eb052844542615b57079b7eb0579d2e48fdf7add66ce89a8e930d524abaf4d0dc66856397a112391efd2f9ed86d0c03351d56d5c04093d506279d6cbfd1b79f277355343e1b010000\"]" + }, + "cookies": [], + "headers": [ + { + "name": "date", + "value": "Sun, 01 Aug 2021 18:57:54 GMT" + }, + { + "name": "content-type", + "value": "application/json; charset=utf-8" + }, + { + "name": "transfer-encoding", + "value": "chunked" + }, + { + "name": "connection", + "value": "close" + }, + { + "name": "x-powered-by", + "value": "Express" + }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627825763" + }, + { + "name": "vary", + "value": "Origin, Accept-Encoding" + }, + { + "name": "access-control-allow-credentials", + "value": "true" + }, + { + "name": "cache-control", + "value": "max-age=43200" + }, + { + "name": "pragma", + "value": "no-cache" + }, + { + "name": "expires", + "value": "-1" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "etag", + "value": "W/\"11b-USacuIw5a/iXAGdNKBvqr/TbMTc\"" + }, + { + "name": "via", + "value": "1.1 vegur" + }, + { + "name": "cf-cache-status", + "value": "HIT" + }, + { + "name": "age", + "value": "18540" + }, + { + "name": "expect-ct", + "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" + }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=yrjIOk9aVQUjNgvZJmKWMPvVtIYnWvBUjYkknO4%2FnGTDFKGWty6GxJ8QZ0tgGCtv6A3wnBXhng08n%2F7t946jQw6osX6uFfBKrWvmf8kTJow1mwO4iJ8QK6e1JfgxO6DKGOHGPXkHsj2y43SE1NRC\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "server", + "value": "cloudflare" + }, + { + "name": "cf-ray", + "value": "67814b7d0e634169-HAM" + }, + { + "name": "content-encoding", + "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" + } + ], + "headersSize": 1090, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-08-01T18:56:35.741Z", + "time": 67, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 67 + } + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-before-skip-and-not-fail_2822192507/recording.har b/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-before-skip-and-not-fail_2822192507/recording.har new file mode 100644 index 0000000..2478831 --- /dev/null +++ b/test/integration/jest/__recordings__/it-skip_2537289665/should-run-test-before-skip-and-not-fail_2822192507/recording.har @@ -0,0 +1,182 @@ +{ + "log": { + "_recordingName": "it.skip/should run test before .skip and not fail", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "5.1.1" + }, + "entries": [ + { + "_id": "662efe612dbf05c41ce55a78acc5872f", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + }, + { + "_fromType": "array", + "name": "user-agent", + "value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" + }, + { + "_fromType": "array", + "name": "accept-encoding", + "value": "gzip,deflate" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "jsonplaceholder.typicode.com" + } + ], + "headersSize": 228, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://jsonplaceholder.typicode.com/posts/1" + }, + "response": { + "bodySize": 408, + "content": { + "_isBinary": true, + "mimeType": "application/json; charset=utf-8", + "size": 408, + "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" + }, + "cookies": [], + "headers": [ + { + "name": "date", + "value": "Sun, 01 Aug 2021 18:57:54 GMT" + }, + { + "name": "content-type", + "value": "application/json; charset=utf-8" + }, + { + "name": "transfer-encoding", + "value": "chunked" + }, + { + "name": "connection", + "value": "close" + }, + { + "name": "x-powered-by", + "value": "Express" + }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1623347254" + }, + { + "name": "vary", + "value": "Origin, Accept-Encoding" + }, + { + "name": "access-control-allow-credentials", + "value": "true" + }, + { + "name": "cache-control", + "value": "max-age=43200" + }, + { + "name": "pragma", + "value": "no-cache" + }, + { + "name": "expires", + "value": "-1" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "etag", + "value": "W/\"124-yiKdLzqO5gfBrJFrcdJ8Yq0LGnU\"" + }, + { + "name": "via", + "value": "1.1 vegur" + }, + { + "name": "cf-cache-status", + "value": "HIT" + }, + { + "name": "age", + "value": "8807" + }, + { + "name": "expect-ct", + "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" + }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=rjE7LC3P29qHXwyNR%2FO5IRlt9A7pxUzBOnPJ8cQXuYXior3Svtra3VtSPaFF%2Be7ztE38np6%2Bg3ZNdRVK0rvwRNVPZvyInnBHs9UiU21N75dYCsstLsc3oND8CYtcIVb9ybH08Uj0qWJgFCdwwNof\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "server", + "value": "cloudflare" + }, + { + "name": "cf-ray", + "value": "67814b7c8aa1d47b-HAM" + }, + { + "name": "content-encoding", + "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" + } + ], + "headersSize": 1091, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-08-01T18:56:35.613Z", + "time": 110, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 110 + } + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/test/integration/jest/__recordings__/setup-polly-should-work-with-it-only-_1150278111/recording.har b/test/integration/jest/__recordings__/setup-polly-should-work-with-it-only_1150278111/recording.har similarity index 75% rename from test/integration/jest/__recordings__/setup-polly-should-work-with-it-only-_1150278111/recording.har rename to test/integration/jest/__recordings__/setup-polly-should-work-with-it-only_1150278111/recording.har index 1eb6244..62b6c4f 100644 --- a/test/integration/jest/__recordings__/setup-polly-should-work-with-it-only-_1150278111/recording.har +++ b/test/integration/jest/__recordings__/setup-polly-should-work-with-it-only_1150278111/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 402, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 402, "text": "[\"1f8b0800000000000003558e316ac4401004f37b45a3d88971763ff01f2e19ed366660b523edcc081be3bf1f2becc0593534457ddf80259de3bd2e77bcbecca913df2e0c8dc6e58e8582cd1a3d541c478a2bf8c9513424d43a370cee6c4d02472a7477816b403296cbb45afdba44014d0f83b3e24883e6e0a39fd6720f096eb052844542615b57079b7eb0579d2e48fdf7add66ce89a8e930d524abaf4d0dc66856397a112391efd2f9ed86d0c03351d56d5c04093d506279d6cbfd1b79f277355343e1b010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d6aee7fac2f82d5949cdd754fad22ffe81568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:56 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d6aee7fac2f82d5949cdd754fad22ffe81568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627825763" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "5304" + "value": "18542" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=vjQwUQDwum7L0RNmK9jf4tpv7bBh%2BSvQ1CLSyXysVASZ1RIn5L9rTT6HXEjtr2tuLdYeQ0YdlHzwF6gBRwFnnxHb55J17zpNUJCo09Q97JAg691yQNivICRdufOH%2F9RZMyQBvqv0W7nJAzi8JZVd\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52ade2dd721-FRA" + "value": "67814b87fe774174-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1090, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.293Z", - "time": 105, + "startedDateTime": "2021-08-01T18:56:37.483Z", + "time": 75, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 105 + "wait": 75 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/deeply_4270450240/nested_2331834954/test-cases_1632709520/should-work_3457346403/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/deeply_4270450240/nested_2331834954/test-cases_1632709520/should-work_3457346403/recording.har index 6e4de5e..eb04156 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/deeply_4270450240/nested_2331834954/test-cases_1632709520/should-work_3457346403/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/deeply_4270450240/nested_2331834954/test-cases_1632709520/should-work_3457346403/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 402, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 402, "text": "[\"1f8b0800000000000003558e316ac4401004f37b45a3d88971763ff01f2e19ed366660b523edcc081be3bf1f2becc0593534457ddf80259de3bd2e77bcbecca913df2e0c8dc6e58e8582cd1a3d541c478a2bf8c9513424d43a370cee6c4d02472a7477816b403296cbb45afdba44014d0f83b3e24883e6e0a39fd6720f096eb052844542615b57079b7eb0579d2e48fdf7add66ce89a8e930d524abaf4d0dc66856397a112391efd2f9ed86d0c03351d56d5c04093d506279d6cbfd1b79f277355343e1b010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "de022f658eab084fb412394be4b992c621568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=de022f658eab084fb412394be4b992c621568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627825763" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "5304" + "value": "18541" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=N9dycDatawhkuE1uWMhil2HeB6YxbQFZLe8x3bL0n%2B13vFPT4yaOpvhQ%2BqXbLzGDSSkUnavB%2F445iSnANfK7GSBnKLimawCUNopPXc%2FysjGu6v%2BJZefkR%2FGzZHhL%2BffG0rtqxx7DiW4y9taCcPC7\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52d398c9ab6-FRA" + "value": "67814b818ccc4169-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1100, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.712Z", - "time": 67, + "startedDateTime": "2021-08-01T18:56:36.461Z", + "time": 88, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 67 + "wait": 88 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har index 24770c5..5872efc 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-configure-polly-when-needed_241621399/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -53,20 +53,11 @@ "size": 2, "text": "{}" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d2deecf723f3bd29325bd54d0399c24181568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:15 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +71,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d2deecf723f3bd29325bd54d0399c24181568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627844303" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +97,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +105,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:15 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -123,29 +121,41 @@ }, { "name": "cf-cache-status", - "value": "EXPIRED" + "value": "MISS" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=JMWCP14OkYLgrDnDt%2FmhT3XEAg8eq6RoVCSe8JKGZSNoNP2dRFsUNlf1QR8Q8%2B5JFz51ULrDt%2BbPMEzqpsajXqC71a6m5vxyMuodmDkGGn1A2gPCdkO3ncwmhnblEvvl9ADGT43jteVXchQJ%2B%2BEI\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52dafcf2724-FRA" + "value": "67814b8218be4162-HAM" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 723, + "headersSize": 1050, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 404, "statusText": "Not Found" }, - "startedDateTime": "2019-09-14T08:23:14.785Z", - "time": 308, + "startedDateTime": "2021-08-01T18:56:36.556Z", + "time": 378, "timings": { "blocked": -1, "connect": -1, @@ -153,7 +163,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 308 + "wait": 378 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it-_2136411752/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it_2136411752/recording.har similarity index 75% rename from test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it-_2136411752/recording.har rename to test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it_2136411752/recording.har index 09365c0..9432408 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it-_2136411752/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-it_2136411752/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 400, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 400, "text": "[\"1f8b08000000000000032d4e316e03310cdbf30ac2739776cc0ffa875b7435db08f0c98e2407288afcbdf0b51b2992227f2e4099417fafe58ad7974575c1b713a66663b9a2dca782916004cb29edbd7e2f655d9d3e0f248fd19d78680a370bae50a8254c6fdae01cce1badd235517beb8e9d924250fe3803c6fbe4669ff34b25b137b1aaa91a78f436474a12a3bb773cd8fe1f1fbd315285986b8b7e28ad6a6cb606c8a0ab1cb06ea8dc3535307a841e33b00c67214c4361b3352997e72ffc7a199216010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d19593185b1b56784da586947641d31c41568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d19593185b1b56784da586947641d31c41568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627832123" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "3726" + "value": "12199" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=IKrZDXLwYIprjBqrGjpB2CuXBUG0i%2FY2d9iGRa1qSS7t9%2BBlFtSnxYYhcIhC5d5XW7TydCSh2NdvrXQJ%2BXIZ4X4rN%2Bdclie3Vy07puT4AOiUFBj3Y%2BZ2ff5kK2Qkh%2FpapPiqiXvnpM7AizgoNE4C\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52b5cb9d6e9-FRA" + "value": "67814b7f68a14180-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1098, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.408Z", - "time": 70, + "startedDateTime": "2021-08-01T18:56:36.105Z", + "time": 99, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 70 + "wait": 99 } } ], diff --git a/test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har similarity index 75% rename from test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har rename to test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har index 74adb94..104ebd2 100644 --- a/test/integration/jasmine/__recordings__/setupPolly_466486458/should-have-polly-running-with-test-_2577911815/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-have-polly-running-with-test_2577911815/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 408, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 408, "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:15.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d93be0703ac19e8a8375079a1ed466b821568449395" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:15 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d93be0703ac19e8a8375079a1ed466b821568449395; expires=Sun, 13-Sep-20 08:23:15 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1623347254" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:15 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "1257" + "value": "8808" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=AN%2BxA7jzxR06QedX%2FrbX%2FiSK4outtgH0Vl1X1ZQQVOt8udxTr3o7gLzcKcspHh1qthPQjUYGM5wTabO7%2FVrD5Ub5IAB3JToKNK1BxRNY7bgGO8CFI7coLAacLDrkScDYRbMUVjZ56n71ld3QjJLk\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f5345d21c2fe-FRA" + "value": "67814b7eef4a4162-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1093, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:15.847Z", - "time": 66, + "startedDateTime": "2021-08-01T18:56:36.021Z", + "time": 75, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 66 + "wait": 75 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-1_1242479337/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-1_1242479337/recording.har index da3acb5..e9a4e75 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-1_1242479337/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-1_1242479337/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 408, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 408, "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d19d12545a9d36c2c045899b483fbbea71568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d19d12545a9d36c2c045899b483fbbea71568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1623347254" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "1256" + "value": "8808" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=vNqWzoNhHTfEsu1y0HWYwgtSC8n7AahVkJUzKViBQa0io1dB%2Bg0%2B8Lj%2FZayTC4U8Hwflh%2FuM0LZerwYOI1rUzpPuQQCPQtndWUb8iKB3e%2Bz2M0k%2Fi563u%2Bl%2B2LEBvmIocV%2BDgcnKzwtHY3PVdlAt\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52bcfe9bf14-FRA" + "value": "67814b800ba1416f-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1103, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.484Z", - "time": 69, + "startedDateTime": "2021-08-01T18:56:36.210Z", + "time": 88, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 69 + "wait": 88 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-2_1192146480/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-2_1192146480/recording.har index 343e48e..1915218 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-2_1192146480/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-2_1192146480/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 400, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 400, "text": "[\"1f8b08000000000000032d4e316e03310cdbf30ac2739776cc0ffa875b7435db08f0c98e2407288afcbdf0b51b2992227f2e4099417fafe58ad7974575c1b713a66663b9a2dca782916004cb29edbd7e2f655d9d3e0f248fd19d78680a370bae50a8254c6fdae01cce1badd235517beb8e9d924250fe3803c6fbe4669ff34b25b137b1aaa91a78f436474a12a3bb773cd8fe1f1fbd315285986b8b7e28ad6a6cb606c8a0ab1cb06ea8dc3535307a841e33b00c67214c4361b3352997e72ffc7a199216010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "d377774bf405ee79b424a2cfbcf2a880a1568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=d377774bf405ee79b424a2cfbcf2a880a1568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627832123" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "3726" + "value": "12199" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=K0V4nDCBJfzuf5KPMyvWY9%2BUJ3fy7PMwJLOC3SzCKHKuDTwr49g7ZhhnFAlzyK4jPrxeLWGL%2BmuINfEhJ%2FMTef35j8qKBsc9sqG%2FEHTrYXjCes9BQDfpaq0665V9n9jPyVauv3zmmZTT8hhF4BiF\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52c4b99d6b5-FRA" + "value": "67814b809cedd47b-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1094, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.558Z", - "time": 74, + "startedDateTime": "2021-08-01T18:56:36.305Z", + "time": 60, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 74 + "wait": 60 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-3_1208924099/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-3_1208924099/recording.har index 7433fe3..0410fbf 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-3_1208924099/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/should-work-with-each-capturing-recording-for-post-3_1208924099/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "2.6.2" + "version": "5.1.1" }, "entries": [ { @@ -49,24 +49,16 @@ "response": { "bodySize": 402, "content": { + "_isBinary": true, "mimeType": "application/json; charset=utf-8", "size": 402, "text": "[\"1f8b0800000000000003558e316ac4401004f37b45a3d88971763ff01f2e19ed366660b523edcc081be3bf1f2becc0593534457ddf80259de3bd2e77bcbecca913df2e0c8dc6e58e8582cd1a3d541c478a2bf8c9513424d43a370cee6c4d02472a7477816b403296cbb45afdba44014d0f83b3e24883e6e0a39fd6720f096eb052844542615b57079b7eb0579d2e48fdf7add66ce89a8e930d524abaf4d0dc66856397a112391efd2f9ed86d0c03351d56d5c04093d506279d6cbfd1b79f277355343e1b010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-09-13T08:23:14.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "value": "df7b8194fd7fa9864c78f161d51d857991568449394" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Sat, 14 Sep 2019 08:23:14 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -80,15 +72,22 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=df7b8194fd7fa9864c78f161d51d857991568449394; expires=Sun, 13-Sep-20 08:23:14 GMT; path=/; domain=.typicode.com; HttpOnly" - }, { "name": "x-powered-by", "value": "Express" }, + { + "name": "x-ratelimit-limit", + "value": "1000" + }, + { + "name": "x-ratelimit-remaining", + "value": "999" + }, + { + "name": "x-ratelimit-reset", + "value": "1627825763" + }, { "name": "vary", "value": "Origin, Accept-Encoding" @@ -99,7 +98,7 @@ }, { "name": "cache-control", - "value": "public, max-age=14400" + "value": "max-age=43200" }, { "name": "pragma", @@ -107,7 +106,7 @@ }, { "name": "expires", - "value": "Sat, 14 Sep 2019 12:23:14 GMT" + "value": "-1" }, { "name": "x-content-type-options", @@ -127,33 +126,45 @@ }, { "name": "age", - "value": "5304" + "value": "18541" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=LAWrJ152SlZJGsstsWtxHABbX8HRYQI2DaQDIZNAAKVp6dQS8LIFgsHpMh6xGo4lQ2zcmH%2Fq8ewYW1f2yP8f8j%2FcskbSg6HxzEBl07%2FampO6%2BEezikOWGiFCVAr%2FoH0UIrT3y8ZuT%2BZPLyh0qG7Q\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5160f52ccef8c281-FRA" + "value": "67814b811f52d453-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 765, + "headersSize": 1098, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2019-09-14T08:23:14.638Z", - "time": 69, + "startedDateTime": "2021-08-01T18:56:36.377Z", + "time": 77, "timings": { "blocked": -1, "connect": -1, @@ -161,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 69 + "wait": 77 } } ], diff --git a/test/integration/jest/__recordings__/setupPolly_466486458/with-skipped-test_1941074839/should-record_255246347/recording.har b/test/integration/jest/__recordings__/setupPolly_466486458/with-skipped-test_1941074839/should-record_255246347/recording.har index e66b354..25de63b 100644 --- a/test/integration/jest/__recordings__/setupPolly_466486458/with-skipped-test_1941074839/should-record_255246347/recording.har +++ b/test/integration/jest/__recordings__/setupPolly_466486458/with-skipped-test_1941074839/should-record_255246347/recording.har @@ -4,7 +4,7 @@ "creator": { "comment": "persister:fs", "name": "Polly.JS", - "version": "5.0.0" + "version": "5.1.1" }, "entries": [ { @@ -54,21 +54,11 @@ "size": 408, "text": "[\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\"]" }, - "cookies": [ - { - "domain": ".typicode.com", - "expires": "2020-10-07T09:32:26.000Z", - "httpOnly": true, - "name": "__cfduid", - "path": "/", - "sameSite": "Lax", - "value": "de30c714a345075fcc3915c4dcbd16a231599471146" - } - ], + "cookies": [], "headers": [ { "name": "date", - "value": "Mon, 07 Sep 2020 09:32:26 GMT" + "value": "Sun, 01 Aug 2021 18:57:55 GMT" }, { "name": "content-type", @@ -82,11 +72,6 @@ "name": "connection", "value": "close" }, - { - "_fromType": "array", - "name": "set-cookie", - "value": "__cfduid=de30c714a345075fcc3915c4dcbd16a231599471146; expires=Wed, 07-Oct-20 09:32:26 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax" - }, { "name": "x-powered-by", "value": "Express" @@ -97,11 +82,11 @@ }, { "name": "x-ratelimit-remaining", - "value": "997" + "value": "999" }, { "name": "x-ratelimit-reset", - "value": "1598841974" + "value": "1623347254" }, { "name": "vary", @@ -141,37 +126,45 @@ }, { "name": "age", - "value": "13633" - }, - { - "name": "cf-request-id", - "value": "050981eefa00000b3fcb0ea200000001" + "value": "8808" }, { "name": "expect-ct", "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" }, + { + "name": "report-to", + "value": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=wRrhSoKNzDXAQepPeRf5WaB1AEm8erPylXOAE4Ugn2i5o0oruds%2F3ZyYmRglwtgOpgm8QlmRMTYPjXhnba9cae3C0KKStVevXyQUx%2Fp%2BxLn3icnACOvjehPJz%2FvEn4iwn5ra4jJXzobpGvRV2Gxu\"}],\"group\":\"cf-nel\",\"max_age\":604800}" + }, + { + "name": "nel", + "value": "{\"report_to\":\"cf-nel\",\"max_age\":604800}" + }, { "name": "server", "value": "cloudflare" }, { "name": "cf-ray", - "value": "5cef6c2b2af10b3f-AMS" + "value": "67814b849e064180-HAM" }, { "name": "content-encoding", "value": "gzip" + }, + { + "name": "alt-svc", + "value": "h3-27=\":443\"; ma=86400, h3-28=\":443\"; ma=86400, h3-29=\":443\"; ma=86400, h3=\":443\"; ma=86400" } ], - "headersSize": 878, + "headersSize": 1093, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2020-09-07T09:32:25.221Z", - "time": 131, + "startedDateTime": "2021-08-01T18:56:36.945Z", + "time": 59, "timings": { "blocked": -1, "connect": -1, @@ -179,7 +172,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 131 + "wait": 59 } } ], diff --git a/test/integration/jest/getPost.js b/test/integration/jest/getPost.js new file mode 100644 index 0000000..4741dd1 --- /dev/null +++ b/test/integration/jest/getPost.js @@ -0,0 +1,11 @@ +const fetch = require('node-fetch'); + +const getPost = async id => { + const response = await fetch( + `https://jsonplaceholder.typicode.com/posts/${id}` + ); + const json = await response.json(); + return Object.assign(json, { ok: response.ok, status: response.status }); +}; + +module.exports = { getPost }; diff --git a/test/integration/jest/index.test.js b/test/integration/jest/index.test.js index 8ad70ac..b549583 100644 --- a/test/integration/jest/index.test.js +++ b/test/integration/jest/index.test.js @@ -1,16 +1,8 @@ /** @jest-environment ../../../jest-environment-node */ const path = require('path'); -const fetch = require('node-fetch'); const { setupPolly, JestPollyGlobals } = require('../../..'); - -const getPost = async id => { - const response = await fetch( - `https://jsonplaceholder.typicode.com/posts/${id}` - ); - const json = await response.json(); - return Object.assign(json, { ok: response.ok, status: response.status }); -}; +const { getPost } = require("./getPost"); const globals = new JestPollyGlobals(); diff --git a/test/integration/jest/polly-register.test.js b/test/integration/jest/polly-register.test.js new file mode 100644 index 0000000..01f34dc --- /dev/null +++ b/test/integration/jest/polly-register.test.js @@ -0,0 +1,31 @@ +/** @jest-environment ../../../jest-environment-jsdom */ + +const path = require('path'); +const { Polly } = require('@pollyjs/core'); +const { setupPolly } = require('../../..'); +const { getPost } = require('./getPost'); + +Polly.register(require('@pollyjs/adapter-node-http')); +Polly.register(require('@pollyjs/persister-fs')); + +// FIXME: see https://github.com/gribnoysup/setup-polly-jest/issues/23 +const desc = !global.jasmine + ? // eslint-disable-next-line no-console + (console.warn('Skipping failing test suite in jest-circus'), describe.skip) + : describe; + +desc('Polly.register', () => { + setupPolly({ + adapters: ['node-http'], + persister: 'fs', + persisterOptions: { + fs: { + recordingsDir: path.resolve(__dirname, '__recordings__') + } + } + }); + + it('setup-polly-jest works when adapters and persisters are registered with Polly.register', async () => { + expect(await getPost(1)).toHaveProperty('id', 1); + }); +}); diff --git a/test/integration/jest/test-only.test.js b/test/integration/jest/test-only.test.js index d844b81..65ed87c 100644 --- a/test/integration/jest/test-only.test.js +++ b/test/integration/jest/test-only.test.js @@ -1,19 +1,8 @@ /** @jest-environment ../../../jest-environment-jsdom */ const path = require('path'); -const fetch = require('node-fetch'); - const { setupPolly } = require('../../..'); - -const getPost = async id => { - const response = await fetch( - `https://jsonplaceholder.typicode.com/posts/${id}` - ); - - const json = await response.json(); - - return Object.assign(json, { ok: response.ok, status: response.status }); -}; +const { getPost } = require('./getPost'); setupPolly({ adapters: [require('@pollyjs/adapter-node-http')], diff --git a/test/integration/jest/test-skip.test.js b/test/integration/jest/test-skip.test.js new file mode 100644 index 0000000..4402f01 --- /dev/null +++ b/test/integration/jest/test-skip.test.js @@ -0,0 +1,35 @@ +/** @jest-environment ../../../jest-environment-jsdom */ + +const path = require('path'); +const { setupPolly } = require('../../..'); +const { getPost } = require('./getPost'); + +// FIXME: see https://github.com/gribnoysup/setup-polly-jest/issues/24 +const desc = !global.jasmine + ? // eslint-disable-next-line no-console + (console.warn('Skipping failing test suite in jest-circus'), describe.skip) + : describe; + +desc('it.skip', () => { + setupPolly({ + adapters: [require('@pollyjs/adapter-node-http')], + persister: require('@pollyjs/persister-fs'), + persisterOptions: { + fs: { + recordingsDir: path.resolve(__dirname, '__recordings__') + } + } + }); + + it('should run test before .skip and not fail', async () => { + expect(await getPost(1)).toHaveProperty('id', 1); + }); + + it.skip('skipped', () => { + expect(true).toBeTruthy(); + }); + + it('should run test after .skip and not fail', async () => { + expect(await getPost(3)).toHaveProperty('id', 3); + }); +}); diff --git a/test/unit/__mocks__/global.js b/test/unit/__mocks__/global.js index aa56ec3..bb1798d 100644 --- a/test/unit/__mocks__/global.js +++ b/test/unit/__mocks__/global.js @@ -64,3 +64,9 @@ export class GlobalMock { this.befores.forEach(fn => fn()); } } + +export function MockDoneFn() { + const spy = jest.fn(); + spy.fail = jest.fn(); + return spy; +} diff --git a/test/unit/setup-polly-jasmine.test.js b/test/unit/setup-polly-jasmine.test.js index c529b4a..a5dec0e 100644 --- a/test/unit/setup-polly-jasmine.test.js +++ b/test/unit/setup-polly-jasmine.test.js @@ -4,16 +4,11 @@ import { JestPollyGlobals } from '../../lib/common'; import { GlobalMock, beforeAndAfterFnsMock, - testMock + testMock, + MockDoneFn } from './__mocks__/global'; import { PollyMock } from './__mocks__/polly'; -const mockDone = () => { - const done = jest.fn(); - done.fail = jest.fn(); - return done; -}; - describe('setupPollyJasmine', () => { afterEach(() => { testMock.mockClear(); @@ -42,7 +37,7 @@ describe('setupPollyJasmine', () => { const { fn: before } = testCase.beforeAndAfterFns().befores[0]; - const done = mockDone(); + const done = new MockDoneFn(); before(done); @@ -63,7 +58,7 @@ describe('setupPollyJasmine', () => { const { fn: before } = testCase.beforeAndAfterFns().befores[0]; const { fn: after } = testCase.beforeAndAfterFns().afters[0]; - const done = mockDone(); + const done = new MockDoneFn(); before(done); @@ -145,7 +140,7 @@ describe('setupPollyJasmine', () => { test.each(['it', 'fit'])( 'should create instance of polly when before hook is called for `%s` test', method => { - const done = jest.fn(); + const done = new MockDoneFn(); const pollyOptions = {}; const stub = new GlobalMock(); @@ -181,7 +176,7 @@ describe('setupPollyJasmine', () => { const { befores } = testCase.beforeAndAfterFns(); - befores[0].fn(); + befores[0].fn(new MockDoneFn()); expect(context.polly.name).toMatchInlineSnapshot( `"suite1 description/special_test_id_to_test_name_generation"` @@ -191,7 +186,7 @@ describe('setupPollyJasmine', () => { test.each(['it', 'fit'])( 'should stop polly and remove it from context when after hook is called for `%s` test', async method => { - const done = jest.fn(); + const done = new MockDoneFn(); const stub = new GlobalMock(); const env = stub.jasmine.getEnv();