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

Roadmap #1

Open
ahnpnl opened this issue Sep 10, 2020 · 3 comments
Open

Roadmap #1

ahnpnl opened this issue Sep 10, 2020 · 3 comments

Comments

@ahnpnl
Copy link
Collaborator

ahnpnl commented Sep 10, 2020

@lmiller1990 maybe listing some details about roadmap for this repo ?

@lmiller1990
Copy link
Owner

lmiller1990 commented Sep 10, 2020

For this to be useful (and eventually better than vue-jest) we would to achieve the following:

Given this component:

<template>
  <div>Count is {{ count }}</div>
  <div>{{ computedMsg }}</div>
</template>

<script lang="ts">
window.performGlobalSideEffect()

// this can be imported as `import { named } from './*.vue'`
export const named = 1
</script>

<script setup="props" lang="ts">
import { ref, computed } from 'vue'

export const count = ref(5)

declare const props: {
  msg: string
}

export const computedMsg = computed<number>(() => props.msg)
</script>

MVP:

  • using <script> and <script setup> in the same .vue file.
  • compilation error: computed is meant to be a number but we return a string. Jest should refuse to run the test and say "Type 'string' is not assignable to type 'number'."
  • performGlobalSideEffect is called
  • can import the named variable to another file
  • render count and computedMsg correctly (when compilation error is fixed)

Nice to have

  • show the correct line where the error occurs (source map)
  • other language (like pug)
  • support <style>
  • code coverage (this is low priority for me)

Won't do

  • support using babel (only going to use ts-jest)

@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Sep 14, 2020

I think you can still support babel. Something like babel-plugin-transform-vue-jsx or other babel plugins people might want to use. It doesn't cause any extra logic because ts-jest will handle it for vue-ts-jest.

Regarding to source map, source map string should point to the file which is being compiled. By default, ts-jest always generates inline source map to point to ts/js file. So in the case of vue-ts-jest:

  • If processing file is .vue extension, source map should come from vue-compiler as vue-compiler has the information where the file locates. However, .vue files usually contain both ts and html codes, not sure how to have a source map correct for this situation. Perhaps Vue-compiler can do something ?

  • If processing file is .ts/.js extension, source map can come from ts-jest.

@lmiller1990
Copy link
Owner

Source maps is probably my next goal. It should be easy since vue-sfc does it for us. I will be able to try this later this week or on the weekend.

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

No branches or pull requests

2 participants