<commit_before>#!/usr/bin/env node

'use strict';

const path = require('path');
const assert = require('assert');
const utils = require('../utils.js');

assert(!module.parent);
assert(__dirname === process.cwd());

const host = 'node' + process.version[1];
const target = process.argv[2] || host;
const input = './test-x-index.js';
const output = './test-output.exe';

const version = target;
if (/^(node|v)?0/.test(version)) return;

let right;

utils.pkg.sync([
  '--target', target,
  '--config', './test-config.js',
  '--output', output, input
]);

right = utils.spawn.sync(
  './' + path.basename(output), [],
  { cwd: path.dirname(output),
    stdio: 'pipe', expect: 1 }
);

assert(right.stderr.indexOf('x.parse is not a function') >= 0);
utils.vacuum.sync(output);<commit_msg>test source position as well as error message<commit_after>#!/usr/bin/env node

'use strict';

const path = require('path');
const assert = require('assert');
const utils = require('../utils.js');

assert(!module.parent);
assert(__dirname === process.cwd());

const host = 'node' + process.version[1];
const target = process.argv[2] || host;
const input = './test-x-index.js';
const output = './test-output.exe';

const version = target;
if (/^(node|v)?0/.test(version)) return;

let right;

utils.pkg.sync([
  '--target', target,
  '--config', './test-config.js',
  '--output', output, input
]);

right = utils.spawn.sync(
  './' + path.basename(output), [],
  { cwd: path.dirname(output),
    stdio: 'pipe', expect: 1 }
);

assert(right.stderr.indexOf('x.parse();\n  ^') >= 0);
assert(right.stderr.indexOf('x.parse is not a function') >= 0);
utils.vacuum.sync(output);
{'fraction_non_alphanumeric': 0.21946795646916567, 'fraction_numerical': 0.006650544135429262, 'mean_word_length': 4.220820189274448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '2390441', 'n_tokens_mistral': 582, 'n_tokens_neox': 568, 'n_words': 132}