How to import jasmine test functions in Angular2 rc5 - unit-testing

I am working on a new project and just upgraded from rc4 to rc5 of Angular 2. Upon upgrading it appears that functions like it, expect, describe, etc are no longer being exported from '#angular/core/testing'. I have searched every resource I can think of and I see unit tests written online that claim to be using rc5 that still have these Jasmine test functions. Where do you import these from using rc5? Is there a new dependency library that I'm missing?
package.json
"dependencies": {
"#angular/common": "2.0.0-rc.5",
"#angular/compiler": "2.0.0-rc.5",
"#angular/core": "2.0.0-rc.5",
"#angular/forms": "0.3.0",
"#angular/http": "2.0.0-rc.5",
"#angular/platform-browser": "2.0.0-rc.5",
"#angular/platform-browser-dynamic": "2.0.0-rc.5",
"#angular/router": "3.0.0-alpha.7",
"#angular/router-deprecated": "2.0.0-rc.2",
"#angular/upgrade": "2.0.0-rc.5",
"#angular2-material/card": "^2.0.0-alpha.4",
"#angular2-material/checkbox": "^2.0.0-alpha.4",
"#angular2-material/core": "^2.0.0-alpha.4",
"#angular2-material/sidenav": "^2.0.0-alpha.4",
"#angular2-material/toolbar": "^2.0.0-alpha.4",
"bootstrap": "twbs/bootstrap#v4-dev",
"es6-shim": "^0.35.0",
"font-awesome": "^4.6.3",
"fullcalendar": "^2.7.3",
"jquery": "^2.2.4",
"jquery-datetimepicker": "^2.5.4",
"jquery-ui": "^1.10.5",
"material-icons": "^0.1.0",
"moment": "^2.13.0",
"ng2-bootstrap": "^1.0.22",
"primeng": "^1.0.0-beta.8",
"primeui": "^4.1.12",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"sweetalert": "^1.1.3",
"systemjs": "0.19.26",
"zone.js": "^0.6.12"
},
"devDependencies": {
"angular-cli": "^1.0.0-beta.0",
"clang-format": "^1.0.35",
"codelyzer": "0.0.14",
"ember-cli-inject-live-reload": "^1.4.0",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "^2.4.0",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.3",
"karma-jasmine": "^0.3.8",
"protractor": "^3.3.0",
"ts-node": "^0.5.5",
"tslint": "^3.6.0",
"typescript": "^1.8.10",
"typings": "^0.8.1"
}

They no longer need to be imported from anywhere as of RC4. They're made available globally to any testing module.
Importing Jasmine functions from #angular/core/testing is no longer necessary and is now deprecated.
See also the last bullet point of the Breaking Changes section of the RC4 Changelog.

Related

Ember deploy script failing on specific npm package

