[jest] Fix snapshot caused by environment (#118114)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-11-09 20:27:04 -08:00 committed by GitHub
parent ad1e2ad00b
commit 92ffb9e09a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,6 +80,7 @@ beforeEach(() => {
jest.clearAllMocks();
log.messages.length = 0;
process.execArgv = ['--inheritted', '--exec', '--argv'];
process.env.FORCE_COLOR = process.env.FORCE_COLOR || '1';
currentProc = undefined;
});
@ -117,13 +118,10 @@ afterEach(() => {
subscriptions.length = 0;
});
describe.skip('#run$', () => {
describe('#run$', () => {
it('starts the dev server with the right options', () => {
run(new DevServer(defaultOptions)).unsubscribe();
// ensure that FORCE_COLOR is in the env for consistency in snapshot
process.env.FORCE_COLOR = process.env.FORCE_COLOR || 'true';
expect(execa.node.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
@ -136,6 +134,7 @@ describe.skip('#run$', () => {
"env": Object {
"<inheritted process.env>": true,
"ELASTIC_APM_SERVICE_NAME": "kibana",
"FORCE_COLOR": "true",
"isDevCliChild": "true",
},
"nodeOptions": Array [