How to use the @stryker-mutator/util.fsAsPromised.writeFile function in @stryker-mutator/util

To help you get started, we’ve selected a few @stryker-mutator/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stryker-mutator / stryker / packages / core / src / reporters / EventRecorderReporter.ts View on Github external
private writeToFile(methodName: keyof Reporter, data: any) {
    const filename = path.join(this.baseFolder, `${this.format(this.index++)}-${methodName}.json`);
    this.log.debug(`Writing event ${methodName} to file ${filename}`);
    return fsAsPromised.writeFile(filename, JSON.stringify(data), { encoding: 'utf8' });
  }
github stryker-mutator / stryker / packages / stryker / src / initializer / StrykerConfigWriter.ts View on Github external
private writeStrykerConfigRaw(rawConfig: string, rawHeader = '') {
    this.out('Writing stryker.conf.js...');
    const formattedConf = format(`${rawHeader}
      module.exports = function(config){
        config.set(
          ${rawConfig}
        );
      }`, { parser: 'babel' as unknown as 'babylon' });
    return fsAsPromised.writeFile(STRYKER_CONFIG_FILE, formattedConf);
  }
github stryker-mutator / stryker / packages / html-reporter / src / util.ts View on Github external
export async function writeFile(fileName: string, content: string) {
  await mkdir(path.dirname(fileName));
  await fsAsPromised.writeFile(fileName, content, 'utf8');
}
github stryker-mutator / stryker / packages / core / src / initializer / StrykerConfigWriter.ts View on Github external
private async writeStrykerConfigRaw(rawConfig: string, rawHeader = '') {
    this.out('Writing & formatting stryker.conf.js...');
    const formattedConf = `${rawHeader}
      module.exports = function(config){
        config.set(
          ${rawConfig}
        );
      }`;
    await fsAsPromised.writeFile(STRYKER_CONFIG_FILE, formattedConf);
    try {
      await childProcessAsPromised.exec(`npx prettier --write ${STRYKER_CONFIG_FILE}`);
    } catch (error) {
      this.log.debug('Prettier exited with error', error);
      this.out('Unable to format stryker.conf.js file for you. This is not a big problem, but it might look a bit messy 🙈.');
    }
  }
github stryker-mutator / stryker / packages / stryker / src / utils / fileUtils.ts View on Github external
export function writeFile(fileName: string, data: string | Buffer): Promise {
  if (Buffer.isBuffer(data)) {
    return fsAsPromised.writeFile(fileName, data);
  } else {
    return fsAsPromised.writeFile(fileName, data, 'utf8');
  }
}
github stryker-mutator / stryker / packages / stryker / src / reporters / EventRecorderReporter.ts View on Github external
private writeToFile(methodName: keyof Reporter, data: any) {
    const filename = path.join(this.baseFolder, `${this.format(this.index++)}-${methodName}.json`);
    this.log.debug(`Writing event ${methodName} to file ${filename}`);
    return fsAsPromised.writeFile(filename, JSON.stringify(data), { encoding: 'utf8' });
  }
github stryker-mutator / stryker / packages / core / src / utils / fileUtils.ts View on Github external
export function writeFile(fileName: string, data: string | Buffer): Promise {
  if (Buffer.isBuffer(data)) {
    return fsAsPromised.writeFile(fileName, data);
  } else {
    return fsAsPromised.writeFile(fileName, data, 'utf8');
  }
}