ci: test project on pull requests (#338)

This commit is contained in:
Daniel Roe 2022-12-04 23:28:04 +00:00 committed by GitHub
parent 1c0f8b0147
commit 408aff20ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

33
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🚧 Set up project
run: pnpm nuxi prepare
- name: 🧪 Test project
run: pnpm test
- name: 💪 Type check
run: pnpm test:typecheck

View file

@ -44,6 +44,8 @@ onBeforeUnmount(() => {
if (!import.meta.env.SSR) if (!import.meta.env.SSR)
document.removeEventListener('click', clickEvent) document.removeEventListener('click', clickEvent)
}) })
// work around a type error when persisted is passed directly: An object literal cannot have multiple properties with the same name.
const persisted = 'persisted' as string
</script> </script>
<template> <template>
@ -58,7 +60,7 @@ onBeforeUnmount(() => {
leave-active-class="transition duration-250 ease-in children:(transition duration-250 ease-in)" leave-active-class="transition duration-250 ease-in children:(transition duration-250 ease-in)"
leave-from-class="opacity-100 children:(transform translate-y-0)" leave-from-class="opacity-100 children:(transform translate-y-0)"
leave-to-class="opacity-0 children:(transform translate-y-full)" leave-to-class="opacity-0 children:(transform translate-y-full)"
persisted :[persisted]="true"
> >
<div <div
v-show="visible" v-show="visible"

View file

@ -55,7 +55,7 @@ async function render(input: string, emojis?: Record<string, Emoji>) {
const tree = parseMastodonHTML(input, emojis) const tree = parseMastodonHTML(input, emojis)
const html = await renderTree(tree) const html = await renderTree(tree)
let formatted = '' let formatted = ''
const serializedText = tree.children.map(n => treeToText(n)).join('').trim() const serializedText = treeToText(tree).trim()
try { try {
formatted = format(html, { formatted = format(html, {