<commit_before>// Load in dependencies
var fs = require('fs');
var expect = require('chai').expect;
var sinon = require('sinon');
var shell = require('shelljs');
var fixtureUtils = require('./utils/fixtures');
var foundryUtils = require('./utils/foundry');

// Guarantee safeguards against exec are in place (see WARNING.md)
var childUtils = require('./utils/child-process');

// Define our test
describe('A release', function () {
  describe('in a node module (npm)', function () {
    fixtureUtils.fixtureDir('npm');
    // TODO: Make this a util itself
    // foundryUtils.release('0.1.0');
    before(function release (done) {
      // Introduce custom stubbing
      var program = foundryUtils.create({
        allowPreRelease: true,
        allowGitTag: true
      });

      // When publishing to npm, stub over exec to return all valid calls
      var that = this;
      program.once('postRelease#before', function banAndStub () {
        that.execStub = sinon.stub(shell, 'exec', function () {
          return {code: 0};
        });
      });

      // Run through the release
      program.once('postRelease#after', done);
      program.parse(['node', '/usr/bin/foundry', 'release', '0.1.0']);
    });
    after(function unstub () {
      this.execStub.restore();
    });

    it('updates the package.json', function () {
      var pkgJson = fs.readFileSync(fixtureUtils.dir + '/npm/package.json');
      expect(JSON.parse(pkgJson)).to.have.property('version', '0.1.0');
    });
    it('publishes to npm', function () {<commit_msg>Trying out withArgs but it fails =(<commit_after>// Load in dependencies
var fs = require('fs');
var expect = require('chai').expect;
var sinon = require('sinon');
var shell = require('shelljs');
var fixtureUtils = require('./utils/fixtures');
var foundryUtils = require('./utils/foundry');

// Guarantee safeguards against exec are in place (see WARNING.md)
var childUtils = require('./utils/child-process');

// Define our test
describe('A release', function () {
  describe('in a node module (npm)', function () {
    fixtureUtils.fixtureDir('npm');
    // TODO: Make this a util itself
    // foundryUtils.release('0.1.0');
    before(function release (done) {
      // Introduce custom stubbing
      var program = foundryUtils.create({
        allowPreRelease: true,
        allowGitTag: true
      });

      // When publishing to npm, stub over exec to return all valid calls
      var that = this;
      program.once('postRelease#before', function banAndStub () {
        // that.execStub = sinon.stub(shell, 'exec', function () {
        that.execStub = sinon.stub(shell, 'exec').withArgs('npm publish');
      });

      // Run through the release
      program.once('postRelease#after', done);
      program.parse(['node', '/usr/bin/foundry', 'release', '0.1.0']);
    });
    after(function unstub () {
      this.execStub.restore();
    });

    it('updates the package.json', function () {
      var pkgJson = fs.readFileSync(fixtureUtils.dir + '/npm/package.json');
      expect(JSON.parse(pkgJson)).to.have.property('version', '0.1.0');
    });
    it('publishes to npm', function () {
{'fraction_non_alphanumeric': 0.15998727735368956, 'fraction_numerical': 0.006043256997455471, 'mean_word_length': 3.0950520833333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2850474', 'n_tokens_mistral': 941, 'n_tokens_neox': 921, 'n_words': 245}