How to use tsconfigInput method in stryker-parent

Best JavaScript code snippet using stryker-parent

ts-config-preprocessor.spec.ts

Source:ts-config-preprocessor.spec.ts Github

copy

Full Screen

1import path from 'path';2import { expect } from 'chai';3import { testInjector } from '@stryker-mutator/test-helpers';4import { TSConfigPreprocessor } from '../../../src/sandbox/ts-config-preprocessor.js';5import { FileSystemTestDouble } from '../../helpers/file-system-test-double.js';6import { Project } from '../../../src/fs/project.js';7import { serializeTSConfig } from '../../helpers/producers.js';8describe(TSConfigPreprocessor.name, () => {9 let fsTestDouble: FileSystemTestDouble;10 let sut: TSConfigPreprocessor;11 const tsconfigFileName = path.resolve('tsconfig.json');12 beforeEach(() => {13 fsTestDouble = new FileSystemTestDouble();14 sut = testInjector.injector.injectClass(TSConfigPreprocessor);15 });16 it('should not do anything if the tsconfig file does not exist', async () => {17 fsTestDouble.files['foo.js'] = 'console.log("foo");';18 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());19 await sut.preprocess(project);20 expect(project.files.size).eq(1);21 expect(await project.files.get('foo.js')!.readContent()).eq('console.log("foo");');22 });23 it('should ignore missing "extends"', async () => {24 // Arrange25 const tsconfigInput = serializeTSConfig({ extends: './tsconfig.src.json' });26 fsTestDouble.files[tsconfigFileName] = tsconfigInput;27 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());28 // Act29 await sut.preprocess(project);30 // Assert31 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(tsconfigInput);32 });33 it('should ignore missing "references"', async () => {34 // Arrange35 const tsconfigInput = serializeTSConfig({ references: [{ path: './tsconfig.src.json' }] });36 fsTestDouble.files[tsconfigFileName] = tsconfigInput;37 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());38 // Act39 await sut.preprocess(project);40 // Assert41 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(tsconfigInput);42 });43 it('should rewrite "extends" if it falls outside of sandbox', async () => {44 // Arrange45 const tsconfigInput = serializeTSConfig({ extends: '../tsconfig.settings.json' });46 fsTestDouble.files[tsconfigFileName] = tsconfigInput;47 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());48 // Act49 await sut.preprocess(project);50 // Assert51 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(serializeTSConfig({ extends: '../../../tsconfig.settings.json' }));52 });53 it('should rewrite "references" if it falls outside of sandbox', async () => {54 // Arrange55 fsTestDouble.files[tsconfigFileName] = serializeTSConfig({ references: [{ path: '../model' }] });56 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());57 // Act58 await sut.preprocess(project);59 // Assert60 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(61 serializeTSConfig({ references: [{ path: '../../../model/tsconfig.json' }] })62 );63 });64 it('should rewrite "include" array items located outside of the sandbox', async () => {65 // See https://github.com/stryker-mutator/stryker-js/issues/328166 fsTestDouble.files[tsconfigFileName] = serializeTSConfig({67 include: ['./**/*', '../../../node_modules/self-service-server/lib/main/shared/@types/**/*.d.ts'],68 });69 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());70 await sut.preprocess(project);71 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(72 serializeTSConfig({73 include: ['./**/*', '../../../../../node_modules/self-service-server/lib/main/shared/@types/**/*.d.ts'],74 })75 );76 });77 it('should rewrite "exclude" array items located outside of the sandbox', async () => {78 fsTestDouble.files[tsconfigFileName] = serializeTSConfig({79 exclude: ['./**/*', '../foo.ts'],80 });81 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());82 await sut.preprocess(project);83 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(84 serializeTSConfig({85 exclude: ['./**/*', '../../../foo.ts'],86 })87 );88 });89 it('should rewrite "files" array items located outside of the sandbox', async () => {90 // See https://github.com/stryker-mutator/stryker-js/issues/328191 fsTestDouble.files[tsconfigFileName] = serializeTSConfig({92 files: ['foo/bar.ts', '../global.d.ts'],93 });94 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());95 await sut.preprocess(project);96 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(97 serializeTSConfig({98 files: ['foo/bar.ts', '../../../global.d.ts'],99 })100 );101 });102 it('should not do anything when inPlace = true', async () => {103 testInjector.options.inPlace = true;104 const tsconfigInput = serializeTSConfig({ extends: '../tsconfig.settings.json' });105 fsTestDouble.files[tsconfigFileName] = tsconfigInput;106 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());107 await sut.preprocess(project);108 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(tsconfigInput);109 });110 it('should support comments and other settings', async () => {111 fsTestDouble.files[tsconfigFileName] = `{112 "extends": "../tsconfig.settings.json",113 "compilerOptions": {114 // Here are the options115 "target": "es5", // and a trailing comma116 }117 }`;118 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());119 await sut.preprocess(project);120 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(121 serializeTSConfig({ extends: '../../../tsconfig.settings.json', compilerOptions: { target: 'es5' } })122 );123 });124 it('should rewrite referenced tsconfig files that are also located in the sandbox', async () => {125 // Arrange126 fsTestDouble.files[tsconfigFileName] = serializeTSConfig({ extends: './tsconfig.settings.json', references: [{ path: './src' }] });127 fsTestDouble.files[path.resolve('tsconfig.settings.json')] = serializeTSConfig({ extends: '../../tsconfig.root-settings.json' });128 fsTestDouble.files[path.resolve('src/tsconfig.json')] = serializeTSConfig({ references: [{ path: '../../model' }] });129 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());130 // Act131 await sut.preprocess(project);132 // Assert133 expect(await project.files.get(tsconfigFileName)!.readContent()).eq(134 serializeTSConfig({ extends: './tsconfig.settings.json', references: [{ path: './src' }] })135 );136 expect(await project.files.get(path.resolve('tsconfig.settings.json'))!.readContent()).eq(137 serializeTSConfig({ extends: '../../../../tsconfig.root-settings.json' })138 );139 expect(await project.files.get(path.resolve('src/tsconfig.json'))!.readContent()).eq(140 serializeTSConfig({ references: [{ path: '../../../../model/tsconfig.json' }] })141 );142 });143 it('should be able to rewrite a monorepo style project', async () => {144 // Arrange145 fsTestDouble.files[path.resolve('tsconfig.root.json')] = serializeTSConfig({146 extends: '../../tsconfig.settings.json',147 references: [{ path: 'src' }, { path: 'test/tsconfig.test.json' }],148 });149 fsTestDouble.files[path.resolve('src/tsconfig.json')] = serializeTSConfig({150 extends: '../../../tsconfig.settings.json',151 references: [{ path: '../../model' }],152 });153 fsTestDouble.files[path.resolve('test/tsconfig.test.json')] = serializeTSConfig({154 extends: '../tsconfig.root.json',155 references: [{ path: '../src' }],156 });157 testInjector.options.tsconfigFile = 'tsconfig.root.json';158 const project = new Project(fsTestDouble, fsTestDouble.toFileDescriptions());159 // Act160 await sut.preprocess(project);161 // Assert162 expect(await project.files.get(path.resolve('tsconfig.root.json'))!.readContent()).eq(163 serializeTSConfig({164 extends: '../../../../tsconfig.settings.json',165 references: [{ path: 'src' }, { path: 'test/tsconfig.test.json' }],166 })167 );168 expect(await project.files.get(path.resolve('src/tsconfig.json'))!.readContent()).eq(169 serializeTSConfig({170 extends: '../../../../../tsconfig.settings.json',171 references: [{ path: '../../../../model/tsconfig.json' }],172 })173 );174 expect(await project.files.get(path.resolve('test/tsconfig.test.json'))!.readContent()).eq(175 serializeTSConfig({ extends: '../tsconfig.root.json', references: [{ path: '../src' }] })176 );177 });...

Full Screen

Full Screen

generate-schemas.js

Source:generate-schemas.js Github

copy

Full Screen

1#!/usr/bin/env node2'use strict';3const fs = require('fs-extra');4const path = require('path');5const spawn = require('cross-spawn');6function _updateSchema(schemaFilePath) {7 const schemaJson = require(schemaFilePath);8 if (schemaJson.$schema) {9 delete schemaJson.$schema;10 }11 fs.writeFileSync(schemaFilePath, JSON.stringify(schemaJson, null, 2));12}13function _generateSchema(input, typeSymbol, output) {14 spawn.sync(path.join(process.cwd(), 'node_modules/.bin/typescript-json-schema'),15 [input, typeSymbol, '-o', output], {16 cwd: __dirname,17 stdio: 'inherit'18 });19 _updateSchema(output);20}21function generateSchemas() {22 const defaultSchemaOutDir = path.resolve(__dirname, '../dist/src/schemas');23 const builderSchemaOutDir = path.resolve(__dirname, '../dist/src/architect/schemas');24 const tsConfigInput = path.resolve(__dirname, './tsconfig-schema.json');25 fs.ensureDirSync(defaultSchemaOutDir);26 fs.ensureDirSync(builderSchemaOutDir);27 _generateSchema(tsConfigInput, 'AngularBuildConfig', path.resolve(defaultSchemaOutDir, 'schema.json'));28 _generateSchema(tsConfigInput, 'AppProjectConfig', path.resolve(defaultSchemaOutDir, 'app-project-config-schema.json'));29 _generateSchema(tsConfigInput, 'LibProjectConfig', path.resolve(defaultSchemaOutDir, 'lib-project-config-schema.json'));30 _generateSchema(tsConfigInput, 'AppBuilderOptions', path.resolve(builderSchemaOutDir, 'app-builder-options-schema.json'));31 _generateSchema(tsConfigInput, 'LibBuilderOptions', path.resolve(builderSchemaOutDir, 'lib-builder-options-schema.json'));32}33if (process.argv.length >= 2 && process.argv[1] === path.resolve(__filename)) {34 generateSchemas();35}...

Full Screen

Full Screen

prebuild.prod.js

Source:prebuild.prod.js Github

copy

Full Screen

1var fs = require('fs');2var path = require('path');3var ncp = require('ncp').ncp;4var mkdirp = require('mkdirp');5var aotSrcDir = path.resolve(__dirname, '../aot/src');6mkdirp(aotSrcDir, (err) => {7 if (err) console.error(err);8 else {9 var srcDir = path.resolve(__dirname, '../src');10 ncp(srcDir, aotSrcDir);11 var tsConfigInput = path.resolve(__dirname, '../config/tsconfig.aot.json');12 var tsConfigOutput = path.resolve(__dirname, '../aot/tsconfig.aot.json');13 ncp(tsConfigInput, tsConfigOutput);14 mkdirp(path.resolve(__dirname, '../aot/dist'), (err) => {15 if (err) console.error(err);16 ncp(path.resolve(__dirname, '../src/index.aot.html'), path.resolve(__dirname, '../aot/dist/index.html'));17 });18 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1{2 "compilerOptions": {3 },4}5module.exports = function (config) {6 config.set({7 });8};9{10 "scripts": {11 },12 "devDependencies": {13 }14}15module.exports = {16};

Full Screen

Using AI Code Generation

copy

Full Screen

1const tsconfig = require("./tsconfig.json");2const tsconfigInput = require("stryker-parent").tsconfigInput;3module.exports = function(config) {4 tsconfigInput(config, tsconfig);5};6const strykerConfig = require("./test.js");7module.exports = function(config) {8 strykerConfig(config);9};

Full Screen

Using AI Code Generation

copy

Full Screen

1const tsconfig = require('stryker-parent').tsconfigInput;2const config = tsconfig('./tsconfig.json');3const tsconfig = require('stryker-typescript').tsconfigInput;4const config = tsconfig('./tsconfig.json');5const tsconfig = require('stryker').tsconfigInput;6const config = tsconfig('./tsconfig.json');7const tsconfig = require('stryker').tsconfigInput;8const config = tsconfig('./tsconfig.json');9const tsconfig = require('stryker').tsconfigInput;10const config = tsconfig('./tsconfig.json');11const tsconfig = require('stryker').tsconfigInput;12const config = tsconfig('./tsconfig.json');13const tsconfig = require('stryker').tsconfigInput;14const config = tsconfig('./tsconfig.json');15const tsconfig = require('stryker').tsconfigInput;16const config = tsconfig('./tsconfig.json');17const tsconfig = require('stryker').tsconfigInput;18const config = tsconfig('./tsconfig.json');19const tsconfig = require('stryker').tsconfigInput;20const config = tsconfig('./tsconfig.json');21const tsconfig = require('stryker').tsconfigInput;22const config = tsconfig('./tsconfig.json');

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