rollup-plugin-typescript2 icon indicating copy to clipboard operation
rollup-plugin-typescript2 copied to clipboard

test: add `parse-tsconfig` spec

Open agilgur5 opened this issue 3 years ago • 0 comments
trafficstars

Summary

Adds unit tests for a few scenarios of parse-tsconfig.ts

  • Follow-up to #321 and https://github.com/ezolenko/rollup-plugin-typescript2/pull/371#issuecomment-1174339120

Details

  • test passing tsconfig, buggy tsconfig, non-existent tsconfig, and not a tsconfig

  • clean: "failed to read" error will never happen as we already checked for existence of the file earlier

    • so remove the undefined check and instead use a non-null assertion (plus a comment explaining it)
  • refactor: move the integration test for tsconfig error into this unit test instead

    • faster / more efficient / more precise
  • refactor: split out a makeOptions func that creates default plugin options to use in tests

    • similar to makeStubbedContext

Future Work

  • Could also test that merging tsconfigs works correctly, not just that it doesn't throw
    • Would be particularly useful for when #86 is implemented as that would no longer be a straight lodash deep merge anymore

agilgur5 avatar Jul 22 '22 23:07 agilgur5