How to use initialCwd method in stryker-parent

Best JavaScript code snippet using stryker-parent

process.ts

Source:process.ts Github

copy

Full Screen

1/********************************************************************************2 * Copyright (C) 2017 Ericsson and others.3 *4 * This program and the accompanying materials are made available under the5 * terms of the Eclipse Public License v. 2.0 which is available at6 * http://www.eclipse.org/legal/epl-2.0.7 *8 * This Source Code may also be made available under the following Secondary9 * Licenses when the conditions for such availability set forth in the Eclipse10 * Public License v. 2.0 are satisfied: GNU General Public License, version 211 * with the GNU Classpath Exception which is available at12 * https://www.gnu.org/software/classpath/license.html.13 *14 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.015 ********************************************************************************/16import { injectable, unmanaged } from '@theia/core/shared/inversify';17import { ProcessManager } from './process-manager';18import { ILogger, Emitter, Event } from '@theia/core/lib/common';19import { FileUri } from '@theia/core/lib/node';20import { isOSX, isWindows } from '@theia/core';21import { Readable, Writable } from 'stream';22import { exec } from 'child_process';23import * as fs from 'fs';24export interface IProcessExitEvent {25 // Exactly one of code and signal will be set.26 readonly code?: number,27 readonly signal?: string28}29/**30 * Data emitted when a process has been successfully started.31 */32export interface IProcessStartEvent {33}34/**35 * Data emitted when a process has failed to start.36 */37export interface ProcessErrorEvent extends Error {38 /** An errno-like error string (e.g. ENOENT). */39 code: string;40}41export enum ProcessType {42 'Raw',43 'Terminal'44}45/**46 * Options to spawn a new process (`spawn`).47 *48 * For more information please refer to the spawn function of Node's49 * child_process module:50 *51 * https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options52 */53export interface ProcessOptions {54 readonly command: string,55 args?: string[],56 options?: {57 // eslint-disable-next-line @typescript-eslint/no-explicit-any58 [key: string]: any59 }60}61/**62 * Options to fork a new process using the current Node interpreter (`fork`).63 *64 * For more information please refer to the fork function of Node's65 * child_process module:66 *67 * https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options68 */69export interface ForkOptions {70 readonly modulePath: string,71 args?: string[],72 options?: object73}74@injectable()75export abstract class Process {76 readonly id: number;77 protected readonly startEmitter: Emitter<IProcessStartEvent> = new Emitter<IProcessStartEvent>();78 protected readonly exitEmitter: Emitter<IProcessExitEvent> = new Emitter<IProcessExitEvent>();79 protected readonly closeEmitter: Emitter<IProcessExitEvent> = new Emitter<IProcessExitEvent>();80 protected readonly errorEmitter: Emitter<ProcessErrorEvent> = new Emitter<ProcessErrorEvent>();81 protected _killed = false;82 /**83 * The OS process id.84 */85 abstract readonly pid: number;86 /**87 * The stdout stream.88 */89 abstract readonly outputStream: Readable;90 /**91 * The stderr stream.92 */93 abstract readonly errorStream: Readable;94 /**95 * The stdin stream.96 */97 abstract readonly inputStream: Writable;98 constructor(99 protected readonly processManager: ProcessManager,100 protected readonly logger: ILogger,101 @unmanaged() protected readonly type: ProcessType,102 protected readonly options: ProcessOptions | ForkOptions103 ) {104 this.id = this.processManager.register(this);105 this.initialCwd = options && options.options && 'cwd' in options.options && options.options['cwd'].toString() || __dirname;106 }107 abstract kill(signal?: string): void;108 get killed(): boolean {109 return this._killed;110 }111 get onStart(): Event<IProcessStartEvent> {112 return this.startEmitter.event;113 }114 /**115 * Wait for the process to exit, streams can still emit data.116 */117 get onExit(): Event<IProcessExitEvent> {118 return this.exitEmitter.event;119 }120 get onError(): Event<ProcessErrorEvent> {121 return this.errorEmitter.event;122 }123 /**124 * Waits for both process exit and for all the streams to be closed.125 */126 get onClose(): Event<IProcessExitEvent> {127 return this.closeEmitter.event;128 }129 protected emitOnStarted(): void {130 this.startEmitter.fire({});131 }132 /**133 * Emit the onExit event for this process. Only one of code and signal134 * should be defined.135 */136 protected emitOnExit(code?: number, signal?: string): void {137 const exitEvent: IProcessExitEvent = { code, signal };138 this.handleOnExit(exitEvent);139 this.exitEmitter.fire(exitEvent);140 }141 /**142 * Emit the onClose event for this process. Only one of code and signal143 * should be defined.144 */145 protected emitOnClose(code?: number, signal?: string): void {146 this.closeEmitter.fire({ code, signal });147 }148 protected handleOnExit(event: IProcessExitEvent): void {149 this._killed = true;150 const signalSuffix = event.signal ? `, signal: ${event.signal}` : '';151 const executable = this.isForkOptions(this.options) ? this.options.modulePath : this.options.command;152 this.logger.debug(`Process ${this.pid} has exited with code ${event.code}${signalSuffix}.`,153 executable, this.options.args);154 }155 protected emitOnError(err: ProcessErrorEvent): void {156 this.handleOnError(err);157 this.errorEmitter.fire(err);158 }159 protected async emitOnErrorAsync(error: ProcessErrorEvent): Promise<void> {160 process.nextTick(this.emitOnError.bind(this), error);161 }162 protected handleOnError(error: ProcessErrorEvent): void {163 this._killed = true;164 this.logger.error(error);165 }166 // eslint-disable-next-line @typescript-eslint/no-explicit-any167 protected isForkOptions(options: any): options is ForkOptions {168 return !!options && !!options.modulePath;169 }170 protected readonly initialCwd: string;171 /**172 * @returns the current working directory as a URI (usually file:// URI)173 */174 public getCwdURI(): Promise<string> {175 if (isOSX) {176 return new Promise<string>(resolve => {177 exec('lsof -p ' + this.pid + ' | grep cwd', (error, stdout, stderr) => {178 if (stdout !== '') {179 resolve(FileUri.create(stdout.substring(stdout.indexOf('/'), stdout.length - 1)).toString());180 } else {181 resolve(FileUri.create(this.initialCwd).toString());182 }183 });184 });185 } else if (!isWindows) {186 return new Promise<string>(resolve => {187 fs.readlink('/proc/' + this.pid + '/cwd', (err, linkedstr) => {188 if (err || !linkedstr) {189 resolve(FileUri.create(this.initialCwd).toString());190 } else {191 resolve(FileUri.create(linkedstr).toString());192 }193 });194 });195 } else {196 return new Promise<string>(resolve => {197 resolve(FileUri.create(this.initialCwd).toString());198 });199 }200 }...

Full Screen

Full Screen

index.spec.ts

Source:index.spec.ts Github

copy

Full Screen

1import { clearEnvironment, getAbsoluteDirectory, getExpectedFilename, loadExpected } from './test.utils.js'2import type { OutputType } from '../lib/index.js'3import { main } from '../lib/index.js'4const initialCwd = process.cwd()5describe('index.ts', () => {6 beforeAll(() => {7 clearEnvironment()8 })9 beforeEach(() => {10 process.chdir(initialCwd)11 })12 afterEach(() => {13 process.chdir(initialCwd)14 })15 for (const directoryName of ['single', 'quotes', 'expand']) {16 describe(`output (${directoryName})`, () => {17 beforeEach(() => {18 process.chdir(getAbsoluteDirectory(directoryName))19 })20 for (const output of ['set', 'export', 'json', 'json-pretty'].filter(s => getExpectedFilename(s as OutputType, directoryName) !== undefined) as OutputType[]) {21 it(`should output single variable (${output})`, async () => {22 const data = await main({23 output24 })25 const expected = await loadExpected(output, directoryName)26 expect(data).toEqual(expected)27 })28 }29 })30 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { initialCwd } = require('stryker-parent');2console.log(initialCwd);3const { initialCwd } = require('stryker-parent');4console.log(initialCwd);5console.log(initialCwd);6console.log(initialCwd);7console.log(initialCwd);8console.log(initialCwd);9console.log(initialCwd);10console.log(initialCwd);11console.log(initialCwd);12console.log(initialCwd);13console.log(initialCwd);14console.log(initialCwd);15console.log(initialCwd);16console.log(initialCwd);17console.log(initialCwd);18console.log(initialCwd);19console.log(initialCwd);20console.log(initialCwd);21console.log(initialCwd);22console.log(initialCwd);23console.log(initialCwd);24console.log(initialCwd);25console.log(initialCwd);26console.log(initialCwd);27console.log(initialCwd);28console.log(initialCwd);29console.log(initialCwd);30console.log(initialCwd);31console.log(initialCwd);32console.log(initialCwd);33console.log(initialCwd);34console.log(initialCwd);35console.log(initialCwd);36console.log(initialCwd);37console.log(initialCwd);38console.log(initialCwd);

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var initialCwd = strykerParent.initialCwd;3initialCwd();4var strykerParent = require('stryker-parent');5var initialCwd = strykerParent.initialCwd;6initialCwd();7var strykerParent = require('stryker-parent');8var initialCwd = strykerParent.initialCwd;9initialCwd();10var strykerParent = require('stryker-parent');11var initialCwd = strykerParent.initialCwd;12initialCwd();13var strykerParent = require('stryker-parent');14var initialCwd = strykerParent.initialCwd;15initialCwd();16var strykerParent = require('stryker-parent');17var initialCwd = strykerParent.initialCwd;18initialCwd();19var strykerParent = require('stryker-parent');20var initialCwd = strykerParent.initialCwd;21initialCwd();22var strykerParent = require('stryker-parent');23var initialCwd = strykerParent.initialCwd;24initialCwd();25var strykerParent = require('stryker-parent');26var initialCwd = strykerParent.initialCwd;27initialCwd();28var strykerParent = require('stryker-parent');29var initialCwd = strykerParent.initialCwd;30initialCwd();31var strykerParent = require('stry

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2parent.initialCwd();3import parent from 'stryker-parent';4parent.initialCwd();5var parent = require('stryker-parent').default;6parent.initialCwd();7import * as parent from 'stryker-parent';8parent.initialCwd();9import { initialCwd } from 'stryker-parent';10initialCwd();11var initialCwd = require('stryker-parent').initialCwd;12initialCwd();13import { default as parent, initialCwd } from 'stryker-parent';14parent.initialCwd();15import parent, { initialCwd } from 'stryker-parent';16parent.initialCwd();17var parent = require('stryker-parent').default;18parent.initialCwd();19var parent = require('stryker-parent');20parent.default.initialCwd();21import parent from 'stryker-parent';22parent.default.initialCwd();23var parent = require('stryker-parent').default;24parent.default.initialCwd();25import * as parent from 'stryker-parent';26parent.default.initialCwd();27import { default as parent, initialCwd } from 'stryker-parent';28parent.default.initialCwd();

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2var initialCwd = require('stryker-parent').initialCwd;3var myPath = initialCwd();4console.log(myPath);5var path = require('path');6var initialCwd = require('stryker-parent').initialCwd;7var myPath = initialCwd();8console.log(myPath);9var path = require('path');10var initialCwd = require('stryker-parent').initialCwd;11var myPath = initialCwd();12console.log(myPath);13var path = require('path');14var initialCwd = require('stryker-parent').initialCwd;15var myPath = initialCwd();16console.log(myPath);17var path = require('path');18var initialCwd = require('stryker-parent').initialCwd;19var myPath = initialCwd();20console.log(myPath);21var path = require('path');22var initialCwd = require('stryker-parent').initialCwd;23var myPath = initialCwd();24console.log(myPath);25var path = require('path');26var initialCwd = require('stryker-parent').initialCwd;27var myPath = initialCwd();28console.log(myPath);29var path = require('path');30var initialCwd = require('stryker-parent').initialCwd;31var myPath = initialCwd();32console.log(myPath);33var path = require('path');34var initialCwd = require('stryker-parent').initialCwd;35var myPath = initialCwd();36console.log(myPath);

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var initialCwd = stryker.initialCwd();3console.log(initialCwd);4var childProcess = require('child_process');5var path = require('path');6var child = childProcess.fork(path.join(__dirname, 'test.js'));7child.on('message', function(msg) {8 console.log(msg);9});10module.exports = function(config) {11 config.set({

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require("stryker");2var path = require("path");3var cwd = stryker.initialCwd();4console.log(path.resolve(cwd, "some/path"));5## `require('stryker')`6The `require('stryker')` module is the main entry point for the Stryker API. It exposes some useful functions and properties:7## `require('stryker-api')`8The `require('stryker-api')` module is the main entry point for the Stryker API. It exposes some useful functions and properties:9## `require('stryker-api/core')`10The `require('stryker-api/core')` module exposes the core interfaces of the Stryker API:11* `require('stryker

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