Skip to content

Commit 405b52f

Browse files
author
Jason Walton
committed
Add same unit test in falafel case.
1 parent 31570a6 commit 405b52f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

test/falafelTransformTest.coffee

+12
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,15 @@ describe "transformTools falafel transforms", ->
5353
return done err if err
5454
assert.equal result, expectedContent
5555
done()
56+
57+
it "should gracefully handle a syntax error", (done) ->
58+
transform = transformTools.makeFalafelTransform "identityify", (node, opts, cb) ->
59+
cb()
60+
61+
content = """
62+
require('foo');
63+
require({;
64+
"""
65+
transformTools.runTransform transform, dummyJsFile, {content}, (err, result) ->
66+
assert err != null, "Expected an error from runTransform"
67+
done()

test/requireTransformTest.coffee

+1-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ describe "transformTools require transforms", ->
163163

164164
it "should gracefully handle a syntax error", (done) ->
165165
transform = transformTools.makeRequireTransform "requireTransform", (args, opts, cb) ->
166-
if args[0] is "foo"
167-
cb null, "require('bar')"
168-
else
169-
cb()
166+
cb()
170167

171168
content = """
172169
require('foo');

0 commit comments

Comments
 (0)