🎥 Make videos programmatically with React
improve structure of tests to better discover failing tests
Calvin Falter03a27c1a0f0d
diff --git a/packages/core/src/test/pixel-format.test.ts b/packages/core/src/test/pixel-format.test.tsindex 9199fab053..4dace37be1 100644--- a/packages/core/src/test/pixel-format.test.ts+++ b/packages/core/src/test/pixel-format.test.ts@@ -7,7 +7,7 @@ import {} from '../config/pixel-format';import {expectToThrow} from './expect-to-throw';-test('pixel-format tests setPixelFormat', () => {+describe('pixel-format tests setPixelFormat', () => {// input formatconst validPixelFormats: PixelFormat[] = ['yuv420p',@@ -18,23 +18,26 @@ test('pixel-format tests setPixelFormat', () => {'yuv422p10le','yuv444p10le',];- validPixelFormats.forEach((entry) => {- setPixelFormat(entry);- expect(getPixelFormat()).toEqual(entry);- });+ validPixelFormats.forEach((entry) =>+ test(`test for ${entry}`, () => {+ setPixelFormat(entry);+ expect(getPixelFormat()).toEqual(entry);+ })+ );// input formatconst invalidPixelFormats = ['abc', '', 3, undefined];invalidPixelFormats.forEach((entry) =>- expectToThrow(- // @ts-expect-error- () => setPixelFormat(entry),- new RegExp(`Value ${entry} is not valid as a pixel format.`)- )+ test(`test for invalid input ${entry}`, () =>+ expectToThrow(+ // @ts-expect-error+ () => setPixelFormat(entry),+ new RegExp(`Value ${entry} is not valid as a pixel format.`)+ )));});-test('pixel-format tests validateSelectedPixelFormatAndCodecCombination', () => {+describe('pixel-format tests validateSelectedPixelFormatAndCodecCombination', () => {const formats: PixelFormat[] = ['yuv420p','yuv422p',@@ -48,32 +51,36 @@ test('pixel-format tests validateSelectedPixelFormatAndCodecCombination', () =>formats.forEach((f) =>codecs.forEach((c) =>- expect(() =>- validateSelectedPixelFormatAndCodecCombination(f, c)- ).not.toThrow()+ test(`test for valid combination ${f} and ${c}`, () =>+ expect(() =>+ validateSelectedPixelFormatAndCodecCombination(f, c)+ ).not.toThrow())));const invalidCodecs: Codec[] = ['h264', 'h265'];invalidCodecs.forEach((entry) =>- expectToThrow(- () => validateSelectedPixelFormatAndCodecCombination('yuva420p', entry),- /Pixel format was set to 'yuva420p' but codec is not 'vp8' or 'vp9'. To render videos with alpha channel, you must choose a codec that supports it./- )+ test(`test for invalid combination yuva420p and ${entry}`, () =>+ expectToThrow(+ () => validateSelectedPixelFormatAndCodecCombination('yuva420p', entry),+ /Pixel format was set to 'yuva420p' but codec is not 'vp8' or 'vp9'. To render videos with alpha channel, you must choose a codec that supports it./+ )));const validCodecs: Codec[] = ['vp8', 'vp9'];validCodecs.forEach((c) =>- expect(() =>- validateSelectedPixelFormatAndCodecCombination('yuva420p', c)- ).not.toThrow()+ test(`test for valid combination yuva420p and ${c}`, () =>+ expect(() =>+ validateSelectedPixelFormatAndCodecCombination('yuva420p', c)+ ).not.toThrow()));const invalidFormats = ['abc', '', 3];invalidFormats.forEach((entry) =>- expectToThrow(- // @ts-expect-error- () => validateSelectedPixelFormatAndCodecCombination(entry, 'h264'),- new RegExp(`Value ${entry} is not valid as a pixel format.`)- )+ test(`test for invalid input "${entry}"`, () =>+ expectToThrow(+ // @ts-expect-error+ () => validateSelectedPixelFormatAndCodecCombination(entry, 'h264'),+ new RegExp(`Value ${entry} is not valid as a pixel format.`)+ )));});