/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
e2e/__tests__/errorOnDeprecated.test.ts
57 строк
2 KB
Simen Bekkhus
chore: use for..of instead of forEach (#14517)
19 сен 2023, 13:41
Не верифицирован
19 сен 2023, 13:41
5b56467
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {skipSuiteOnJestCircus} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; skipSuiteOnJestCircus(); const testFiles = [ 'fail.test.js', 'jasmine.addMatchers.test.js', 'jasmine.any.test.js', 'jasmine.anything.test.js', 'jasmine.arrayContaining.test.js', 'jasmine.createSpy.test.js', 'jasmine.objectContaining.test.js', 'jasmine.stringMatching.test.js', 'pending.test.js', 'spyOn.test.js', 'spyOnProperty.test.js', 'defaultTimeoutInterval.test.js', ]; const SHOULD_NOT_PASS_IN_JEST = new Set([ 'fail.test.js', 'spyOnProperty.test.js', ]); for (const testFile of testFiles) { test(`${testFile} errors in errorOnDeprecated mode`, () => { const result = runJest('error-on-deprecated', [ testFile, '--errorOnDeprecated', ]); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); expect(rest).toMatchSnapshot(); }); } for (const testFile of testFiles) { const shouldPass = SHOULD_NOT_PASS_IN_JEST.has(testFile); const expectation = `${testFile} ${shouldPass ? 'errors' : 'passes'}`; const testName = `${expectation} when not in errorOnDeprecated mode`; test(testName, () => { const result = runJest('error-on-deprecated', [testFile]); expect(result.exitCode).toBe(shouldPass ? 1 : 0); }); }