dea1a6dfc9
* chore: update defaults in docs * chore: update config defaults * test: update tests to config defaults * chore: update gitignore to new defaults * docs: update readme to new defaults * chore: update examples to new defaults * chore: update default exclude in lang server * chore: update tests * test: fix failing tests * chore: update www defaults
29 lines
841 B
JavaScript
29 lines
841 B
JavaScript
import { suite } from 'uvu';
|
|
import * as assert from 'uvu/assert';
|
|
import { runDevServer } from './helpers.js';
|
|
import { loadConfig } from '../lib/config.js';
|
|
|
|
const ConfigPort = suite('Config path');
|
|
|
|
const root = new URL('./fixtures/config-port/', import.meta.url);
|
|
ConfigPort('can be specified in the astro config', async (context) => {
|
|
const astroConfig = await loadConfig(root.pathname);
|
|
assert.equal(astroConfig.devOptions.port, 3001);
|
|
});
|
|
|
|
ConfigPort('can be specified via --port flag', async (context) => {
|
|
const args = ['--port', '3002'];
|
|
const process = runDevServer(root, args);
|
|
|
|
process.stdout.setEncoding('utf8');
|
|
for await (const chunk of process.stdout) {
|
|
if(/Local:/.test(chunk)) {
|
|
assert.ok(/:3002/.test(chunk), 'Using the right port');
|
|
break;
|
|
}
|
|
}
|
|
|
|
process.kill();
|
|
});
|
|
|
|
ConfigPort.run();
|