Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when packaging an extension with an unchanged README.md #392

Merged
merged 2 commits into from
Oct 11, 2019
Merged
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
2 changes: 1 addition & 1 deletion src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class MarkdownProcessor extends BaseProcessor {
let contents = await read(file);

if (/This is the README for your extension /.test(contents)) {
throw new Error(`Make sure to edit the README.md file before you publish your extension.`);
throw new Error(`Make sure to edit the README.md file before you package or publish your extension.`);
}

const markdownPathRegex = /(!?)\[([^\]\[]*|!\[[^\]\[]*]\([^\)]+\))\]\(([^\)]+)\)/g;
Expand Down
9 changes: 9 additions & 0 deletions src/test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1594,4 +1594,13 @@ describe('MarkdownProcessor', () => {

await throws(() => processor.onFile(readme));
});

it('should catch an unchanged README.md', async () => {
const manifest = { name: 'test', publisher: 'mocha', version: '0.0.1', engines: Object.create(null), repository: 'https://github.com/username/repository' };
const contents = `This is the README for your extension `;
const processor = new ReadmeProcessor(manifest, {});
const readme = { path: 'extension/readme.md', contents };

await throws(() => processor.onFile(readme));
})
});