Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to pass compilerOptions via the Jest config for Vue 3 #412

Merged
merged 2 commits into from
Nov 28, 2021

Conversation

cexbrayat
Copy link
Member

These options can be used to define Vue compiler options in @vue/vue3-jest.

For example, to enable the newly introduced propsDestructureTransform in Vue v3.2.20:

globals: {
  'vue-jest': {
    compilerOptions: {
      propsDestructureTransform: true
    }
  }
}

or to disable refTransform (which is enabled by default):

globals: {
  'vue-jest': {
    compilerOptions: {
      refTransform: false
    }
  }
}

Note that this also removes the now unneeded `@vue/compiler-sfc` dependency.
Fixes vuejs#410
These options can be used to define Vue compiler options in `@vue/vue3-jest`.

For example, to enable the newly intrioduced `propsDestructureTransform` in Vue v3.2.20:

```js
globals: {
  'vue-jest': {
    compilerOptions: {
      propsDestructureTransform: true
    }
  }
}
```

or to disable `refTransform` (which is enabled by default):

```js
globals: {
  'vue-jest': {
    compilerOptions: {
      refTransform: false
    }
  }
}
```
@cexbrayat cexbrayat force-pushed the feat/compiler-options branch from 202ec47 to ef847c0 Compare November 18, 2021 11:36
</template>

<script setup lang="ts">
const { name = 'name' } = defineProps<{ name?: string }>()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not realize this was something now supported in Vue, neat.

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@lmiller1990 lmiller1990 merged commit af556eb into vuejs:master Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants