Requiring all spec files with es5 syntax
graemegeorge opened this issue · 3 comments
Whilst using this seed with es5 only syntax, I tried to require each spec file in the tests.webpack.js file in the following way, hoping it would work. It comes back with an error on almost every file, scss, js, html etc.. I only have one spec file so far and since test only came back as one path, I assumed it would include that one path? What's going on here, am I missing something?
require('angular');
require('angular-mocks/angular-mocks');
var testsContext = require.context(".", true, /.spec$/);
testsContext.keys().forEach(function(test) {
require(test);
});
just drop old ES5 syntax and learn ES2015/2016/2017. you can see how to use it looking at this PR.
you can cherry-pick that commit or can compile by hand that template.
PS: babel convert imports/exports to commonjs format by default, so if you still want to use ES5 you can convert that template to cjs format (you can compile w/ babel to see how the module in ES5 needs to be)
I know ES6 already. I would love to use it but the decision is not mine in this scenario. Thanks anyway
@graemegeorge eheh, i know that feeling. i'm sorry about that. ;)