<commit_before>const {pack} = require('../src/packing')
const JsSession = require('../src/JsSession')

const test = require('tape')

test('JsSession can be constructed with options', t => {
  let s1 = new JsSession()
  let s2 = new JsSession({
    transform: true
  })

  t.equal(s1.options.transform, typeof window !== 'undefined', 'transform defaults to true in browser, false otherwise')
  t.equal(s2.options.transform, true)

  t.end()
})

test('JsSession.execute with no inputs, no errors and no output', function (t) {
  let s = new JsSession()

  t.deepEqual(s.execute('let x = 3\n\n'), {errors: {}, output: null}, 'assign')

  t.deepEqual(s.execute('// Multiple lines and comments\nlet x = {\na:1\n\n}\n'), {errors: {}, output: null}, 'assign')<commit_msg>Fix test - can't return a `let` statement!<commit_after>const {pack} = require('../src/packing')
const JsSession = require('../src/JsSession')

const test = require('tape')

test('JsSession can be constructed with options', t => {
  let s1 = new JsSession()
  let s2 = new JsSession({
    transform: true
  })

  t.equal(s1.options.transform, typeof window !== 'undefined', 'transform defaults to true in browser, false otherwise')
  t.equal(s2.options.transform, true)

  t.end()
})

test('JsSession.execute with no inputs, no errors and no output', function (t) {
  let s = new JsSession()

  t.deepEqual(s.execute('let x = 3\n\n'), {errors: {}, output: null}, 'assign')

  t.deepEqual(s.execute('// Multiple lines and comments\nlet x = {\na:1\n\n}\n\n'), {errors: {}, output: null}, 'assign')
{'fraction_non_alphanumeric': 0.17575368826170623, 'fraction_numerical': 0.007697241821680564, 'mean_word_length': 4.131578947368421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2452071', 'n_tokens_mistral': 527, 'n_tokens_neox': 513, 'n_words': 153}