diff --git a/docs/configuration.md b/docs/configuration.md index 3e7832f1..fe38c763 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -54,23 +54,6 @@ polly.configure({ }); ``` -## recordIfExpired - -_deprecated! use [expiryStrategy](#expiryStrategy)_ -_Type_: `Boolean` -_Default_: `false` - -If a request's recording has expired, pass-through to the server and -record a new response. - -**Example** - -```js -polly.configure({ - recordIfExpired: true -}); -``` - ## recordFailedRequests _Type_: `Boolean` diff --git a/packages/@pollyjs/core/src/utils/merge-configs.js b/packages/@pollyjs/core/src/utils/merge-configs.js index d7da9528..95445447 100644 --- a/packages/@pollyjs/core/src/utils/merge-configs.js +++ b/packages/@pollyjs/core/src/utils/merge-configs.js @@ -1,25 +1,4 @@ import mergeWith from 'lodash-es/mergeWith'; -import { EXPIRY_STRATEGIES } from '@pollyjs/utils'; - -function deprecateRecordIfExpired(mergedConfig) { - if (mergedConfig.hasOwnProperty('recordIfExpired')) { - console.warn( - '[Polly] config option "recordIfExpired" is deprecated. Please use "expiryStrategy".' - ); - - if (mergedConfig.recordIfExpired) { - // replace recordIfExpired: true with expiryStrategy: record - mergedConfig.expiryStrategy = EXPIRY_STRATEGIES.RECORD; - } else { - // replace recordIfExpired: false with expiryStrategy: warn - mergedConfig.expiryStrategy = EXPIRY_STRATEGIES.WARN; - } - - delete mergedConfig.recordIfExpired; - } - - return mergedConfig; -} function customizer(objValue, srcValue, key) { // Arrays and `context` options should just replace the existing value @@ -30,7 +9,5 @@ function customizer(objValue, srcValue, key) { } export default function mergeConfigs(...configs) { - const mergedConfig = mergeWith({}, ...configs, customizer); - - return deprecateRecordIfExpired(mergedConfig); + return mergeWith({}, ...configs, customizer); } diff --git a/tests/integration/adapter-tests.js b/tests/integration/adapter-tests.js index 85d48db5..8c13d180 100644 --- a/tests/integration/adapter-tests.js +++ b/tests/integration/adapter-tests.js @@ -254,16 +254,6 @@ export default function adapterTests() { await this.polly.persister.delete(this.polly.recordingId); }); - it('re-records on expired recording if recordIfExpired is true', async function() { - this.polly.configure({ recordIfExpired: true }); - expect(await testExpiration.call(this)).to.equal(true); - }); - - it('replays the expired recording if recordIfExpired is false', async function() { - this.polly.configure({ recordIfExpired: false }); - expect(await testExpiration.call(this)).to.equal(false); - }); - it('warns and plays back on expired recording if expiryStrategy is "warn"', async function() { this.polly.configure({ expiryStrategy: 'warn' }); expect(await testExpiration.call(this)).to.equal(false);