-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: add syntax check before wrap origin script
Add syntax check for origin script code. fix nodejs/node-v0.x-archive#8183
- Loading branch information
1 parent
3d3083b
commit cef8bd1
Showing
3 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
console.log("func 1"); | ||
})(); | ||
|
||
(function() { | ||
console.log("func 2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
|
||
try { | ||
require('../fixtures/module-syntax-error.js'); | ||
} catch (e) { | ||
assert.equal(e.name, 'SyntaxError'); | ||
assert.equal(e.message, 'Unexpected token }'); | ||
return; | ||
} | ||
assert.ok(false, 'should not ok for code with syntax error'); |