Skip to content
Open
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
4 changes: 2 additions & 2 deletions packages/dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"start:plugin-serve": "node dist/bin.js --config demo/plugin-serve/config.mjs --open",
"start:static": "node dist/bin.js --config demo/static/config.mjs --open demo/static/",
"start:syntax": "node dist/bin.js --config demo/syntax/config.mjs --open demo/syntax/",
"test:node": "mocha \"test/**/*.test.mjs\" --reporter dot",
"test:watch": "mocha \"test/**/*.test.mjs\" --watch --watch-files src,test --reporter dot"
"test:node": "node --test --test-force-exit test/**/*.test.mjs",
"test:watch": "node --test --test-force-exit --watch test/**/*.test.mjs"
},
"files": [
"*.d.ts",
Expand Down
11 changes: 4 additions & 7 deletions packages/dev-server/test/integration.test.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { describe, it, before, after, beforeEach, afterEach } from 'node:test';
import puppeteer from 'puppeteer';
import path from 'path';
import { fileURLToPath } from 'url';

import { startDevServer } from '../index.mjs';

const dirname = path.dirname(fileURLToPath(import.meta.url));

const testCases = [
{
name: 'base-path',
Expand Down Expand Up @@ -53,23 +51,22 @@ describe('integration tests', () => {
});

for (const testCase of testCases) {
describe(`testcase ${testCase.name}`, function test() {
this.timeout(30000);
describe(`testcase ${testCase.name}`, { timeout: 30000 }, () => {
let server;

beforeEach(async () => {
server = await startDevServer({
autoExitProcess: false,
logStartMessage: false,
argv: ['--config', path.join(dirname, `../demo/${testCase.name}/config.mjs`)],
argv: ['--config', path.join(import.meta.dirname, `../demo/${testCase.name}/config.mjs`)],
});
});

afterEach(async () => {
await server.stop();
});

it('passes the in-browser tests', async function it() {
it('passes the in-browser tests', async () => {
const openPath = `/demo/${testCase.name}/`;
const browserPath = `http://${server.config.hostname}:${server.config.port}${openPath}`;
const page = await browser.newPage();
Expand Down
Loading