Deployment Error with Sencha SDK Tool - model-view-controller

I'm trying to deploy my extJS-Application, which is in MVC-Architecture style.
As described in the extJS Docs I've first tried to generate a JSB3 File with sencha create jsb -a index.html -p app.jsb3.
Sadly I've got the following error: undefined:0 TypeError: 'null' is not a constructor
I'm working on MAC OS X with Sencha Command v1.2.2.
Thanks for any help!

got the same error. On windows 7. Ext 4.0.2. Not sure how to troubleshoot this.

make sure that you include ext-dev.js in your app and you don't have any warnings/errors in Firebug/WebInspector.
Also check this thread: [SDKTOOLS-3] buggy Sencha SDK Tools

Two days ago I was suffering such type of problem. Due to my absent mind I forgot to requires some of Ext or Ext.ux class. So think some of your Extjs Class may be missing. just requires it as I pointed or add these library to your Controller/Viewport/View/Store.
Ext.Loader.setConfig({
enabled : enabled
});
Ext.Loader.setPath('Your.ns', 'app');
Ext.Loader.setPath('Ext.ux', 'ux');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ModelMgr.*',
'Ext.panel.Panel',
'Ext.button.Button',
'Ext.window.Window',
'Ext.toolbar.TextItem',
'Ext.menu.Menu',
'Ext.toolbar.Spacer',
'Ext.button.Split',
'Ext.form.field.TextArea',
'Ext.toolbar.Paging',
'Ext.ModelManager',
'Ext.tip.QuickTipManager',
'Ext.tree.Column',
'Ext.tree.Panel',
'Ext.tree.View',
'Ext.Loader',
//..........................................
// --Your Missing require library add here--
//................................... ......
'Ext.ux.grid.RowEditor',
'Ext.ux.data.PagingMemoryProxy',
'Ext.ux.PreviewPlugin',
'Ext.ux.ProgressBarPager',
'Ext.ux.statusbar.StatusBar',
]);
Ext.application({
name : 'Your.ns',
appFolder : 'app',
controllers : ['Your controllers'],
models : ['Your models'],
stores : ['Your stores'],
views : ['Your views'],
launch : function() {
//TODO
},
autoCreateViewport: true
});
or add your missing class in requires array
Ext.define('Your.ns.controller.YourController', {
extend : 'Ext.app.Controller',
requires : ['your required class1 here', 'your required class2 here'],
views : [],
refs : [{
ref : '',
selector : 'window'
}],
init : function() {
this.control({
// your action
});
},
//your code here
});
I think this code may be helpful.

Related

How do i fix DEPRECATION: The matcher factory for "toHaveBeenTriggeredOnAndWith"?

Can anyone tell me what needs to be changed this test?
it('Should update settings of bar', () => {
const newSettings = {
dataset: [
{
data: [{
name: 'Category A',
value: 373,
color: '#1D5F8A',
id: 1
}],
name: ''
}
]
};
barObj.updated(newSettings);
const dataLength = barObj.settings.dataset[0].data.length;
expect(dataLength).toEqual(1);
});
I am getting this error from Jasmine and if i follow the link https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#matchers-cet i dont see exactly what i would need to change?
ERROR: 'DEPRECATION: The matcher factory for "toHaveBeenTriggeredOnAndWith" accepts custom equality testers, but this parameter will no longer be passed in a future release. See https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#matchers-cet for details. (in spec: Bar API Should update settings of bar)
I also cant find a lot of information about this message. I also dont have any custom equality matchers in the system. https://jasmine.github.io/tutorials/custom_equality
Try to update karma-jasmine package. It helped me.
I had this problem using "#metahub/karma-jasmine-jquery". You can modify the bundle in place and remove the second parameter from the `` toHaveBeenTriggeredOnAndWith" function. Or copy the module somewhere, uninstall "#metahub/karma-jasmine-jquery" and install the modified module: npm install ./#metahub/karma-jasmine-jquery

Find a good way to get a coverage report on ES6 code

