mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Rewrite brittle test to more resilient, ignoring FORCE_COLOR (#187539)
## Summary
We've seen the tests go both ways on the new infra. Sometimes the
received object would have, sometimes it wouldn't have `FORCE_COLOR`.
The value comes from here:
41eb6e2b12/packages/kbn-cli-dev-mode/src/using_server_process.ts (L39)
- meaning `process.stdout.isTTY` is not always true?
Here, it fails because the snapshot doesn't have the flag:
https://buildkite.com/elastic/kibana-on-merge/builds/47027#01907bbb-3fae-48c4-95ca-85118ba2c2b8
Here, it because the snapshot has the flag:
https://buildkite.com/elastic/kibana-pull-request/builds/219429
This PR tries to ignore that part of the received object.
This commit is contained in:
parent
668b6d2b41
commit
05443dc383
1 changed files with 11 additions and 25 deletions
|
@ -122,31 +122,17 @@ describe('#run$', () => {
|
|||
it('starts the dev server with the right options', () => {
|
||||
run(new DevServer(defaultOptions)).unsubscribe();
|
||||
|
||||
expect(execa.node.mock.calls).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
"some/script",
|
||||
Array [
|
||||
"foo",
|
||||
"bar",
|
||||
"--logging.json=false",
|
||||
],
|
||||
Object {
|
||||
"env": Object {
|
||||
"<inheritted process.env>": true,
|
||||
"ELASTIC_APM_SERVICE_NAME": "kibana",
|
||||
"isDevCliChild": "true",
|
||||
},
|
||||
"nodeOptions": Array [
|
||||
"--inheritted",
|
||||
"--exec",
|
||||
"--argv",
|
||||
],
|
||||
"stdio": "pipe",
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
expect(execa.node.mock.calls).toBeDefined();
|
||||
|
||||
const [scriptName, scriptArgs, execaOptions] = execa.node.mock.calls[0];
|
||||
|
||||
expect(scriptName).toBe('some/script');
|
||||
expect(scriptArgs).toEqual(['foo', 'bar', '--logging.json=false']);
|
||||
expect(execaOptions).toMatchObject({
|
||||
env: expect.objectContaining({ ELASTIC_APM_SERVICE_NAME: 'kibana', isDevCliChild: 'true' }),
|
||||
nodeOptions: ['--inheritted', '--exec', '--argv'],
|
||||
stdio: 'pipe',
|
||||
});
|
||||
});
|
||||
|
||||
it('writes stdout and stderr lines to logger', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue