From 93e6041ac8cfc9bd6a0c19bf225f5954c415adf4 Mon Sep 17 00:00:00 2001 From: Tre Date: Wed, 11 Sep 2019 15:10:47 -0600 Subject: [PATCH] [Plugin Generator] Enhance Integration Test (#45401) * Add the missing blank line. Add a test verify it. * Less code is the best code. Thanks Spencer :) --- .../integration_tests/generate_plugin.test.js | 9 ++++++++- .../sao_template/template/.i18nrc.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 220fce8b9337..18e161e0ce92 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -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 }); diff --git a/packages/kbn-plugin-generator/sao_template/template/.i18nrc.json b/packages/kbn-plugin-generator/sao_template/template/.i18nrc.json index 3fb283487789..1a8aea885387 100644 --- a/packages/kbn-plugin-generator/sao_template/template/.i18nrc.json +++ b/packages/kbn-plugin-generator/sao_template/template/.i18nrc.json @@ -6,3 +6,4 @@ "translations/zh-CN.json" ] } +