Fix instrument tests

This commit is contained in:
Nathan Bierema 2020-08-01 23:53:54 -04:00
parent 277e1fd7a0
commit f179510bf8
2 changed files with 5 additions and 7 deletions

View File

@ -80,7 +80,7 @@ export const ActionCreators = {
stack = frames stack = frames
.slice( .slice(
0, 0,
traceLimit + extraFrames + (frames[0] === 'Error' ? 1 : 0) traceLimit + extraFrames + (frames[0].startsWith('Error') ? 1 : 0)
) )
.join('\n'); .join('\n');
} }

View File

@ -827,10 +827,9 @@ describe('instrument', () => {
exportedState = monitoredLiftedStore.getState(); exportedState = monitoredLiftedStore.getState();
expect(exportedState.actionsById[0].stack).toBe(undefined); expect(exportedState.actionsById[0].stack).toBe(undefined);
expect(typeof exportedState.actionsById[1].stack).toBe('string'); expect(typeof exportedState.actionsById[1].stack).toBe('string');
expect(exportedState.actionsById[1].stack).toMatch(/\bat dispatch\b/);
expect(exportedState.actionsById[1].stack).toMatch(/\bfn1\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn1\b/);
expect(exportedState.actionsById[1].stack).toMatch(/\bfn2\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn2\b/);
expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn3\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn3\b/);
expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn4\b/); expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn4\b/);
expect(exportedState.actionsById[1].stack).toContain( expect(exportedState.actionsById[1].stack).toContain(
'instrument.spec.js' 'instrument.spec.js'
@ -865,10 +864,9 @@ describe('instrument', () => {
exportedState = monitoredLiftedStore.getState(); exportedState = monitoredLiftedStore.getState();
expect(exportedState.actionsById[0].stack).toBe(undefined); expect(exportedState.actionsById[0].stack).toBe(undefined);
expect(typeof exportedState.actionsById[1].stack).toBe('string'); expect(typeof exportedState.actionsById[1].stack).toBe('string');
expect(exportedState.actionsById[1].stack).toMatch(/\bat dispatch\b/);
expect(exportedState.actionsById[1].stack).toMatch(/\bfn1\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn1\b/);
expect(exportedState.actionsById[1].stack).toMatch(/\bfn2\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn2\b/);
expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn3\b/); expect(exportedState.actionsById[1].stack).toMatch(/\bfn3\b/);
expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn4\b/); expect(exportedState.actionsById[1].stack).not.toMatch(/\bfn4\b/);
expect(exportedState.actionsById[1].stack).toContain( expect(exportedState.actionsById[1].stack).toContain(
'instrument.spec.js' 'instrument.spec.js'
@ -985,7 +983,7 @@ describe('instrument', () => {
exportedState = monitoredLiftedStore.getState(); exportedState = monitoredLiftedStore.getState();
expect(exportedState.actionsById[0].stack).toBe(undefined); expect(exportedState.actionsById[0].stack).toBe(undefined);
expect(typeof exportedState.actionsById[1].stack).toBe('string'); expect(typeof exportedState.actionsById[1].stack).toBe('string');
expect(exportedState.actionsById[1].stack).toContain('at performAction'); expect(exportedState.actionsById[1].stack).toContain('at Object.performAction');
expect(exportedState.actionsById[1].stack).toContain('instrument.js'); expect(exportedState.actionsById[1].stack).toContain('instrument.js');
expect(exportedState.actionsById[1].stack).toContain( expect(exportedState.actionsById[1].stack).toContain(
'instrument.spec.js' 'instrument.spec.js'
@ -1007,7 +1005,7 @@ describe('instrument', () => {
expect(exportedState.actionsById[0].stack).toBe(undefined); expect(exportedState.actionsById[0].stack).toBe(undefined);
expect(typeof exportedState.actionsById[1].stack).toBe('string'); expect(typeof exportedState.actionsById[1].stack).toBe('string');
expect(exportedState.actionsById[1].stack).toContain( expect(exportedState.actionsById[1].stack).toContain(
'at performAction' 'at Object.performAction'
); );
expect(exportedState.actionsById[1].stack).toContain('instrument.js'); expect(exportedState.actionsById[1].stack).toContain('instrument.js');
expect(exportedState.actionsById[1].stack).toContain( expect(exportedState.actionsById[1].stack).toContain(