vuejs / vue-jest

Jest Vue transformer
MIT License
746 stars 157 forks source link

feat: add compilerOptions to vue-jest global options #380

Closed SasanFarrokh closed 3 years ago

SasanFarrokh commented 3 years ago

This PR allows to pass down compilerOptions to vue-jest transformation.

SasanFarrokh commented 3 years ago

Could you review this? @cexbrayat

lmiller1990 commented 3 years ago

Seems fine to me!

lmiller1990 commented 3 years ago

What is your use-case, btw?

cexbrayat commented 3 years ago

Lachlan already merged, but I'm also curious about the use case.

And I think adding a test would be great, so we can remember why this is there, and not have a regression.

SasanFarrokh commented 3 years ago

@lmiller1990 @cexbrayat Hey, Thanks for merging. About the use case, we're using custom directives and other custom node transformations. Just to mention, one of them is v-test directive that transforms to data-test in test environments (in production mode it does nothing). So we needed to pass the compiler options down to vue-jest. I thought it would be a good option to be able to customize the whole compilerOptions.

cexbrayat commented 3 years ago

@SasanFarrokh Sounds cool 👍

Would you mind opening a PR with a small test for this use case? It can be a simple one, just to make sure we don't have a regression later.

lmiller1990 commented 3 years ago

A test would be great.

SasanFarrokh commented 3 years ago

A Simple test added, just to ensure compilerOptions had been used. https://github.com/vuejs/vue-jest/pull/385