How to use inputFiles method in stryker-parent

Best JavaScript code snippet using stryker-parent

typescript-compiler.js

Source:typescript-compiler.js Github

copy

Full Screen

1const async = Npm.require('async');2const path = Npm.require('path');3const fs = Npm.require('fs');4const Future = Npm.require('fibers/future');5const {6 TSBuild,7 validateTsConfig,8 getExcludeRegExp,9} = Npm.require('meteor-typescript');10const {createHash} = Npm.require('crypto');11import {12 getExtendedPath,13 isDeclaration,14 isConfig,15 isMainConfig,16 isServerConfig,17 isBare,18 getES6ModuleName,19 WarnMixin,20 extendFiles,21 isWeb,22} from './file-utils';23import {24 getShallowHash,25} from './utils';26// Default exclude paths.27const defExclude = new RegExp(28 getExcludeRegExp(['node_modules/**']));29// What to exclude when compiling for the server.30// typings/main and typings/browser seem to be not used31// at all but let keep them for just in case.32const exlWebRegExp = new RegExp(33 getExcludeRegExp(['typings/main/**', 'typings/main.d.ts']));34// What to exclude when compiling for the client.35const exlMainRegExp = new RegExp(36 getExcludeRegExp(['typings/browser/**', 'typings/browser.d.ts']));37const COMPILER_REGEXP = /(\.d.ts|\.ts|\.tsx|\.tsconfig)$/;38const TS_REGEXP = /(\.ts|\.tsx)$/;39TypeScriptCompiler = class TypeScriptCompiler {40 constructor(extraOptions, maxParallelism) {41 TypeScript.validateExtraOptions(extraOptions);42 this.extraOptions = extraOptions;43 this.maxParallelism = maxParallelism || 10;44 this.serverOptions = null;45 this.tsconfig = TypeScript.getDefaultOptions();46 this.cfgHash = null;47 this.diagHash = new Set;48 this.archSet = new Set;49 }50 getFilesToProcess(inputFiles) {51 const pexclude = Logger.newProfiler('exclude');52 inputFiles = this._filterByDefault(inputFiles);53 this._processConfig(inputFiles);54 inputFiles = this._filterByConfig(inputFiles);55 if (inputFiles.length) {56 const arch = inputFiles[0].getArch();57 inputFiles = this._filterByArch(inputFiles, arch);58 }59 pexclude.end();60 return inputFiles;61 }62 getBuildOptions(inputFiles) {63 this._processConfig(inputFiles);64 const inputFile = inputFiles[0];65 let { compilerOptions } = this.tsconfig;66 // Make a copy.67 compilerOptions = Object.assign({}, compilerOptions);68 if (! isWeb(inputFile) && this.serverOptions) {69 Object.assign(compilerOptions, this.serverOptions);70 }71 // Apply extra options.72 if (this.extraOptions) {73 Object.assign(compilerOptions, this.extraOptions);74 }75 const arch = inputFile.getArch();76 const { typings, useCache } = this.tsconfig;77 return { arch, compilerOptions, typings, useCache };78 }79 processFilesForTarget(inputFiles, getDepsContent) {80 extendFiles(inputFiles, WarnMixin);81 const options = this.getBuildOptions(inputFiles);82 Logger.log('compiler options: %j', options.compilerOptions);83 inputFiles = this.getFilesToProcess(inputFiles);84 if (! inputFiles.length) return;85 const pcompile = Logger.newProfiler('compilation');86 const filePaths = inputFiles.map(file => getExtendedPath(file));87 Logger.log('compile files: %s', filePaths);88 const pbuild = Logger.newProfiler('tsBuild');89 const defaultGet = this._getContentGetter(inputFiles);90 const getContent = filePath =>91 (getDepsContent && getDepsContent(filePath)) || defaultGet(filePath);92 const tsBuild = new TSBuild(filePaths, getContent, options);93 pbuild.end();94 const pfiles = Logger.newProfiler('tsEmitFiles');95 const future = new Future;96 // Don't emit typings.97 const compileFiles = inputFiles.filter(file => ! isDeclaration(file));98 let throwSyntax = false;99 const results = new Map();100 async.eachLimit(compileFiles, this.maxParallelism, (file, done) => {101 const co = options.compilerOptions;102 const filePath = getExtendedPath(file);103 const pemit = Logger.newProfiler('tsEmit');104 const result = tsBuild.emit(filePath);105 results.set(file, result);106 pemit.end();107 throwSyntax = throwSyntax | 108 this._processDiagnostics(file, result.diagnostics, co);109 done();110 }, future.resolver());111 pfiles.end();112 future.wait();113 if (! throwSyntax) {114 results.forEach((result, file) => {115 const module = options.compilerOptions.module;116 this._addJavaScript(file, result, module === 'none');117 });118 }119 pcompile.end();120 }121 _getContentGetter(inputFiles) {122 const filesMap = new Map;123 inputFiles.forEach((inputFile, index) => {124 filesMap.set(getExtendedPath(inputFile), index);125 });126 return filePath => {127 let index = filesMap.get(filePath);128 if (index === undefined) {129 const filePathNoRootSlash = filePath.replace(/^\//, '');130 index = filesMap.get(filePathNoRootSlash);131 }132 return index !== undefined ?133 inputFiles[index].getContentsAsString() : null;134 };135 }136 _addJavaScript(inputFile, tsResult, forceBare) {137 const source = inputFile.getContentsAsString();138 const inputPath = inputFile.getPathInPackage();139 const outputPath = TypeScript.removeTsExt(inputPath) + '.js';140 const toBeAdded = {141 sourcePath: inputPath,142 path: outputPath,143 data: tsResult.code,144 hash: tsResult.hash,145 sourceMap: tsResult.sourceMap,146 bare: forceBare || isBare(inputFile)147 };148 inputFile.addJavaScript(toBeAdded);149 }150 _processDiagnostics(inputFile, diagnostics, tsOptions) {151 // Remove duplicated warnings for shared files152 // by saving hashes of already shown warnings.153 const reduce = (diagnostic, cb) => {154 let dob = {155 message: diagnostic.message,156 sourcePath: getExtendedPath(inputFile),157 line: diagnostic.line,158 column: diagnostic.column159 };160 const arch = inputFile.getArch();161 // TODO: find out how to get list of architectures.162 this.archSet.add(arch);163 let shown = false;164 for (const key of this.archSet.keys()) {165 if (key !== arch) {166 dob.arch = key;167 const hash = getShallowHash(dob);168 if (this.diagHash.has(hash)) {169 shown = true; break;170 }171 }172 }173 if (! shown) {174 dob.arch = arch;175 const hash = getShallowHash(dob);176 this.diagHash.add(hash);177 cb(dob);178 }179 }180 // Always throw syntax errors.181 const throwSyntax = !! diagnostics.syntacticErrors.length;182 diagnostics.syntacticErrors.forEach(diagnostic => {183 reduce(diagnostic, dob => {184 inputFile.error(dob);185 });186 });187 const packageName = inputFile.getPackageName();188 if (packageName) return throwSyntax;189 // And log out other errors except package files.190 if (tsOptions && tsOptions.diagnostics) {191 diagnostics.semanticErrors.forEach(diagnostic => {192 reduce(diagnostic, dob => inputFile.warn(dob));193 });194 }195 return throwSyntax;196 }197 _getFileModuleName(inputFile, options) {198 if (options.module === 'none') return null;199 return getES6ModuleName(inputFile);200 }201 _processConfig(inputFiles) {202 const tsFiles = inputFiles203 .map(inputFile => inputFile.getPathInPackage())204 .filter(filePath => TS_REGEXP.test(filePath));205 for (const inputFile of inputFiles) {206 // Parse root config.207 if (isMainConfig(inputFile)) {208 const source = inputFile.getContentsAsString();209 const hash = inputFile.getSourceHash();210 // If hashes differ, create new tsconfig. 211 if (hash !== this.cfgHash) {212 this.tsconfig = this._parseConfig(source, tsFiles);213 this.cfgHash = hash;214 }215 return;216 }217 // Parse server config.218 // Take only target and lib values.219 if (isServerConfig(inputFile)) {220 const source = inputFile.getContentsAsString();221 const { compilerOptions } = this._parseConfig(source, tsFiles);222 if (compilerOptions) {223 const { target, lib } = compilerOptions;224 this.serverOptions = { target, lib };225 }226 return;227 }228 }229 }230 _parseConfig(cfgContent, tsFiles) {231 let tsconfig = null;232 try {233 tsconfig = JSON.parse(cfgContent);234 // Define files since if it's not defined235 // validation throws an exception.236 const files = tsconfig.files || tsFiles;237 tsconfig.files = files;238 validateTsConfig(tsconfig);239 } catch(err) {240 throw new Error(`Format of the tsconfig is invalid: ${err}`);241 }242 const exclude = tsconfig.exclude || [];243 try {244 const regExp = getExcludeRegExp(exclude);245 tsconfig.exclude = regExp && new RegExp(regExp);246 } catch(err) {247 throw new Error(`Format of an exclude path is invalid: ${err}`);248 }249 return tsconfig;250 }251 _filterByDefault(inputFiles) {252 inputFiles = inputFiles.filter(inputFile => {253 const path = inputFile.getPathInPackage();254 return COMPILER_REGEXP.test(path) && ! defExclude.test('/' + path);255 });256 return inputFiles;257 }258 _filterByConfig(inputFiles) {259 let resultFiles = inputFiles;260 if (this.tsconfig.exclude) {261 resultFiles = resultFiles.filter(inputFile => {262 const path = inputFile.getPathInPackage();263 // There seems to an issue with getRegularExpressionForWildcard:264 // result regexp always starts with /.265 return ! this.tsconfig.exclude.test('/' + path);266 });267 }268 return resultFiles;269 }270 _filterByArch(inputFiles, arch) {271 check(arch, String);272 /**273 * Include only typings that current arch needs,274 * typings/main is for the server only and275 * typings/browser - for the client.276 */277 const filterRegExp = /^web/.test(arch) ? exlWebRegExp : exlMainRegExp;278 inputFiles = inputFiles.filter(inputFile => {279 const path = inputFile.getPathInPackage();280 return ! filterRegExp.test('/' + path);281 });282 return inputFiles;283 }...