Here is my problem : in an AngularJS project, I use Babel 6 (ES2015 + stage3 + decorators), SystemJS and Karma + Jasmine.
All is OK, except for code coverage : I can't find a good way to get a coverage report on ES6 code instead of transpiled ES5.
I have some restrictions :
no Github npm dependencies
no deprecated projects (like isparta)
should run on Windows (yeah, I know, but I have to) and GNU/Linux
This question is especially oriented to a local html coverage report, but I also need a format that could be used in SonarQube.
There seems to be a huge lake of support on this question (especially with Decorators and SystemJS), so, along with some issues on Github, maybe the stackoverflow community could share a way to do this.
If you need some extras, you can see this project on Github (Sedona-Solutions/sdn-angularjs-seed), and look at the related issues (Sedona-Solutions/sdn-angularjs-seed#5) with references to all related issues and projects I could found.
About remap-istanbul
Here is my transpilation and mapping gulp task :
gulp.task('es6', function () {
return gulp.src(paths.source, { base: 'app' })
.pipe(plumber())
.pipe(changed(paths.output, { extension: '.js' }))
.pipe(sourcemaps.init())
.pipe(babel(compilerOptions))
.pipe(ngAnnotate({
sourceMap: true,
gulpWarnings: false
}))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(paths.output))
});
Karma-coverage
coverageReporter: {
reporters: [
{
type: 'json',
dir: 'target/coverage/',
subdir: '.',
file: 'coverage-final.json'
}
]
}
and the test:remap gulp task :
gulp.task('test:remap', ['test'], function (done) {
return gulp.src(paths.coverage + '/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'json': paths.coverage + '/coverage.json',
'html': paths.coverage + '/html-remaped/'
},
fail: true,
useAbsolutePaths: true
}));
});
due to the first remap-istanbul issue, I get the following error :
C:\...\sdn-angularjs-seed\node_modules\remap-istanbul\node_modules\istanbul\lib\report\html.js:288
text = structuredText[startLine].text;
^
TypeError: Cannot read property 'text' of undefined
at C:\...\sdn-angularjs-seed\node_modules\remap-istanbul\node_modules\istanbul\lib\report\html.js:288:53
You can see the corresponding code on github.
It could be an error on some mapping generation, or paths ... If you think so, tell me.
karma-coverage + remap-istanbul should work fine

Uncaught Error: Module name "lib/chai" has not been loaded yet for context: use require([])

