diff --git a/.eslintrc.yml b/.eslintrc.yml index 187da487..8e6181fc 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -3,18 +3,13 @@ root: true env: browser: true node: true - mocha: true es2020: true globals: NodeJS: true - KOISHI_CONFIG: true extends: - '@cordisjs/eslint-config' -plugins: - - mocha - rules: '@typescript-eslint/naming-convention': off diff --git a/package.json b/package.json index 3dbbfbe0..2e11b9c8 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dep": "yakumo upgrade", "pub": "yakumo publish", "lint": "eslint packages adapters --ext=ts --cache", - "test": "yakumo mocha -r esbuild-register", + "test": "yakumo test -r esbuild-register", "test:text": "shx rm -rf coverage && c8 -r text yarn test", "test:json": "shx rm -rf coverage && c8 -r json yarn test", "test:html": "shx rm -rf coverage && c8 -r html yarn test" @@ -24,24 +24,18 @@ "devDependencies": { "@cordisjs/eslint-config": "^1.0.4", "@types/chai": "^4.3.11", - "@types/mocha": "^9.1.1", "@types/node": "^20.10.2", "c8": "^7.14.0", "chai": "^4.3.10", "esbuild": "^0.18.20", "esbuild-register": "^3.5.0", "eslint": "^8.55.0", - "eslint-plugin-mocha": "^10.2.0", - "mocha": "^9.2.2", "shx": "^0.3.4", "typescript": "^5.3.2", - "yakumo": "^0.3.13", - "yakumo-esbuild": "^0.3.26", - "yakumo-mocha": "^0.3.1", - "yakumo-publish": "^0.3.10", - "yakumo-publish-sync": "^0.3.3", - "yakumo-tsc": "^0.3.12", - "yakumo-upgrade": "^0.3.6", - "yakumo-version": "^0.3.4" + "yakumo": "^1.0.0-alpha.3", + "yakumo-esbuild": "^1.0.0-alpha.0", + "yakumo-mocha": "^1.0.0-alpha.0", + "yakumo-publish-sync": "^1.0.0-alpha.0", + "yakumo-tsc": "^1.0.0-alpha.1" } } diff --git a/packages/element/tests/segment.spec.ts b/packages/element/tests/segment.spec.ts index b9958e98..49ab469d 100644 --- a/packages/element/tests/segment.spec.ts +++ b/packages/element/tests/segment.spec.ts @@ -1,22 +1,23 @@ import Element from '../src' +import { describe, test } from 'node:test' import { expect, use } from 'chai' import shape from 'chai-shape' use(shape) describe('Element API', () => { - it('Element.escape()', () => { + test('Element.escape()', () => { expect(Element.escape('')).to.equal('<foo>') expect(Element.escape('"')).to.equal('&quot;') }) - it('Element.unescape()', () => { + test('Element.unescape()', () => { expect(Element.unescape('<foo>')).to.equal('') expect(Element.unescape('&quot;')).to.equal('"') }) describe('Element.parse()', () => { - it('basic support', () => { + test('basic support', () => { expect(Element.parse('')) .to.deep.equal([Element('img', { src: 'https://test.com/?foo=1&bar=2' })]) expect(Element.parse(`text`)) @@ -25,13 +26,13 @@ describe('Element API', () => { .to.deep.equal([Element('tag', { foo: false, barQux: true }, 'text')]) }) - it('mismatched tags', () => { + test('mismatched tags', () => { expect(Element.parse('123').join('')).to.equal('123') expect(Element.parse('14').join('')).to.equal('14') expect(Element.parse('14').join('')).to.equal('14') }) - it('whitespace', () => { + test('whitespace', () => { expect(Element.parse(`<> 1 @@ -41,7 +42,7 @@ describe('Element API', () => { }) describe('Interpolation', () => { - it('interpolate', () => { + test('interpolate', () => { expect(Element.parse('1{foo}1', { foo: 233, bar: 666 })) .to.deep.equal([Element('tag', { bar: 666 }, '1', '233', '1')]) expect(Element.parse('>{">"}', {})) @@ -50,21 +51,21 @@ describe('Element API', () => { .to.deep.equal([Element('tag', '233', '2')]) }) - it('control flow', () => { + test('control flow', () => { expect(Element.parse('{#if foo >= 0}{foo}{:else}

negative

{/if}', { foo: 233 })) .to.deep.equal([Element.text('233')]) expect(Element.parse('{#if foo >= 0}{foo}{:else}

negative

{/if}', { foo: -233 })) .to.deep.equal([Element('p', 'negative')]) }) - it('#each', () => { + test('#each', () => { expect(Element.parse('{#each arr as i}{i ** 2}{/each}', { arr: [1, 2, 3] })) .to.deep.equal([Element.text('1'), Element.text('4'), Element.text('9')]) }) }) describe('Element.toString()', () => { - it('basic support', () => { + test('basic support', () => { expect(Element('img', { src: 'https://test.com/?foo=1&bar=2' }).toString()) .to.equal('') expect(Element('tag', { foo: false, barQux: true }, 'text').toString()) @@ -72,7 +73,7 @@ describe('Element API', () => { expect(Element('template', Element.parse('<bar>')).toString(true)).to.equal('') }) - it('validate children', () => { + test('validate children', () => { expect(() => Element('tag', {}, {} as any)).to.throw() expect(Element('tag', ['123', null, Element('span', '456')]).toString()) .to.equal('123456') @@ -84,13 +85,13 @@ describe('Element API', () => { describe('Selectors', () => { const selectIds = (source: string, query: string) => Element.select(source, query).map(el => el.attrs.id) - it('type selector', () => { + test('type selector', () => { expect(selectIds('', 'a')).to.deep.equal(['1', '2']) expect(selectIds('', 'b')).to.deep.equal(['2']) expect(selectIds('', 'c')).to.deep.equal([]) }) - it('descendant', () => { + test('descendant', () => { expect(selectIds('', 'b>c')).to.deep.equal(['3']) expect(selectIds('', 'a c')).to.deep.equal(['3']) expect(selectIds('', 'a>c')).to.deep.equal([]) @@ -98,7 +99,7 @@ describe('Element API', () => { expect(selectIds('', 'a>c')).to.deep.equal(['3']) }) - it('sibling', () => { + test('sibling', () => { expect(selectIds('', 'a+b')).to.deep.equal(['3']) expect(selectIds('', 'a~b')).to.deep.equal(['3', '4']) }) diff --git a/yakumo.yml b/yakumo.yml index c226cc0d..92f4dccf 100644 --- a/yakumo.yml +++ b/yakumo.yml @@ -1,8 +1,13 @@ -require: - - yakumo-esbuild - - yakumo-mocha - - yakumo-publish - - yakumo-publish-sync - - yakumo-tsc - - yakumo-upgrade - - yakumo-version +- name: yakumo + config: + pipeline: + build: + - tsc + - esbuild + clean: + - tsc --clean +- name: yakumo-esbuild +- name: yakumo-esbuild-yaml +- name: yakumo-mocha +- name: yakumo-publish-sync +- name: yakumo-tsc