Can't run ember test - ember.js

After many successful times running ember test and ember test -s, I can't run either of them on a specific project. The only thing I can think of that happened since it last ran successfully is that Terminal.app crashed while ember test -s was running.
Now when I run ember test -s on that project, I always get this error:
Global error: Error: Assertion Failed: The initializer 'container-debug-adapter' has
already been registered at http://localhost:7357/assets/vendor.js, line 38210
Global error: Error: Assertion Failed: The tests file was not loaded. Make sure your
tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 38210
Error: Assertion Failed: The initializer 'container-debug-adapter' has already been
registered at http://localhost:7357/assets/vendor.js, line 38210
Error: Assertion Failed: The tests file was not loaded. Make sure your tests
index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 38210
If I try running ember test -s on a different project, it works fine. So it seems to me that there must be something untracked by git that is sitting somewhere in the project folder that causes this problem.
Ember: 3.14.1
Ember CLI:

I solved the problem by deleting node_modules and package-lock.json and then running npm install.
I wish that I understood what could cause this and why reinstalling all of my dependencies would fix it.

Related

Error: Module build failed: Error: Couldn't find preset "react-app" relative to directory "/[project] frontend"

I am following the tutorials to create a react app using create-react-app.
There were a number of dependencies that didn't get installed when loading the webpack-dev-server.
I get the following error when I try to npm run start.
What does this mean and can anyone tell me what is needed to fix it?
Module build failed: Error: Couldn't find preset "react-app" relative to directory "/[Proeject folder]/frontend"
run npm install babel-preset-react-app

phpunit tests returning no assertions and all errors

I am new to unit testing (and would really like to learn). I tried pulling down this repository (https://github.com/serbanghita/Mobile-Detect) and have been trying to run their unit tests they already have set up. I have it to the point where phpunit is running but when I run
phpunit tests
from the root directory I get:
Tests: 1411, Assertions: 0, Errors: 1411
I have tried running
phpunit --configuration tests/phpunit.xml
but then I get the error:
Class "JohnKary\PHPUnit\Listener\SpeedTrapListener" does not exist
They have something in their documentation about running:
php phpunit.phar -c tests/phpunit.xml
but I get the error
Could not open input file: phpunit.phar
which is because of the way I have phpunit set up I'm sure...
Any suggestions on how to further trouble shoot this?
It appears you have configured https://github.com/johnkary/phpunit-speedtrap to be used as a test listener in your phpunit.xml but have not (properly) installed this extension.
And if your PHP cannot find phpunit.phar then you are either not pointing it to the correct path or you have not downloaded / installed the PHPUnit PHAR, maybe because you chose to install PHPUnit via Composer. In that case the correct path would be vendor/bin/phpunit, of course.

Ionic2 build demos not working

I want to build the demos from the forked Ionic 2 repository. when I run 'gulp demos.build'
I get the following errors on my terminal:
ERRROR: Command failed: node --max_old_space_size=8096 /Users/luki/Applications/ionic-fork/ionic/node_modules/.bin/ngc -p /Users/luki/Applications/ionic-fork/ionic/demos/tsconfig.json
Error: Error at /Users/luki/Applications/ionic-fork/ionic/node_modules/#types/protractor/index.d.ts:22:27: Module 'webdriver' has no exported member 'IButton'.
Error at /Users/luki/Applications/ionic-fork/ionic/node_modules/#types/protractor/index.d.ts:25:24: Module 'webdriver' has no exported member 'IKey'.
Error at /Users/luki/Applications/ionic-fork/ionic/node_modules/#types/protractor/index.d.ts:28:45: Property 'Error' does not exist on type 'typeof error'.
I installed 'typings install selenium-webdriver but it doesn't help. Maybe some other typings are missing ...
Anybody got a clue about this ?

Ember test failing on importing in config/environment

When I run ember test on a project I am getting this error
Log: |
{ type: 'error',
text: 'Error: Could not find module `otherapp/config/environment` imported from `otherapp/tests/helpers/resolver` at http://localhost:7357/assets/vendor.js, line 173\n' }
...
not ok 2 PhantomJS 2.1 - Global error: Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 15359
---
Log: |
{ type: 'error',
text: 'Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 15359\n' }
...
I am not sure how to debug this, since this is happening in the test suite and there is no window to debug and placing debugger; doesn't help. Also this is someone else's project.
This is not a problem in the ember-cli or any packages as I created a new ember app and wrote some acceptance test without any such error. I am not sure how to trace or debug this error.
I had this issue and it was a strict mode bug. I was actually declaring a property on a controller with the same name twice.
you can debug phantomjs by mounting it onto a port and then browsing there.
put this in your testem.json
"phantomjs_debug_port": 9000
and then browse to localhost:9000 the second link with send you to the phantom dev tools!

Karma error - Unknown provider: $$asyncCallbackProvider

Trying to run my karma test through grunt but getting an error:
Error: [$injector:modulerr] Failed to instantiate module ngMock due to:
Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider
I removed 'ngAnimate' but does not resolve it. How can I run the grunt karma test without this error?
I had the same problem just now, and fixed it by making sure the version of my angular-mock dependancy was the same as that angular.
You can do this in your bower.json file (change "angular-mocks": "~1.3.0" to "angular-mocks": "^1.3.0" or a specific version).
While I have no doubt that 3sdmx's answer would work, I just ran an NPM update and that worked. Thought I should mention that so that people aren't maintaining their .json files so closely.
You should add all the angular dependencies that you used in your project to your karma.conf.js file.
It seems like you need to add ngMock to your karma file, like the example below :
files: [
'*/**/angula-ngMock.js'
],