redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

Fix codegen-openapi tests

Open aryaemami59 opened this issue 1 year ago • 3 comments

Overview

Previously the codegen tests would create side effects which made them unpredictable and caused them to produce inconsistent results. This PR mainly focuses on making the unit tests reliable both during local development and CI.

This PR:

  • [X] Replaces the old cli command in cli.test.ts with a promisified version of Node's exec which mimicks the actual cli behavior more closely.
  • [X] Enables importHelpers for a slightly smaller bundle size.
  • [X] Revamps the tsconfig setup to have a tsconfig.build.json and tsconfig.json as opposed to a test/tsconfig.json with baseUrl.
  • [X] Uses path aliasing to test against the output lib folder during CI. vite-tsconfig-paths was added to devDependencies to manage this easier.
  • [X] Disables fileParallelism for unit tests in order to minimize side effects.
  • [X] Creates a more comprehensive CI workflow for the codegen-openapi that tests against the final build artifact on different operating systems.

aryaemami59 avatar Mar 27 '24 10:03 aryaemami59

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

codesandbox[bot] avatar Mar 27 '24 10:03 codesandbox[bot]

Deploy Preview for redux-starter-kit-docs ready!

Name Link
Latest commit 91aea9aa84d2277f46b9b858daa3929022108b14
Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/66d20e8dbf2e42000932fe1a
Deploy Preview https://deploy-preview-4307--redux-starter-kit-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 27 '24 10:03 netlify[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 91aea9aa84d2277f46b9b858daa3929022108b14:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

codesandbox-ci[bot] avatar Mar 27 '24 10:03 codesandbox-ci[bot]

@aryaemami59 fyi the "ts/json/etc should be the same" test seems to be flaky - sometimes it can't find example.ts. Some kind of filesystem race condition, maybe?

markerikson avatar Aug 30 '24 21:08 markerikson

Yup that's exactly what it is. I'll have to look into it later.

aryaemami59 avatar Aug 30 '24 21:08 aryaemami59