diff --git a/src/core/errors/validation-error.ts b/src/core/errors/validation-error.ts index e7279f63f29..c8386082f59 100644 --- a/src/core/errors/validation-error.ts +++ b/src/core/errors/validation-error.ts @@ -13,13 +13,14 @@ export class ValidationError extends Error { this.buildError(error.err); } if (error.type === 'invalid-file') { - this.message = `❌ There is no file or context with the name "${error.filepath}". Please check the path and try again.`; + this.message = `There is no file or context with name "${error.filepath}".`; } if (error.type === 'no-spec-found') { - this.message = '❌ Unable to perform validation. Please specify which AsyncAPI file should be validated.'; + this.message = 'Unable to perform validation. Specify what AsyncAPI file should be validated.\n\nThese are your options to specify in the CLI what AsyncAPI file should be used:\n- You can provide a path to the AsyncAPI file: asyncapi validate path/to/file/asyncapi.yml\n- You can also pass a saved context that points to your AsyncAPI file: asyncapi validate mycontext\n- In case you did not specify a context that you want to use, the CLI checks if there is a default context and uses it. To set default context run: asyncapi context use mycontext\n- In case you did not provide any reference to AsyncAPI file and there is no default context, the CLI detects if in your current working directory you have files like asyncapi.json, asyncapi.yaml, asyncapi.yml. Just rename your file accordingly.'; } this.name = 'ValidationError'; } + private buildError(err: any) { const errorsInfo: Array = []; diff --git a/test/integration/optimize.test.ts b/test/integration/optimize.test.ts index e0adbdec117..1f921e11669 100644 --- a/test/integration/optimize.test.ts +++ b/test/integration/optimize.test.ts @@ -34,7 +34,7 @@ describe('optimize', () => { .stdout() .command(['optimize', optimizedFilePath]) .it('works when file path is passed', (ctx, done) => { - expect(ctx.stdout).to.contain(`No optimization has been applied since ${optimizedFilePath} looks optimized!`); + expect(ctx.stdout).to.contain(`🎉 Great news! Your file at ${optimizedFilePath} is already optimized.`); expect(ctx.stderr).to.equal(''); done(); }); @@ -54,7 +54,7 @@ describe('optimize', () => { .stdout() .command(['optimize', 'http://localhost:8080/dummySpecWithoutSecurity.yml']) .it('works when url is passed', (ctx, done) => { - expect(ctx.stdout).to.contain('No optimization has been applied since http://localhost:8080/dummySpecWithoutSecurity.yml looks optimized!'); + expect(ctx.stdout).to.contain('🎉 Great news! Your file at http://localhost:8080/dummySpecWithoutSecurity.yml is already optimized.'); expect(ctx.stderr).to.equal(''); done(); }); @@ -75,7 +75,7 @@ describe('optimize', () => { .stdout() .command(['optimize']) .it('converts from current context', (ctx, done) => { - expect(ctx.stdout).to.contain(`No optimization has been applied since ${path.resolve(__dirname, '../fixtures/specification.yml')} looks optimized!`); + expect(ctx.stdout).to.contain(`🎉 Great news! Your file at ${path.resolve(__dirname, '../fixtures/specification.yml')} is already optimized.`); expect(ctx.stderr).to.equal(''); done(); });