I'm trying to deploy to my staging environment using ember deploy and continue to get this error which breaks the build
An error occurred in the constructor for ember-cli-htmlbars-inline-precompile
I tracked down the issue via guess and checking to a specific handlebars template, that once commented out stopped the problem and allowed me to finish the script. Unfortunatley I'm getting this same issue again. This error does not occur when I build or run the app locally.
Is my package.json
I'm using node 6.15.1
I've tried v0.3.0, v0.4.0, v1.0.0, and v2.0.0 of
ember-cli-htmlbars-inline-precompile to no avail.
I'm assuming my problem again is in some handlebars template, but unfortunately without the errors locally I can't deduce the location.
"name": "~~~",
"description": "Small description for ~~~~ goes here",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test",
"lint": "eslint .",
"postinstall": "./node_modules/bower/bin/bower install --allow-root"
},
"repository": "",
"engines": {
"node": "6.15.1"
},
"author": "",
"license": "MIT",
"devDependencies": {},
"dependencies": {
"#babel/core": "^7.4.4",
"#newrelic/publish-sourcemap": "4.4.0",
"active-model-adapter": "^2.2.0",
"babel-eslint": "^7.0.0",
"bower": "^1.8.2",
"broccoli-asset-rev": "2.2.0",
"broccoli-stew": "^2.1.0",
"ember-ajax": "^3.0.0",
"ember-cli": "~2.15.1",
"ember-cli-app-version": "^3.0.0",
"ember-cli-babel": "^6.7.1",
"ember-cli-bootstrap-sass": "git+https://github.com/~~~/ember-cli-bootstrap-sass.git",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-deploy": "^1.0.2",
"ember-cli-deploy-build": "^1.1.1",
"ember-cli-deploy-change-log": "git+https://github.com/~~~~/ember-cli-deploy-change-log.git",
"ember-cli-deploy-display-revisions": "^1.0.1",
"ember-cli-deploy-gzip": "^1.0.1",
"ember-cli-deploy-revision-data": "git+https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data.git",
"ember-cli-deploy-s3": "git+https://github.com/~~~/ember-cli-deploy-s3.git",
"ember-cli-deploy-s3-index": "git+https://github.com/~~~/ember-cli-deploy-s3-index.git",
"ember-cli-deploy-slack": "^1.0.1",
"ember-cli-eslint": "^4.0.0",
"ember-cli-flash": "^1.7.1",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-htmlbars-inline-precompile": "^2.0.0",
"ember-cli-inject-live-reload": "^1.10.2",
"ember-cli-inline-content": "^0.4.0",
"ember-cli-loading-slider": "^2.0.0",
"ember-cli-moment-shim": "^3.7.1",
"ember-cli-phone-number": "^0.1.4",
"ember-cli-pretender": "0.5.0",
"ember-cli-qunit": "^4.0.0",
"ember-cli-release": "0.2.9",
"ember-cli-sass": "^10.0.0",
"ember-cli-shims": "^1.1.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-test-loader": "^2.2.0",
"ember-cli-uglify": "^1.2.0",
"ember-cli-velocity": "^0.4.0",
"ember-cli-version-checker": "^2.1.2",
"ember-click-outside": "0.1.12",
"ember-composable-helpers": "2.1.0",
"ember-data": "~2.16.3",
"ember-decorators": "^2.5.2",
"ember-export-application-global": "^2.0.0",
"ember-faker": "1.1.0",
"ember-inflector": "^2.3.0",
"ember-link-action": "^0.1.3",
"ember-load-initializers": "^1.0.0",
"ember-moment": "^7.8.1",
"ember-new-relic": "0.6.1",
"ember-resolver": "^4.0.0",
"ember-simple-auth": "^1.8.2",
"ember-source": "^2.15.3",
"ember-welcome-page": "^3.0.0",
"eslint": "~2.2.0",
"eslint-config-google": "^0.4.0",
"eslint-config-xo": "^0.10.1",
"eslint-plugin-babel": "^3.1.0",
"express": "^4.16.4",
"font-awesome": "^4.7.0",
"glob": "^7.1.4",
"jquery": "~2.2.4",
"loader.js": "^4.7.0",
"phantomjs-prebuilt": "^2.1.16",
"rsvp": "^4.8.4",
"sass": "^1.20.1",
"velocity-animate": "^1.5.2"
}
}```
By using urls from GitHub to pull in npm packages, you are grabbing the latest code from GitHub for those packages. That code isn't necessarily ready to be used with your other dependencies, and may have breaking API changes compared to what is in the READMEs.
If you use a specific version of these packages from npm, I think your problem will likely go away. If you are working off an internal fork, consider basing your work off the last stable release, rather than master of those packages.
It is possible that the deploys aren't the real problem. If you do ember serve --production, does the app run? The production flag will make sure that your app goes through all the same compilation and minification that deploy would. If running with prod doesn't work, it means that there's an issues elsewhere in your app besides those GitHub urls.
I also suggest creating a fresh 2.15 app with these dependencies to see what happens.

ionic 2 unmet peer dependency #ionic-native/core#4.3.3

When I am going to install camera, file, file transfer and filepath plugin it displays the error as unmet peer dependency #ionic-native/core#4.3.3.
Commands I used -
npm install --save #ionic-native/camera #ionic-native/file #ionic-native/file-path #ionic-native/transfer
ionic plugin add cordova-plugin-camera --save
ionic plugin add cordova-plugin-file --save
ionic plugin add cordova-plugin-file-transfer --save
ionic plugin add cordova-plugin-filepath --save
Below is my packge.json
"dependencies": {
"#angular/common": "4.4.3",
"#angular/compiler": "4.4.3",
"#angular/compiler-cli": "4.4.3",
"#angular/core": "4.4.3",
"#angular/forms": "4.4.3",
"#angular/http": "4.4.3",
"#angular/platform-browser": "4.4.3",
"#angular/platform-browser-dynamic": "4.4.3",
"#ionic-native/camera": "^4.3.3",
"#ionic-native/core": "^4.3.3",
"#ionic-native/file": "^4.3.3",
"#ionic-native/file-path": "^4.3.3",
"#ionic-native/in-app-browser": "4.3.2",
"#ionic-native/keyboard": "4.3.3",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic-native/themeable-browser": "4.3.2",
"#ionic-native/transfer": "^3.14.0",
"#ionic-native/youtube-video-player": "4.3.2",
"#ionic/storage": "2.0.1",
"cordova-android": "6.2.3",
"cordova-browser": "4.1.0",
"cordova-plugin-camera": "2.4.1",
"cordova-plugin-compat": "1.1.0",
"cordova-plugin-device": "1.1.4",
"cordova-plugin-file": "4.3.3",
"cordova-plugin-file-transfer": "1.6.3",
"cordova-plugin-filepath": "1.1.0",
"cordova-plugin-inappbrowser": "1.7.1",
"cordova-plugin-ionic-webview": "1.1.11",
"cordova-plugin-splashscreen": "~4.0.1",
"cordova-plugin-themeablebrowser": "0.2.17",
"cordova-plugin-whitelist": "1.3.1",
"cordova-plugin-youtube-video-player": "1.0.6",
"ionic-angular": "3.7.1",
"ionic-image-loader": "^4.2.1",
"ionic-plugin-keyboard": "~2.2.1",
"ionic2-super-tabs": "4.1.3",
"ionicons": "3.0.0",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},

ember cli dont compile with daterangepicker

I install ember-cli-daterangepicker. I did error server and this had working good, but I get error now. I install anything.
I do ember server and get it
File: ember-cli-daterangepicker/components/date-range-picker.js The
Broccoli Plugin: [broccoli-persistent-filter:Babel] failed with:
Error: incorrect header check
at Zlib._handle.onerror (zlib.js:370:17)
The broccoli plugin was instantiated at:
at Babel.Plugin (F:\Projects\tomaq\node_modules\broccoli-plugin\index.js:7:31)
at Babel.Filter [as constructor] (F:\Projects\tomaq\node_modules\broccoli-persistent-filter\index.js:62:10)
at new Babel (F:\Projects\tomaq\node_modules\broccoli-babel-transpiler\index.js:35:10)
at EmberApp._addonTree (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:913:29)
at EmberApp._processedVendorTree (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:947:20)
at EmberApp._processedExternalTree (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:978:21)
at EmberApp.appAndDependencies (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:1087:30)
at EmberApp.javascript (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:1217:34)
at EmberApp.toArray (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:1646:10)
at EmberApp.toTree (F:\Projects\tomaq\node_modules\ember-cli\lib\broccoli\ember-app.js:1668:30)
at module.exports (F:\Projects\tomaq\ember-cli-build.js:43:14)
at CoreObject.setupBroccoliBuilder (F:\Projects\tomaq\node_modules\ember-cli\lib\models\builder.js:72:19)
at CoreObject.init (F:\Projects\tomaq\node_modules\ember-cli\lib\models\builder.js:52:10)
at CoreObject.superWrapper [as init] (F:\Projects\tomaq\node_modules\core-object\lib\assign-properties.js:32:18)
at CoreObject.Class (F:\Projects\tomaq\node_modules\core-object\core-object.js:32:33)
at CoreObject.run (F:\Projects\tomaq\node_modules\ember-cli\lib\tasks\serve.js:15:19)
at F:\Projects\tomaq\node_modules\ember-cli\lib\commands\serve.js:76:24
at tryCatch (F:\Projects\tomaq\node_modules\rsvp\dist\rsvp.js:539:12)
at invokeCallback (F:\Projects\tomaq\node_modules\rsvp\dist\rsvp.js:554:13)
at publish (F:\Projects\tomaq\node_modules\rsvp\dist\rsvp.js:522:7)
at flush (F:\Projects\tomaq\node_modules\rsvp\dist\rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
How fix it problem?
My package.json
{
"name": "tomaq",
"version": "0.0.0",
"description": "Small description for tomaq goes here",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"repository": "",
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
},
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^2.4.1",
"ember-cli": "2.10.0",
"ember-cli-app-version": "^2.0.0",
"ember-cli-babel": "^5.1.7",
"ember-cli-daterangepicker": "0.6.0",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-g-maps": "0.5.14",
"ember-cli-htmlbars": "^1.0.10",
"ember-cli-htmlbars-inline-precompile": "^0.3.3",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-jshint": "^2.0.1",
"ember-cli-lazy-load": "0.3.0",
"ember-cli-moment-shim": "3.5.0",
"ember-cli-pagination": "3.0.2",
"ember-cli-qunit": "^3.0.1",
"ember-cli-release": "^0.2.9",
"ember-cli-sri": "^2.1.0",
"ember-cli-test-loader": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.10.0",
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-moment": "^7.3.1",
"ember-perfectscroll": "0.1.15",
"ember-resolver": "^2.0.3",
"ember-rx-shim": "0.1.4",
"ember-scrollable": "0.4.9",
"ember-simple-pagination": "1.0.1",
"ember-truth-helpers": "1.3.0",
"ember-welcome-page": "^1.0.3",
"gulp": "^3.8.0",
"gulp-compass": "^1.3.3",
"gulp-concat": "^2.2.0",
"gulp-ember-handlebars": "^0.6.0",
"gulp-imagemin": "^3.3.0",
"gulp-uglify": "^0.3.0",
"gulp-watch": "^0.6.5",
"loader.js": "^4.0.10"
},
"engines": {
"node": ">= 0.12.0"
},
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"ember-bootstrap": "^1.0.0-beta.1",
"ember-i18n": "^5.0.1",
"ember-validations": "2.0.0-alpha.5",
"gulp": "^3.9.1",
"gulp-shell": "^0.6.3",
"gulp-uglifycss": "^1.0.8"
}
}
it's problem with cache in ember. It was related to running two ember-cli processes in parallel. Change BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT path
BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT=./dist-build-cache ember-cli build -prod
When I see zlib errors, I often need to either restart my ember server or clear my node_modules folder and re-install packages. Does that resolve things for you?

Ember-simple-auth how to depend on it in an addon?

I am developing several webapps, and so, I decided to create an addon with all the ccs and bootstrap, moment and other addons to be reused.
One addon I want to use in my foundation addon is ember-simple-auth.
I declared it in as dependency, but is not included in the project when I run.
And so, in the browser I get an error of missing files.
According to #marcoow where, this sould be enough.
Application package.json:
"devDependencies": {
"broccoli-asset-rev": "^2.6.0",
"ember-ajax": "^3.0.0",
"ember-cli": "~2.14.2",
"ember-cli-app-version": "^3.0.0",
"ember-cli-babel": "^6.3.0",
"ember-cli-dependency-checker": "^2.0.1",
"ember-cli-eslint": "^4.2.0",
"ember-cli-htmlbars": "^2.0.3",
"ember-cli-htmlbars-inline-precompile": "^1.0.2",
"ember-cli-inject-live-reload": "^1.7.0",
"ember-cli-moment-shim": "^3.4.0",
"ember-cli-qunit": "^4.0.0",
"ember-cli-sass": "^7.0.0",
"ember-cli-shims": "^1.2.0-beta.2",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0-beta.1",
"ember-data": "^2.14.3",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.4.0",
"ember-models-table": "^1.13.0",
"ember-simple-auth": "^1.4.0",
"ember-source": "^2.14.1",
"loader.js": "^4.6.0",
"universe-gui": "0.2.0"
},
Addon package.json:
"dependencies": {
"ember-cli-babel": "^6.8.1",
"ember-cli-flash": "^1.4.3",
"ember-cli-htmlbars": "^2.0.3",
"ember-cli-sass": "^7.0.0",
"ember-crumbly": "1.0.7",
"ember-i18n": "5.0.2",
"ember-moment": "7.3.0",
"ember-simple-auth": "^1.4.0",
"ember-truth-helpers": "1.3.0"
}
You can use the afterInstall hook in the default blueprint:
ember g blueprint name-of-your-addon
module.exports = {
normalizeEntityName: function() {},
afterInstall: function(options) {
return RSVP.all([
this.addPackageToProject('npm-package'),
this.addAddonToProject('ember-addon')
]);
}
};
I also struggled with this when developing an addon.
This article helped a lot (even though its somewhat outdated now), along with the official documentation.

Ionic2 #angular dependency in package.json

While creating a new project using "ionic start #appName# blank --v2 --ts" command.
So it shows
"dependencies": {
"#angular/common": "^2.0.0-rc.1",
"#angular/compiler": "^2.0.0-rc.1",
"#angular/core": "^2.0.0-rc.1",
"#angular/http": "^2.0.0-rc.1",
"#angular/platform-browser": "^2.0.0-rc.1",
"#angular/platform-browser-dynamic": "^2.0.0-rc.1",
"#angular/router": "^2.0.0-rc.1",
in package.json.
What is the command to create a new project using old version of ionic2 so that is get "angular2" instead of "#angular" and can use old RouteConfig
I used this configuration for ionic2 beta 5 version.
"dependencies": {
"angular2": "2.0.0-beta.15",
"es6-shim": "^0.35.0",
"ionic-angular": "2.0.0-beta.5-201604211454",
"ionic-native": "^1.1.0",
"ionicons": "3.0.0-alpha.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "^0.6.11"
},
"devDependencies": {
"del": "2.2.0",
"gulp": "3.9.1",
"gulp-watch": "4.3.5",
"ionic-gulp-browserify-es2015": "^1.0.2",
"ionic-gulp-fonts-copy": "^1.0.0",
"ionic-gulp-html-copy": "^1.0.0",
"ionic-gulp-sass-build": "^1.0.0",
"ionic-gulp-scripts-copy": "^1.0.0",
"run-sequence": "1.1.5"
}
you have to delete all from node_modules folder, change package.config file with config from above and run npm install
But you have to take in consideration that this is an old version of ionic (beta5) and angular. My suggestion is to use the latest versions