[Plugin Generator] Enhance Integration Test (#45401)

* Add the missing blank line.
Add a test verify it.

* Less code is the best code.  Thanks Spencer :)
This commit is contained in:
Tre 2019-09-11 15:10:47 -06:00 committed by GitHub
parent 80c05bf928
commit 93e6041ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -21,7 +21,7 @@
import { spawn } from 'child_process';
import { resolve } from 'path';
import util from 'util';
import { stat } from 'fs';
import { stat, readFileSync } from 'fs';
import { snakeCase } from 'lodash';
import del from 'del';
import { withProcRunner, ToolingLog } from '@kbn/dev-utils';
@ -61,6 +61,13 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug
expect(stats.isDirectory()).toBe(true);
});
it(`should create an internationalization config file with a blank line appended to satisfy the parser`, async () => {
// Link to the error that happens when the blank line is not there:
// https://github.com/elastic/kibana/pull/45044#issuecomment-530092627
const intlFile = `${generatedPath}/.i18nrc.json`;
expect(readFileSync(intlFile, 'utf8').endsWith('\n\n')).toBe(true);
});
describe(`then running`, () => {
it(`'yarn test:browser' should exit 0`, async () => {
await execa('yarn', ['test:browser'], { cwd: generatedPath });

View file

@ -6,3 +6,4 @@
"translations/zh-CN.json"
]
}