Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
// Copy dist folder
fs.copySync(
path.resolve(rootDir, 'dist'),
path.resolve(testCaseModuleFolder, 'dist')
);
});
}
createIntegrationMock();
const argv = process.argv.slice(2);
argv.push('--no-cache');
argv.push('--config', path.join(Paths.rootDir, 'jest.config.tests.js'));
jest.run(argv);
(args, rawArgv) => {
const rootDir = api.resolve('.');
// 获取默认配置
const defaultConfig = new DefaultConfigResolver(rootDir);
const configuration = new JestConfigurationBuilder(
defaultConfig,
new CustomConfigResolver()
).buildConfiguration(process.cwd());
rawArgv.push('--config', JSON.stringify(configuration));
// 未查找到测试文件正常退出
rawArgv.push('--passWithNoTests');
run(rawArgv)
.then((result) => {
debug(result);
})
.catch((e) => {
console.log(e);
});
}
);
const appDirectory = fs.realpathSync(process.cwd());
// Run Jest on the application files (./www/* & ./server/*)
const jest = require("jest");
let jestConfig = require("./config");
jestConfig.roots = [appDirectory];
delete jestConfig.collectCoverageFrom;
delete jestConfig.coverageDirectory;
delete jestConfig.reporters;
const jestCommand = [
"--env=jsdom",
"--watchAll",
"--config",
JSON.stringify(jestConfig)
];
jest.run(jestCommand);
bundler.on( 'buildEnd', () => {
jest.run( [
'--config',
'bin/jest.config.js',
'--rootDir',
resolve( __dirname, '..' ),
'--runInBand',
...process.argv.slice( 2 ),
] ).then( () => {
process.exit( 0 );
} ).catch( () => {
process.exit( 1 );
} );
} );
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import jest from 'jest';
jest.run(process.argv.slice(2));
if (Array.isArray(object) && Array.isArray(src)) {
return [...object, ...src];
}
if (typeof object === 'object' && typeof src === 'object') {
return {
...object,
...src,
};
}
});
const args = process.argv.slice(3);
const cliArgs = args.concat('--config', JSON.stringify(config));
if (args.includes('--help')) {
return jest.run(args);
}
return jest.run(cliArgs);
},
});
async function runJestCLI() {
const argv = await buildArgv();
//TODO: use runCLI to better determine the outcome
return run(argv);
}
server.listen(port, 'localhost', async () => {
await jest.run([
'--silent',
cli.flags.fail ? '' : '--updateSnapshot',
'--detectOpenHandles',
'--runTestsByPath'
].filter(Boolean).concat(testFiles));
if (!cli.flags.watch) {
server.close();
fs.removeSync(vrtDir);
}
});
run(builderConfig: BuilderConfiguration>): Observable {
const {options, root, sourceRoot} = builderConfig;
const workspaceRoot = this.context.workspace.root;
const configuration = this.jestConfigurationBuilder.buildConfiguration(root, sourceRoot, workspaceRoot, options.configPath);
delete options.configPath;
const argv = this.optionsConverter.convertToCliArgs(options);
argv.push('--config', JSON.stringify(configuration));
return from(jest.run(argv)).pipe(map(() => ({success: true})));
}