Files
yoga/javascript/jest.config.ts
Nick Gerleman 149849d22b Move generated Jest tests to TypeScript (#1287)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1287

Outputs tests as TypeScript, along with using/testing the new form of enums imported directly from the package.

We need to change how we are telling Jest which variant to run, so that tests can import enums from "yoga-layout" and have it resolve to the entrypoint which has a binary which has already been built.

Reviewed By: yungsters

Differential Revision: D45723545

fbshipit-source-id: 887d929344a78cadec159a07c643b74b76b87c6c
2023-05-10 22:46:39 -07:00

28 lines
698 B
TypeScript

/**
* 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.
*
* @format
*/
import type {Config} from 'jest';
const config: Config = {
setupFiles: ['./jest.setup.ts'],
testRegex: '/tests/.*\\.test\\.[jt]s$',
moduleNameMapper: {
'yoga-layout':
process.env['SYNC'] === '1' && process.env['WASM'] === '1'
? 'yoga-layout/wasm-sync'
: process.env['SYNC'] === '1'
? 'yoga-layout/asmjs-sync'
: process.env['WASM'] === '1'
? 'yoga-layout/wasm-async'
: 'yoga-layout/asmjs-async',
},
};
export default config;