diff options
author | 2021-04-22 08:25:57 -0400 | |
---|---|---|
committer | 2021-04-22 08:25:57 -0400 | |
commit | da033e27eada3bbcad5544be282e9edcf4799003 (patch) | |
tree | 8fa1203d4e318f006d254abff79caa2508a86fd2 /test/helpers.js | |
parent | a7185735da7413e132f313ff5086db74304d7654 (diff) | |
download | astro-da033e27eada3bbcad5544be282e9edcf4799003.tar.gz astro-da033e27eada3bbcad5544be282e9edcf4799003.tar.zst astro-da033e27eada3bbcad5544be282e9edcf4799003.zip |
CLI docs (#121)
* Start of cli docs
* Document the CLI
Also adds support for the `--config` option and `--port` option for the dev server.
* Add tests for --config and --port flags
* Add port to validateConfig
Diffstat (limited to 'test/helpers.js')
-rw-r--r-- | test/helpers.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/helpers.js b/test/helpers.js index 8ca42ea11..eb7cabb0b 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -4,6 +4,8 @@ import { readFile } from 'fs/promises'; import { createRuntime } from '../lib/runtime.js'; import { loadConfig } from '../lib/config.js'; import * as assert from 'uvu/assert'; +import execa from 'execa'; + /** setup fixtures for tests */ export function setup(Suite, fixturePath) { let runtime, setupError; @@ -62,3 +64,10 @@ export function setupBuild(Suite, fixturePath) { assert.equal(setupError, undefined); }); } + +const cliURL = new URL('../astro.mjs', import.meta.url); +export function runDevServer(root, additionalArgs = []) { + const args = [cliURL.pathname, 'dev', '--project-root', root.pathname].concat(additionalArgs); + const proc = execa('node', args); + return proc; +}
\ No newline at end of file |