Skip to content

Commit

Permalink
ci: fix test script
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Jan 4, 2023
1 parent 6d7d0e1 commit dd15281
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 49 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"postinstall": "node scripts/postinstall.mjs && pnpm format && sort-json packages/*/locales/*.json",
"pub": "pnpm build && lerna publish",
"style": "prettier --check '**/*.{ts,tsx,json,md,svelte}'",
"test": "pnpm --filter bytemd test"
"test": "vitest"
},
"prettier": {
"pluginSearchDirs": [
Expand Down Expand Up @@ -50,7 +50,8 @@
"svelte2tsx": "^0.6.0",
"svgo": "^3.0.2",
"tsdv": "^0.8.0",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"vitest": "^0.26.3"
},
"packageManager": "[email protected]",
"bundlewatch": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bytemd/test/editor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="tsdv/vitest/globals" />
/// <reference types="vitest/globals" />
import { Editor } from '../src'
import '@testing-library/jest-dom'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/bytemd/test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="tsdv/vitest/globals" />
/// <reference types="vitest/globals" />

// https://github.com/jsdom/jsdom/issues/3002#issuecomment-655752934
document.createRange = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/bytemd/test/viewer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="tsdv/vitest/globals" />
/// <reference types="vitest/globals" />
import { Viewer } from '../src'
import '@testing-library/jest-dom'
import { render, act } from '@testing-library/svelte'
Expand Down
26 changes: 0 additions & 26 deletions packages/bytemd/tsdv.config.ts

This file was deleted.

163 changes: 163 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 1 addition & 18 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
// @ts-check
import { createVue3Plugin } from '../packages/vue-next/plugin.mjs'
import { createVuePlugin } from '../packages/vue/plugin.mjs'
import { packages, packagesDir } from './utils.mjs'
import { packages, packagesDir, sveltePreprocessor } from './utils.mjs'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { execaCommand } from 'execa'
import glob from 'fast-glob'
import fs from 'fs-extra'
import path from 'path'
import resolve from 'resolve'
import { emitDts } from 'svelte2tsx'
import sveltePreprocess from 'svelte-preprocess'
import { preprocess } from 'svelte/compiler'
import { build } from 'tsdv'

const sveltePreprocessor = sveltePreprocess({
typescript: true,
// https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198
replace: [
[/(>)[\s]*([<{])/g, '$1$2'],
[/({[/:][a-z]+})[\s]*([<{])/g, '$1$2'],
[/({[#:][a-z]+ .+?})[\s]*([<{])/g, '$1$2'],
[/([>}])[\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],
],
})

;(async () => {
for (let name of packages) {
console.log('[building]', name)
Expand Down Expand Up @@ -71,11 +59,6 @@ const sveltePreprocessor = sveltePreprocess({
],
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: 'test/setup.ts',
},
})

if (name === 'bytemd') {
Expand Down
Loading

0 comments on commit dd15281

Please sign in to comment.