Skip to content

Commit

Permalink
test: don't open link on test, basic create cli testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Aug 14, 2024
1 parent c5f0391 commit 260f120
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/nuekit/src/create.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { exec, execSync } from 'node:child_process'
import { execSync } from 'node:child_process'
import { promises as fs, existsSync } from 'node:fs'
import { join } from 'node:path'

import { openUrl } from './util.js'
import { createKit } from './nuekit.js'

async function serve(root) {
async function serve(root, debug) {
const nue = await createKit({ root })
const terminate = await nue.serve()

// open welcome page
exec(`${openUrl} http://localhost:${nue.port}/welcome/`)
if (!debug) execSync(`${openUrl} http://localhost:${nue.port}/welcome/`)
return terminate
}

Expand Down Expand Up @@ -49,5 +49,5 @@ export async function create({ root, name = 'simple-blog' }) {
await fs.rm(archive_name)

// serve
return await serve(root)
return await serve(root, debug)
}
12 changes: 6 additions & 6 deletions packages/nuekit/test/misc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ import { lightningCSS } from '../src/builder.js'
import { create } from '../src/create.js'
import { getArgs } from '../src/cli.js'

import { toMatchPath } from './match-path.js'

import { promises as fs } from 'node:fs'

expect.extend({ toMatchPath })

// temporary directory
const root = '_test'

Expand Down Expand Up @@ -60,6 +56,10 @@ test('path parts', () => {


test('create', async () => {
const terminate = await create({ root, name: 'test' })
terminate()
const terminate = await create({ root, name: 'test' })
terminate()

const contents = await fs.readdir(root)
expect(contents).toContain('index.md') // should be unpacked to correct dir
expect(contents).toContain('.dist') // should be built
})

0 comments on commit 260f120

Please sign in to comment.