Closed dreamalligator closed 7 years ago
Do you have whatever defines define
required in your spec helper?
I wound up making a faux test application Webpack config entry.
entry: {
'/spec/javascripts/faux_application': './spec/javascripts/tests/test_manifest.js.coffee'
}
and updated the teaspoon_env
suite.matcher
to be that output file. i.e. "spec/javascripts/faux_application.js"
in this example.
and other specific things to my project. Marking as closed, thanks!
Hi all, I am having difficulty accessing modules in the AMD pattern that are bundled with webpack for my Teaspoon tests.
Example of such a pattern:
define(['a', 'b'], function (a, b) {});
. These anonymous defines are problematic.I read the wiki on using RequireJS-with-Teaspoon, but although informative, not quite the steps for such a stack.
Currently my workaround is extracting the methods I want to test and muddying the global namespace. Such as
window.myMethodToTest
.. but this makes me 😿.Any suggestions or help are greatly appreciated.
#= require my_module
will giveReferenceError: Can't find variable: define
and I suppose it is possible to create a faux test bundle with webpack and require it via Teaspoon's
spec_helper
? or possibly do something with adding test fixtures and altering https://github.com/jejacks0n/teaspoon/blob/master/app/views/teaspoon/suite/_boot.html.erb