kalamuna / metalsmith-jstransformer

Metalsmith JSTransformers Plugin
http://npm.im/metalsmith-jstransformer
MIT License
7 stars 9 forks source link

Test failure on basic fixture #19

Closed ycherniavskyi closed 7 years ago

ycherniavskyi commented 7 years ago

For some reason I got next exception on test execution:

$ npm run test

> metalsmith-jstransformer@0.10.0 test /Users/ych/projects/metalsmith-jstransformer
> node test

 • metalsmith-jstransformer

assert.js:81
  throw new assert.AssertionError({
  ^
AssertionError: '(function(){}).call(this);' == '(function(){var a,c;a=42,c=!0}).call(this);'
  at /Users/ych/projects/metalsmith-jstransformer/node_modules/assert-dir-equal/lib/index.js:30:14
  at Array.forEach (native)
  at assertDirEqual (/Users/ych/projects/metalsmith-jstransformer/node_modules/assert-dir-equal/lib/index.js:26:11)
  at Metalsmith.<anonymous> (/Users/ych/projects/metalsmith-jstransformer/test/index.js:35:7)
  at Immediate.<anonymous> (/Users/ych/projects/metalsmith-jstransformer/node_modules/co/index.js:52:14)
  at runCallback (timers.js:666:20)
  at tryOnImmediate (timers.js:639:5)
  at processImmediate [as _immediateCallback] (timers.js:611:5)

The reason is:

$ diff test/fixtures/basic/build/scripts/main.js test/fixtures/basic/expected/scripts/main.js
1c1
< (function(){}).call(this);
\ No newline at end of file
---
> (function(){var a,c;a=42,c=!0}).call(this);
\ No newline at end of file

Installed version of jstransformer and ext:

inputformat-to-jstransformer@1.2.1
jstransformer@1.0.0
jstransformer-coffee-script@1.1.0
jstransformer-markdown-it@2.0.0
jstransformer-nunjucks@0.3.0
jstransformer-pug@0.2.3
jstransformer-styl@0.1.1
jstransformer-twig@1.3.0
jstransformer-uglify-js@1.1.1
RobLoach commented 7 years ago

Thanks for bringing this up. Fixed in the latest PR.

Appears latest Coffee-Script found it didn't need the variable definitions if it doesn't use the variables. Smart.