Skip to content

Commit

Permalink
fix: enable test mode for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 11, 2021
1 parent 7bb8dc8 commit afd20b7
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions core/jest-extract/src/run-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,33 @@ const runTestsWorker: fastq.asyncWorker<
globalConfig: Config.GlobalConfig;
};
try {
runResults = await runCLI(
{
rootDir: projectFolder,
testRegex: testFiles,
forceExit: true,
testPathIgnorePatterns: ['/node_modules/', '/__snapshots__/'],
silent: true,
testTimeout: 100000,
reporters: [],
coverage: true,
coverageReporters: ['none'],
watchman: false,
collectCoverageFrom: [
'**/*.{js,jsx,tsx,ts}',
'!**/jest.config.js',
'!**/*.{test,spec}.{js,jsx,tsx,ts}',
],
...options,
} as Config.Argv,
[projectFolder],
);
const nodeEnv = process.env.NODE_ENV;
process.env.NODE_ENV = 'test';
try {
runResults = await runCLI(
{
rootDir: projectFolder,
testRegex: testFiles,
forceExit: true,
testPathIgnorePatterns: ['/node_modules/', '/__snapshots__/'],
silent: true,
testTimeout: 100000,
reporters: [],
coverage: true,
coverageReporters: ['none'],
watchman: false,
collectCoverageFrom: [
'**/*.{js,jsx,tsx,ts}',
'!**/jest.config.js',
'!**/*.{test,spec}.{js,jsx,tsx,ts}',
],
...options,
} as Config.Argv,
[projectFolder],
);
} finally {
process.env.NODE_ENV = nodeEnv;
}
} catch (err) {
error(testFiles[0], err);
return undefined;
Expand Down

0 comments on commit afd20b7

Please sign in to comment.