Full Screen

Full Screen

typedoc.test.ts

Source:typedoc.test.ts Github

copy

Full Screen

1import { Application } from "..";2import * as Path from "path";3import Assert = require("assert");4import { Converter, Context } from "../lib/converter";5import { ModuleKind } from "typescript";6describe("TypeDoc", function () {7 let application: Application;8 describe("Application", function () {9 before("constructs", function () {10 application = new Application();11 });12 it("expands input directory", function () {13 const inputFiles = Path.join(__dirname, "converter", "class");14 const expanded = application.expandInputFiles([inputFiles]);15 Assert(expanded.includes(Path.join(inputFiles, "class.ts")));16 Assert(!expanded.includes(inputFiles));17 });18 it("expands input files", function () {19 const inputFiles = Path.join(20 __dirname,21 "converter",22 "class",23 "class.ts"24 );25 const expanded = application.expandInputFiles([inputFiles]);26 Assert(expanded.includes(inputFiles));27 });28 it("honors the exclude argument even on a fixed directory list", function () {29 const inputFiles = Path.join(__dirname, "converter", "class");30 application.options.setValue("exclude", ["**/class.ts"]);31 const expanded = application.expandInputFiles([inputFiles]);32 Assert(!expanded.includes(Path.join(inputFiles, "class.ts")));33 Assert(!expanded.includes(inputFiles));34 });35 it("honors the exclude argument even on a fixed file list", function () {36 const inputFiles = Path.join(37 __dirname,38 "converter",39 "class",40 "class.ts"41 );42 application.options.setValue("exclude", ["**/class.ts"]);43 const expanded = application.expandInputFiles([inputFiles]);44 Assert(!expanded.includes(inputFiles));45 });46 it("supports multiple excludes", function () {47 const inputFiles = Path.join(__dirname, "converter");48 application.options.setValue("exclude", ["**/+(class|access).ts"]);49 const expanded = application.expandInputFiles([inputFiles]);50 Assert(51 !expanded.includes(Path.join(inputFiles, "class", "class.ts"))52 );53 Assert(54 !expanded.includes(Path.join(inputFiles, "access", "access.ts"))55 );56 Assert(!expanded.includes(inputFiles));57 });58 it("supports array of excludes", function () {59 const inputFiles = Path.join(__dirname, "converter");60 application.options.setValue("exclude", [61 "**/class.ts",62 "**/access.ts",63 ]);64 const expanded = application.expandInputFiles([inputFiles]);65 Assert(66 !expanded.includes(Path.join(inputFiles, "class", "class.ts"))67 );68 Assert(69 !expanded.includes(Path.join(inputFiles, "access", "access.ts"))70 );71 Assert(!expanded.includes(inputFiles));72 });73 it("supports excluding directories beginning with dots", function () {74 const inputFiles = __dirname;75 application.options.setValue("exclude", ["**/+(.dot)/**"]);76 const expanded = application.expandInputFiles([inputFiles]);77 Assert(78 !expanded.includes(Path.join(inputFiles, ".dot", "index.ts"))79 );80 Assert(!expanded.includes(inputFiles));81 });82 it("Honors the exclude option even if a module is imported", () => {83 application.options.setValue("exclude", ["**/b.ts"]);84 application.options.setValue("module", ModuleKind.CommonJS);85 function handler(context: Context) {86 Assert.deepStrictEqual(context.fileNames, [87 Path.resolve(__dirname, "module", "a.ts").replace(88 /\\/g,89 "/"90 ),91 ]);92 }93 application.converter.once(Converter.EVENT_END, handler);94 application.convert([Path.join(__dirname, "module", "a.ts")]);95 });96 it("supports directory excludes", function () {97 const inputFiles = Path.join(__dirname, "converter");98 application.options.setValue("exclude", ["**/alias"]);99 const expanded = application.expandInputFiles([inputFiles]);100 Assert.strictEqual(101 expanded.includes(Path.join(inputFiles, "class", "class.ts")),102 true103 );104 Assert.strictEqual(105 expanded.includes(Path.join(inputFiles, "alias", "alias.ts")),106 false107 );108 Assert.strictEqual(expanded.includes(inputFiles), false);109 });110 it("supports negations in directory excludes", function () {111 const inputFiles = Path.join(__dirname, "converter");112 application.options.setValue("exclude", ["**/!(alias)/"]);113 const expanded = application.expandInputFiles([inputFiles]);114 Assert.strictEqual(115 expanded.includes(Path.join(inputFiles, "class", "class.ts")),116 false117 );118 Assert.strictEqual(119 expanded.includes(Path.join(inputFiles, "alias", "alias.ts")),120 true121 );122 Assert.strictEqual(expanded.includes(inputFiles), false);123 });124 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const inputFiles = require('stryker-parent').inputFiles;2const inputFiles = require('stryker-parent').inputFiles;3const inputFiles = require('stryker-parent').inputFiles;4const inputFiles = require('stryker-parent').inputFiles;5const inputFiles = require('stryker-parent').inputFiles;6const inputFiles = require('stryker-parent').inputFiles;7const inputFiles = require('stryker-parent').inputFiles;8const inputFiles = require('stryker-parent').inputFiles;9const inputFiles = require('stryker-parent').inputFiles;10const inputFiles = require('stryker-parent').inputFiles;11const inputFiles = require('stryker-parent').inputFiles;12const inputFiles = require('stryker-parent').inputFiles;13const inputFiles = require('stryker-parent').inputFiles;14const inputFiles = require('stryker-parent').inputFiles;15const inputFiles = require('stryker-parent').inputFiles;16const inputFiles = require('stryker-parent').inputFiles;17const inputFiles = require('stryker-parent').inputFiles;18const inputFiles = require('stryker-parent

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inputFiles } = require('stryker-parent');2const files = inputFiles();3const { inputFiles } = require('stryker-parent');4const files = inputFiles();5module.exports = function(config) {6 config.set({7 files: inputFiles()8 });9};10const { inputFiles } = require('stryker-parent');11const files = inputFiles();12const { inputFiles } = require('stryker-parent');13const files = inputFiles();14module.exports = function(config) {15 config.set({16 files: inputFiles()17 });18};19const { inputFiles } = require('stryker-parent');20const files = inputFiles();21const { inputFiles } = require('stryker-parent');22const files = inputFiles();23module.exports = function(config) {24 config.set({25 files: inputFiles()26 });27};28const { inputFiles } = require('stryker-parent');29const files = inputFiles();30const { inputFiles } = require('stryker-parent');31const files = inputFiles();32module.exports = function(config) {

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2const inputFiles = strykerParent.inputFiles;3module.exports = function (config) {4 config.set({5 mutate: inputFiles('src/**/*.js', 'test/**/*.js'),6 });7};8module.exports = function (config) {9 config.set({10 });11};12const strykerParent = require('stryker-parent');13const inputFiles = strykerParent.inputFiles;14module.exports = function (config) {15 config.set({16 mutate: inputFiles('src/**/*.js', 'test/**/*.js'),17 });18};19const strykerParent = require('stryker-parent');20const inputFiles = strykerParent.inputFiles;21module.exports = function (config) {22 config.set({23 mutate: inputFiles('src/**/*.js', 'test/**/*.js'),24 });25};26const strykerParent = require('stryker-parent');27const inputFiles = strykerParent.inputFiles;28module.exports = function (config) {29 config.set({30 mutate: inputFiles('src/**/*.js', 'test/**/*.js'),31 });32};33const strykerParent = require('stryker-parent');34const inputFiles = strykerParent.inputFiles;35module.exports = function (config) {36 config.set({37 mutate: inputFiles('src

Full Screen

Using AI Code Generation

copy

Full Screen

1const files = inputFiles();2console.log(files);3const files = inputFiles();4console.log(files);5module.exports = function(config) {6 config.set({7 });8};9module.exports = function(config) {10 config.set({11 });12};13I think you are confusing the inputFiles() method with the files property. The inputFiles() method is used to get the files that are included in the mutation testing. The files property is used to define the files that should be included in the mutation testing. For example, if you want to include all files in the src directory, you can use the following in your stryker.conf.js file:

Full Screen

Using AI Code Generation

copy

Full Screen

1const inputFiles = require('stryker-parent').inputFiles;2const files = inputFiles('src/**/*.js');3const inputFiles = require('stryker-parent').inputFiles;4const files = inputFiles('src/**/*.js');5const inputFiles = require('stryker-parent').inputFiles;6const files = inputFiles('src/**/*.js');7const inputFiles = require('stryker-parent').inputFiles;8const files = inputFiles('src/**/*.js');9const inputFiles = require('stryker-parent').inputFiles;10const files = inputFiles('src/**/*.js');11const inputFiles = require('stryker-parent').inputFiles;12const files = inputFiles('src/**/*.js');13const inputFiles = require('stryker-parent').inputFiles;14const files = inputFiles('src/**/*.js');15const inputFiles = require('stryker-parent').inputFiles;16const files = inputFiles('src/**/*.js');17const inputFiles = require('stryker-parent').inputFiles;18const files = inputFiles('src/**/*.js');19const inputFiles = require('stryker-parent').inputFiles;20const files = inputFiles('src/**/*.js');21const inputFiles = require('stryker-parent').inputFiles;22const files = inputFiles('src/**/*.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inputFiles } = require('stryker-parent');2inputFiles.forEach(file => {3 console.log(file);4});5const { inputFiles } = require('./index');6inputFiles.forEach(file => {7 console.log(file);8});9const { inputFiles } = require('stryker-parent');10inputFiles.forEach(file => {11 console.log(file);12});13const { inputFiles } = require('stryker-parent');14inputFiles.forEach(file => {15 console.log(file);16});17const { inputFiles } = require('stryker-parent');18inputFiles.forEach(file => {19 console.log(file);20});21const { inputFiles } = require('stryker-parent');22inputFiles.forEach(file => {

Full Screen

Using AI Code Generation

copy

Full Screen

1var inputFiles = require('stryker-parent').inputFiles;2var files = inputFiles('test', __dirname, 'test.js');3var inputFiles = require('stryker-parent').inputFiles;4var files = inputFiles('test', __dirname, 'test.js');5var inputFiles = require('stryker-parent').inputFiles;6var files = inputFiles('test', __dirname, 'test.js');7var inputFiles = require('stryker-parent').inputFiles;8var files = inputFiles('test', __dirname, 'test.js');9var inputFiles = require('stryker-parent').inputFiles;10var files = inputFiles('test', __dirname, 'test.js');11var inputFiles = require('stryker-parent').inputFiles;12var files = inputFiles('test', __dirname, 'test.js');13var inputFiles = require('stryker-parent').inputFiles;14var files = inputFiles('test', __dirname, 'test.js');15var inputFiles = require('stryker-parent').inputFiles;16var files = inputFiles('test', __dirname, 'test.js');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful