fix(test-runner): set expand: false for expect. (#7722)

This commit is contained in:
Joel Einbinder 2021-07-19 11:59:53 -05:00 committed by GitHub
parent 642d6d4459
commit 0cf9cf0829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -58,3 +58,4 @@ function toMatchSnapshot(this: ReturnType<Expect['getState']>, received: Buffer
} }
expectLibrary.extend({ toMatchSnapshot }); expectLibrary.extend({ toMatchSnapshot });
expectLibrary.setState({ expand: false });

View File

@ -125,3 +125,20 @@ test('should work with custom PlaywrightTest namespace', async ({runTSC}) => {
}); });
expect(result.exitCode).toBe(0); expect(result.exitCode).toBe(0);
}); });
test('should not expand huge arrays', async ({runInlineTest}) => {
const result = await runInlineTest({
'expect-test.spec.ts': `
const { test } = pwt;
test('numeric ranges', () => {
const a1 = Array(100000).fill(1);
const a2 = Array(100000).fill(1);
a2[500] = 2;
test.expect(a1).toEqual(a2);
});
`
});
expect(result.exitCode).toBe(1);
expect(result.passed).toBe(0);
expect(result.output.length).toBeLessThan(100000);
});