Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
push:
branches:
- master
paths-ignore:
- .github/**
- packages/templates/**
- packages/www/**
pull_request:
paths-ignore:
- .github/**
- packages/templates/**
- packages/www/**
workflow_dispatch:

jobs:
test:
if: ${{ github.repository_owner == 'nuejs' || github.event_name == 'workflow_dispatch' }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2

- name: Install and test with Bun
run: |
bun -v
bun install
bun test --coverage
55 changes: 0 additions & 55 deletions .github/workflows/test.yaml.disabled

This file was deleted.

2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
coveragePathIgnorePatterns = ["**/test/**", "**/test_dir/**"]
10 changes: 6 additions & 4 deletions packages/nuekit/test/cmd/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { create, unzip, getLocalZip, fetchZip } from '../../src/cmd/create'
import { rm, readdir } from 'node:fs/promises'

const testdir = import.meta.dirname

// suppress console messages
jest.spyOn(console, 'log').mockImplementation(() => {})

Expand All @@ -10,7 +12,7 @@ afterEach(async () => {
})

test('getLocalZip', async () => {
const zip = await getLocalZip('minimal', 'cmd')
const zip = await getLocalZip('minimal', testdir)
expect(await zip.exists()).toBeTrue()
})

Expand All @@ -21,12 +23,12 @@ test.skip('fetchZip', async () => {

test('unzip', async () => {
const dir = 'minimal'
const zip = await getLocalZip(dir, 'cmd')
const zip = await getLocalZip(dir, testdir)
await unzip(dir, zip)
const files = await readdir(dir)
expect(files).toEqual([ "index.html", "index.css" ])
})

test('create', async () => {
expect(await create('minimal', { dir: 'cmd' })).toBeTrue()
})
expect(await create('minimal', { dir: testdir })).toBeTrue()
})
7 changes: 4 additions & 3 deletions packages/nuekit/test/render/svg.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

import { renderFonts, renderHMR, renderSVG, convertHTMLTag } from '../../src/render/svg'

const testfile = import.meta.filename

test('renderFont / inlined', async () => {
const [ css ] = await renderFonts({ Test: 'render/svg.test.js' })
const [ css ] = await renderFonts({ Test: testfile })
expect(css).toInclude('data:font/woff2;base64')
expect(css.length).toBeGreaterThan(200)
expect(css).toInclude('@font-face')
Expand Down Expand Up @@ -56,7 +57,7 @@ test('renderSVG', async () => {


// SVG
const svg = await renderSVG(asset, { fonts: { Test: 'render/svg.test.js' } })
const svg = await renderSVG(asset, { fonts: { Test: testfile } })
expect(svg).toInclude("url('data:font/woff2;base64")
expect(svg).toInclude(':root{--brand:#ccc}')
expect(svg).toInclude('</style></svg>')
Expand All @@ -78,4 +79,4 @@ test('custom <html> tag', () => {
expect(attr.length).toBe(4)
expect(children[0].attr[0].name).toEqual('xmlns')

})
})
1 change: 1 addition & 0 deletions packages/nuestate/test/state.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import { getPathData, getQueryData, renderPath, renderQuery, api, state } from '../src/state.js'

beforeAll(() => global.window = null)

describe('internal methods', () => {

Expand Down
Loading