This repository has been archived by the owner. It is now read-only.

buster doesn't like files that end in comments #144

Closed
geddski opened this Issue Mar 28, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@geddski

geddski commented Mar 28, 2012

neither the tests nor the buster.js config file can end in comments without causing Buster to blow up with:

[Fatal] Syntax error in /path/to/offending/file.js

For example this is a valid config file:

var config = module.exports;

config["Browser Tests"] = {
  environment:"browser",
  rootPath:"../",
  libs:["js/lib/require.js"],
  tests:[
    "spec/module/test.module.js"
  ], 
  resources:['**/*.js']
};

but the error will get thrown if it ends with a comment:

var config = module.exports;

config["Browser Tests"] = {
  environment:"browser",
  rootPath:"../",
  libs:["js/lib/require.js"],
  tests:[
    "spec/module/test.module.js"
  ], 
  resources:['**/*.js']
};

//todo add config for node tests

curious little bug huh. I'm on Buster.JS version 0.4.6 beta2, updated latest with buster-dev-tools 2 minutes ago.

@cjohansen

This comment has been minimized.

Member

cjohansen commented Mar 28, 2012

Actually noticed that yesterday as I commented an entire module in your amd examples. The reason it happens in your config file as well is your 'resources: ["*/.js"], which includes buster.js.

I think vm.runInContext is the entry point here, strange that it throws. Will investigate.

@cjohansen

This comment has been minimized.

Member

cjohansen commented Apr 8, 2012

busterjs/buster-syntax@cca7f1f

When the syntax checker is instructed to ignore reference errors (because it only looks at scripts in isolation, and misses identifiers defined globally in other files), we wrap code in a closure before syntax checking. I needed to add a newline after the script, otherwise the single-line comment would always cause the generated script to be invalid.

@cjohansen cjohansen closed this Apr 8, 2012

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.