Skip to content

Commit

Permalink
[cli] Add test for readme.md with now.json and vercel.json (#4357)
Browse files Browse the repository at this point in the history
This PR adds a E2E test to make sure #4042 works correctly.
  • Loading branch information
styfle committed May 12, 2020
1 parent c23b9cc commit eec778b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/now-cli/test/helpers/prepare.js
Expand Up @@ -299,6 +299,14 @@ CMD ["node", "index.js"]`,
redirects: [{ source: `/(.*)`, destination: 'https://example.com/$1' }],
}),
},
'deploy-with-only-readme-now-json': {
'now.json': JSON.stringify({ version: 2 }),
'README.md': 'readme contents',
},
'deploy-with-only-readme-vercel-json': {
'vercel.json': JSON.stringify({ version: 2 }),
'README.md': 'readme contents',
},
'local-config-v2': {
[`main-${session}.html`]: '<h1>hello main</h1>',
[`test-${session}.html`]: '<h1>hello test</h1>',
Expand Down
38 changes: 38 additions & 0 deletions packages/now-cli/test/integration.js
Expand Up @@ -2823,3 +2823,41 @@ test('whoami with local .vercel scope', async t => {
// clean up
await remove(path.join(directory, '.vercel'));
});

test('deploys with only now.json and README.md', async t => {
const directory = fixture('deploy-with-only-readme-now-json');

const { exitCode, stderr, stdout } = await execa(
binaryPath,
[...defaultArgs, '--confirm'],
{
cwd: directory,
reject: false,
}
);

t.is(exitCode, 0, formatOutput({ stderr, stdout }));
const { host } = new URL(stdout);
const res = await fetch(`https://${host}/README.md`);
const text = await res.text();
t.regex(text, /readme contents/);
});

test('deploys with only vercel.json and README.md', async t => {
const directory = fixture('deploy-with-only-readme-vercel-json');

const { exitCode, stderr, stdout } = await execa(
binaryPath,
[...defaultArgs, '--confirm'],
{
cwd: directory,
reject: false,
}
);

t.is(exitCode, 0, formatOutput({ stderr, stdout }));
const { host } = new URL(stdout);
const res = await fetch(`https://${host}/README.md`);
const text = await res.text();
t.regex(text, /readme contents/);
});

0 comments on commit eec778b

Please sign in to comment.