From c004324c0c355390b154d6db63cca74f3e805e39 Mon Sep 17 00:00:00 2001 From: yinm Date: Fri, 28 Jul 2023 17:40:52 +0900 Subject: [PATCH] test: add e2e tests for adding `mts` and `cts` to default `moduleFileExtensions` config --- e2e/__tests__/testMatchTs.test.ts | 16 ++++++++++++++++ e2e/test-match-ts/__tests__/sample-suite.mts | 10 ++++++++++ e2e/test-match-ts/__tests__/sample-suite2.cts | 10 ++++++++++ e2e/test-match-ts/package.json | 7 +++++++ 4 files changed, 43 insertions(+) create mode 100644 e2e/__tests__/testMatchTs.test.ts create mode 100644 e2e/test-match-ts/__tests__/sample-suite.mts create mode 100644 e2e/test-match-ts/__tests__/sample-suite2.cts create mode 100644 e2e/test-match-ts/package.json diff --git a/e2e/__tests__/testMatchTs.test.ts b/e2e/__tests__/testMatchTs.test.ts new file mode 100644 index 000000000000..e6af02cc5cc7 --- /dev/null +++ b/e2e/__tests__/testMatchTs.test.ts @@ -0,0 +1,16 @@ +/** + * 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 {extractSummary} from '../Utils'; +import runJest from '../runJest'; + +it('testMatch should able to match file with cts and mts extension', () => { + const result = runJest('test-match-ts'); + expect(result.exitCode).toBe(0); + const {summary} = extractSummary(result.stderr); + expect(summary).toMatchSnapshot(); +}); diff --git a/e2e/test-match-ts/__tests__/sample-suite.mts b/e2e/test-match-ts/__tests__/sample-suite.mts new file mode 100644 index 000000000000..9c58cacc90ec --- /dev/null +++ b/e2e/test-match-ts/__tests__/sample-suite.mts @@ -0,0 +1,10 @@ +/** + * 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. + */ + +test('mts extension', () => { + expect(1).toBe(1); +}); diff --git a/e2e/test-match-ts/__tests__/sample-suite2.cts b/e2e/test-match-ts/__tests__/sample-suite2.cts new file mode 100644 index 000000000000..5a27bdb1cc01 --- /dev/null +++ b/e2e/test-match-ts/__tests__/sample-suite2.cts @@ -0,0 +1,10 @@ +/** + * 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. + */ + +test('cts extension', () => { + expect(1).toBe(1); +}); diff --git a/e2e/test-match-ts/package.json b/e2e/test-match-ts/package.json new file mode 100644 index 000000000000..19272f0febb0 --- /dev/null +++ b/e2e/test-match-ts/package.json @@ -0,0 +1,7 @@ +{ + "jest": { + "testMatch": [ + "**/__tests__/*.?ts" + ] + } +}