Skip to content

Conversation

lmiller1990
Copy link
Member

Added some tests based on the feedback in #876

tsconfig.json Outdated
"module": "esnext",
"lib": ["DOM", "ES2015", "ES2017"],
"strict": true,
"allowJs": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this since I think it makes sense to have some JS based <script setup> components - since we only use TS at the moment, which is not really representative of al the users.

Why is this breaking the build?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to stick to TS components as this ensures vue-tsc can properly check them. And if it works in TS, it works in JS 🙂 So it would be better to remove this, and convert the script setup to TS I think.

Copy link
Member

@cexbrayat cexbrayat left a comment

Choose a reason for hiding this comment

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

Thanks @lmiller1990

The lockfile received quite a few changes, maybe this is what caused the failing build?
A few changes are needed, ping when done if you want another review

<script setup>
import { toRefs, ref, inject } from 'vue'
const props = defineProps({
Copy link
Member

Choose a reason for hiding this comment

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

in TS, this can be written more elegantly using defineProps<{ title: string}>()

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Do you think there's a use case for including some plain JS tests, too? Ideally we should running tests against a wide variety of configs - not sure type safety is a big deal in these kind of fixtures.

Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to have integration tests as a safety net against various config indeed (something like a mini CLI project in TS and in JS, using the built version of VTU). But I think for our unit tests we should be fine if sticking to TS: it's pretty much the hardest thing to get right from our tooling perspective.

}
})

console.log(wrapper.html())
Copy link
Member

Choose a reason for hiding this comment

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

this should be removed

tsconfig.json Outdated
"module": "esnext",
"lib": ["DOM", "ES2015", "ES2017"],
"strict": true,
"allowJs": true,
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to stick to TS components as this ensures vue-tsc can properly check them. And if it works in TS, it works in JS 🙂 So it would be better to remove this, and convert the script setup to TS I think.

@lmiller1990
Copy link
Member Author

@cexbrayat thanks for the review, updated the PR.

@cexbrayat
Copy link
Member

Awesome, thanks Lachlan!

@cexbrayat cexbrayat merged commit 080dbff into master Aug 31, 2021
@cexbrayat cexbrayat deleted the chore/add-example-tests branch August 31, 2021 06:11
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