feat: add basic jest support (#35080)

PR Close #35080
This commit is contained in:
JiaLiPassion
2020-02-01 00:08:40 +09:00
committed by Kara Erickson
parent f7e1c21596
commit daac33cdc8
8 changed files with 180 additions and 3 deletions

View File

@ -0,0 +1,39 @@
function assertInsideProxyZone() {
expect(Zone.current.name).toEqual('ProxyZone');
}
function assertInsideSyncDescribeZone() {
expect(Zone.current.name).toEqual('syncTestZone for jest.describe');
}
describe('describe', () => {
assertInsideSyncDescribeZone();
beforeEach(() => { assertInsideProxyZone(); });
beforeAll(() => { assertInsideProxyZone(); });
afterEach(() => { assertInsideProxyZone(); });
afterAll(() => { assertInsideProxyZone(); });
});
describe.each([[1, 2]])('describe.each', (arg1, arg2) => {
assertInsideSyncDescribeZone();
expect(arg1).toBe(1);
expect(arg2).toBe(2);
});
describe('test', () => {
it('it', () => { assertInsideProxyZone(); });
it.each([[1, 2]])('it.each', (arg1, arg2) => {
assertInsideProxyZone();
expect(arg1).toBe(1);
expect(arg2).toBe(2);
});
test('test', () => { assertInsideProxyZone(); });
test.each([[]])('test.each', () => { assertInsideProxyZone(); });
});
it('it', () => { assertInsideProxyZone(); });
it.each([[1, 2]])('it.each', (arg1, arg2) => {
assertInsideProxyZone();
expect(arg1).toBe(1);
expect(arg2).toBe(2);
});
test('test', () => { assertInsideProxyZone(); });
test.each([[]])('test.each', () => { assertInsideProxyZone(); });
test.todo('todo');