All files / scripts/deploy-service/utils writeState.js

11.11% Statements 1/9
100% Branches 0/0
0% Functions 0/1
11.11% Lines 1/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161x                              
module.exports = function(state, options) {
  const fs = require('fs');
  const { printOrSilent } = require('@haechi-labs/vvisp-utils');
  const { STATE_PATH } = require('../../../config/Constant');
 
  const stateString = JSON.stringify(state, null, '  ');
  // printOrSilent(chalk.head('Service State Result'), options); // Just for debugging
  // printOrSilent(chalk.notImportant(stateString), options);
  try {
    fs.writeFileSync(STATE_PATH, stateString, 'utf8');
  } catch (e) {
    printOrSilent(chalk.error('Cannot write state file'), options);
    console.log(e);
  }
};