Skip to content

Instantly share code, notes, and snippets.

@Evgenus
Last active August 29, 2015 14:01
Show Gist options
  • Save Evgenus/20521870f81efb4a3448 to your computer and use it in GitHub Desktop.
Save Evgenus/20521870f81efb4a3448 to your computer and use it in GitHub Desktop.
describe 'Building module with unknown dependency', ->
base = ->
before ->
@old_cwd = process.cwd()
process.chdir("/")
it 'should report unresolved dependency', ->
builder = spa.Builder.from_config("/testimonial/spa.yaml")
expect(builder.build.bind(builder))
.to.throw(spa.UnresolvedDependencyError)
.that.deep.equals(new spa.UnresolvedDependencyError("/a.js", "/b"))
after ->
mock.restore()
process.chdir(@old_cwd)
describe 'in CommonJS format', ->
base()
beforeEach ->
mock(yaml.safeLoad("""
testimonial:
a.js: |
var b = require("/b");
spa.yaml: |
root: "./"
"""))
describe 'in AMD format', ->
base()
beforeEach ->
mock(yaml.safeLoad("""
testimonial:
a.js: |
define(["/b"], function(b) {});
spa.yaml: |
manifest: manifest.json
root: "./"
"""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment