Summary: Right now, if you are changing something in one of the modules, e.g. in "flipper-plugin", you'll need to compile the changed module using `tsc` before running tests, otherwise `jest` won't pick up the changes. `yarn test` has a step to run `tsc` before tests, however when tests are started simply by `jest` command, e.g. by VSCode plugin, then `tsc` is not automatically called before tests. This diff makes things easier by configuring `jest` to automatically transpile imported modules. This means simply running `jest` command will automatically pick up and automatically transpile all the changes. Reviewed By: passy Differential Revision: D28310318 fbshipit-source-id: 77e9b91daa59a46ce64b1b70eb9a998d7b72de00
27 lines
818 B
JavaScript
27 lines
818 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
module.exports = {
|
|
transform: {
|
|
'^.*__tests__(/|\\\\).*\\.tsx?$': 'ts-jest',
|
|
'\\.(js|tsx?)$': '<rootDir>/scripts/jest-transform.js',
|
|
},
|
|
setupFiles: ['<rootDir>/scripts/jest-setup.js'],
|
|
moduleNameMapper: {
|
|
'^flipper$': '<rootDir>/app/src',
|
|
'^flipper-plugin$': '<rootDir>/flipper-plugin/src',
|
|
'^flipper-(pkg|pkg-lib|doctor|test-utils)$': '<rootDir>/$1/src',
|
|
},
|
|
clearMocks: true,
|
|
coverageReporters: ['json-summary', 'lcov', 'html'],
|
|
testMatch: ['**/**.(node|spec).(js|jsx|ts|tsx)'],
|
|
testEnvironment: 'jest-environment-jsdom-sixteen',
|
|
resolver: '<rootDir>/jest.resolver.js',
|
|
};
|