Open manuelro opened 9 years ago
How are you running it?
You need to run gulp
from your angular app folder
and then in another terminal gulp testem
.
That should work, I just tried.
What I get is a weird error about something in angular-mock
that shouldn't happen.
I need to give this workflow some work to bring bower to it which will change the testem.json
a bit and see if that overrides the error.
Will keep this issue until I upgrade the workflow with the latest changes and you fix your issue.
Yes, I ran gulp testem
, it starts the test server, but none of the app/js/**/.js
files seems to load, nor the Jasmine Framework, nor the angular-mocks.js
, that's why the errors.
Thanks! I'll see if I can figure that out. I was also thinking about implementing the same testing workflow as in Yeoman's Angular workflow. It works fine and uses Karma and Jasmine.
Fixed. You have to add vendor
path to your testem.json
file. The test engine needs the real library to be able to emulate the expected behavior with angular-mock.js
. A very simple but important point.
See my new testem.json
file:
{
"framework" : "jasmine2",
"launch_in_dev" : ["Safari"],
"src_files" : [
"vendor/js/**/*.js",
"app/js/**/*.js",
"spec/helpers/**/*.js",
"spec/tests/**/*.js"
]
}
Oh oh oh, I missed something on your original testem.json
.
Check the default one:
{
"framework" : "jasmine2",
"launch_in_dev" : ["Chrome"],
"src_files" : [
"tmp/js/app.js",
"spec/helpers/angular-mocks.js",
"spec/**/*_spec.js"
]
}
First I add app.js
and then angular-mocks
.
The app.js
also includes the vendor on it.
You can do it like I have on this repo or if you want to do it in your way, just make sure you add vendor before the application app.
First of all, thank you so much! The workflow does an amazing job merging Laravel and Angular for self consumption APIs. But I have some issues while trying to run unit tests:
I see there is a
spec
folder and inside it ahelpers/angular-mocks.js
. Thetestem.json
file has a few options, likesrc_files
, for example.But when I run my tests, the gulp server throws errors like
'describe' is not defined.
for my_spec.js
files in the spec folder, andvariable module not found
which meansangular-mocks.js
is not loading. So for the first error it seems testem is not even loading theJasmine Framework
.Any guidance to set this up?
My
testem.json
file: