|
| 1 | +# Migration Guide for v4 |
| 2 | + |
| 3 | +## Breaking Changes |
| 4 | + |
| 5 | +### Node Version |
| 6 | +Node versions 12 is longer supported - 14 is the minimum version supported. |
| 7 | + |
| 8 | +### TypeScript Version |
| 9 | +The `typescript` development dependnecy is now required to be at least version 4. |
| 10 | + |
| 11 | +Run `npm install -D typescript@4` to upgrade to version 4. |
| 12 | + |
| 13 | +Code produced by the IBM OpenAPI SDK Generator should already be compliant with TypeScript v4. |
| 14 | + |
| 15 | +Additionally, you may need to upgrade `@typescript-eslint/eslint-plugin` to be compatible with the new |
| 16 | +version of TypeScript. This upgrade should be safe and compatible, especially if you remain on major version 4 |
| 17 | +of this development dependency. |
| 18 | + |
| 19 | +Run `npm i -D '@typescript-eslint/eslint-plugin'` to upgrade. |
| 20 | + |
| 21 | +### Jest Version |
| 22 | +The `jest` development dependency is now required to be at least version 29. |
| 23 | + |
| 24 | +Run `npm install -D jest@29` to upgrade to version 29. |
| 25 | + |
| 26 | +Code produced by the IBM OpenAPI Generator should already be compliant with Jest v29. |
| 27 | + |
| 28 | +Note: Ensure your test code does not contain the anti-pattern of using a `done` callback with an `async` function. |
| 29 | +This is no longer permitted in Jest 29, whereas it was discouraged but permitted in previous versions. An old version of the IBM OpenAPI SDK Generator included a bug that generated this pattern. If your generated test code has not been updated since then, you may run into this issue. |
| 30 | + |
| 31 | +Example diff showing proper resolution: |
| 32 | +``` |
| 33 | +diff --git a/test/integration/example.v1.test.js b/test/integration/example.v1.test.js |
| 34 | +index be0bec3..62f03f8 100644 |
| 35 | +--- a/test/integration/example.v1.test.js |
| 36 | ++++ b/test/integration/example.v1.test.js |
| 37 | +@@ -38,7 +38,7 @@ describe('ExampleV1_integration', () => { |
| 38 | + jest.setTimeout(timeout); |
| 39 | + let example; |
| 40 | + |
| 41 | +- beforeAll(async (done) => { |
| 42 | ++ beforeAll(async () => { |
| 43 | + example = ExampleV1.newInstance({}); |
| 44 | + |
| 45 | + const config = readExternalSources(ExampleV1.DEFAULT_SERVICE_NAME); |
| 46 | +@@ -58,8 +58,6 @@ describe('ExampleV1_integration', () => { |
| 47 | + |
| 48 | + log(`Service URL: ${example.baseOptions.serviceUrl}`); |
| 49 | + log('Finished setup.'); |
| 50 | +- |
| 51 | +- done(); |
| 52 | + }); |
| 53 | + |
| 54 | + test('getSomething()', async () => { |
| 55 | +``` |
0 commit comments