i m using karma-mocha ..my karma.conf file is working with karma-jasmine...but not working with karma-mocha....my karma.conf file:--
module.exports = function(config){
config.set({
basePath : '../app',
preprocessors: {
'**/*.html':'ng-html2js'
},
ngHtml2JsPreprocessor: {
prependPrefix: '/'
},
files : [
'node_modules/jquery/**/*.js',
'lib/angular/angular.js',
'lib/angular/angular-*.js',
'../test/lib/angular-mocks.js',
'../test/lib/sinon-1.15.0.js',
'../test/chai/chai.js',
'js/**/*.js',
'../test/unit/**/*.js',
'**/*.html'
],
autoWatch : true,
frameworks: ['mocha','requirejs','chai'],
browsers : ['Chrome'],
plugins : [
'karma-chrome-launcher',
'karma-mocha',
'karma-ng-html2js-preprocessor',
'karma-requirejs',
'karma-chai'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};
you are missing chai lib path files array in which is dependency to mocha.include it.
files : [
'node_modules/jquery/**/*.js',
'lib/angular/angular.js',
'lib/angular/angular-*.js',
'../test/lib/angular-mocks.js',
'../test/lib/sinon-1.15.0.js',
'../test/chai/chai.js',
'js/**/*.js',
'../test/unit/**/*.js',
'**/*.html'
],
I came across a similar situation just with Jasmine.
I'd like to introduce my solution.
Try it what is written in the error message. There is a link to a website: http://requirejs.org/docs/errors.html#notloaded
//If this code is not in a define call,
//DO NOT use require('foo'), but use the async
//callback version:
require(['foo'], function (foo) {
//foo is now loaded.
});
My case written for Jasmine in Coffee script looks like this:
sinon = require(['sinon', 'jasmine-sinon']) (foo)->
Now I can use sinon as an object in my unit test and can also follow the documentation of sinon, as well as jasmin-sinon.

Trouble getting Ember Validations to work

Since Ember doesn't support form validation out of the box (as of this writing anyway), I am looking for a way to validate forms. I came across Dockyards ember-validations and the consensus seems to be that this is the goto module for form validation in EmberJS.
I'm trying to get it to work, but I'm having some trouble getting started.
I'm not using Ember CLI as referenced in the docs, so I have downloaded a compiled ember-validations.js from http://builds.dockyard.com/ and have included ember-validations.js in my apps js file.
The docs now say to pass the validations.mixin into a controller:
So I'm using:
App.MemberaddController = App.FamilyController.extend(EmberValidations.Mixin,{
needs: ["family","notifications"],
familyController: Em.computed.alias('controllers.family'),
notifications: Em.computed.alias('controllers.notifications'),
validations: {
firstname: {
presence: true,
presence : {message: 'mag niet leeg zijn'}
}
},
init: function() {
this.set('familyController.pageTitle', "Gezinslid toevoegen");
},
<etc...>
}
However in the browser I'm seeing
Uncaught ReferenceError: EmberValidations is not defined
Looking at the ember-validations.js I can see the mixin file being referenced as Ember.Validations.Mixin.
So when I pass that to my controller, like
App.MemberaddController = App.FamilyController.extend(Ember.Validations.Mixin,{
I'm seeing:
Error while processing route: memberadd Cannot read property 'invoke' of undefined TypeError: Cannot read property 'invoke' of undefined
In the ember-validations.js file at the _validate function.
What am I doing wrong here?
First on the off chance this is a new project and you have the option to use ember-cli I recommend you do so, the community is moving in that direction.
That said I think your bug is in here
validations: {
firstname: {
presence: true, <-- uneeded
presence <-- remove this space: {message: 'mag niet leeg zijn'}
}
},
should look like this
validations: {
firstname: {
presence: {message: 'mag niet leeg zijn'}
}
},

Attaching multiple views to a controller in ExtJS 4 MVC

This is using the standard ExtJS 4 MVC library and structure.
I am trying to attach multiple views to a single controller so I can create instances of them later to add to panels. Unfortunately I am getting errors about the view when I add the second one and ExtJS is blocking the syntax errors it appears so that I am unable to see where the issue is.
If I comment out ViewOrders from the list below it works fine, but if it is in there then I get the following error:
An uncaught error was raised with the following data: ext-all-debug-with-comments.js (line 7864)
msg:
"The following classes are not declared even if their files have been loaded: 'PVAL_App.view.ViewOrders'. Please check the source code of their corresponding files for possible typos: 'app/view/ViewOrders.js'"
sourceClass: "Ext.Loader"
sourceMethod: "onFileLoaded"
Here is my controller:
Ext.define('PVAL_App.controller.Viewport', {
extend: 'Ext.app.Controller',
views: [
'Viewport', 'ViewOrders'
],
init: function() {
console.log('Viewport controller init()');
}
});
Here is my ViewOrders view:
Ext.define('PVAL_APP.view.ViewOrder', {
/* Begin Definitions */
extend: 'Ext.panel.Panel',
alias: 'widget.ViewOrders',
requires: [
'Ext.panel.Panel',
'Ext.data.ArrayStore'
],
border:false,
layout: 'fit',
//autoScroll: true,
initComponent: function() {
}
});
I doubt this is needed but this is my application file:
Ext.Loader.setConfig(
{
enabled: true
});
Ext.application({
name: 'PVAL_App',
appFolder: 'app',
autoCreateViewport: true,
controllers: [
'PVAL_App', 'Viewport'
],
launch:function() {
// Nothing yet.
//console.log(this.controllers);
}
});
I cannot seem to figure out if it is a syntax error or if this is an issue with the framework. I have experienced close to the same issue if I try to link to another controller from within one which makes me believe that this might be a constraint of the framework.
The problem here is that the class name in your app/view/ViewOrders.js script does not match the view name. Instead of Ext.define('PVAL_APP.view.ViewOrder', { you need the plural (and correct case) Ext.define('PVAL_App.view.ViewOrders', {. Either that our you can change your filename and refernece to the singular and just correct the case.

Resources