Skip to content

Commit

Permalink
Show an error message when no files match the expected pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Aug 27, 2021
1 parent 1927dc0 commit 322f111
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commands/shoot.ts
Expand Up @@ -13,12 +13,13 @@ export async function shootCommand(options: {
}) {
const config = await readConfig(options.config);
const port = await getPort();
const stopRenderer = await startRenderer({
...config,
port,
});
let stopRenderer = async () => {};
let screenshotPaths: string[];
try {
stopRenderer = await startRenderer({
...config,
port,
});
screenshotPaths = await config.shooter.shoot(`http://localhost:${port}`);
} catch (e) {
return fail(`${e}`);
Expand Down
5 changes: 5 additions & 0 deletions src/renderer.ts
Expand Up @@ -28,6 +28,11 @@ export async function startRenderer(options: {
ignore: "**/node_modules/**",
cwd: options.projectPath,
});
if (relativeFilePaths.length === 0) {
throw new Error(
`No files found matching pattern: ${options.filePathPattern}`
);
}
const frameworkConfig = (() => {
const frameworkType = options.framework.type;
switch (options.framework.type) {
Expand Down

0 comments on commit 322f111

Please sign in to comment.