AngularJS with ngTable, testing with Intern -
i trying setup intern testing angularjs app has ngtable dependency.
so test file accountcontroller:
define([ 'intern/chai!expect', 'intern!bdd', 'intern/order!nonngdependencies/non-angular-dependencies.min.js', 'intern/order!angular/angular', 'intern/order!angular-mocks/angular-mocks', 'intern/order!ui.router/release/angular-ui-router', 'intern/order!ngresource/angular-resource', 'intern/order!bower_components/ng-table/dist/ng-table.js', 'intern/order!im/app', 'intern/order!im/account/accountservice', 'intern/order!im/account/accountcontroller' ], function (expect, bdd) { function inject (fn) { return function () { angular.injector(['ng', 'ngmock', 'ui.router', 'ngtable', 'integrationmanager']).invoke(fn); } } bdd.describe('accountcontroller', function () { var ctrl, scope; bdd.beforeeach(inject(function ($controller, $rootscope) { scope = $rootscope.$new(); ctrl = $controller('accountcontroller', { $scope: scope }); })); bdd.it('should return true', function () { expect(scope.istrue()).to.true; }); bdd.it('should not have accounts start', function () { expect(scope.accounts).to.be.undefined; }); }); });
my internjs config file:
// learn more configuring file @ <https://github.com/theintern/intern/wiki/configuring-intern>. // these default settings work ok people. options *must* changed below // packages, suites, excludeinstrumentation, , (if want functional tests) functionalsuites. define({ // port on instrumenting proxy listen proxyport: 9000, // qualified url intern proxy proxyurl: 'http://localhost:9000/', // default desired capabilities environments. individual capabilities can overridden of // specified browser environments in `environments` array below well. see // https://code.google.com/p/selenium/wiki/desiredcapabilities standard selenium capabilities , // https://saucelabs.com/docs/additional-config#desired-capabilities sauce labs capabilities. // note `build` capability filled in current commit id travis ci environment // automatically capabilities: { 'selenium-version': '2.41.0' }, // browsers run integration testing against. note version numbers must strings if used sauce // ondemand. options permutated browsername, version, platform, , platformversion; other // capabilities options specified environment copied as-is environments: [ // { browsername: 'internet explorer', version: '11', platform: 'windows 8.1' }, // { browsername: 'internet explorer', version: '10', platform: 'windows 8' }, // { browsername: 'internet explorer', version: '9', platform: 'windows 7' }, // { browsername: 'firefox', version: '28', platform: [ 'os x 10.9', 'windows 7', 'linux' ] }, { browsername: 'chrome', version: '34', platform: [ 'os x 10.9', 'windows 7', 'linux' ] }, // { browsername: 'safari', version: '6', platform: 'os x 10.8' }, // { browsername: 'safari', version: '7', platform: 'os x 10.9' } ], // maximum number of simultaneous integration tests should executed on remote webdriver service maxconcurrency: 3, // name of tunnel class use webdriver tests tunnel: 'saucelabstunnel', tunneloptions: { 'username': '*****', 'accesskey': '**********************' }, // desired amd loader use when running unit tests (client.html/client.js). omit use default dojo // loader useloader: { 'host-node': 'dojo/dojo', 'host-browser': 'node_modules/dojo/dojo.js' }, // configuration options module loader; amd configuration options supported specified amd loader // can used here loader: { // packages should registered loader in each testing environment packages: [ { name: 'im', location: 'js/src' }, { name: 'angular', location: 'bower_components/angular' }, { name: 'angular-mocks', location: 'bower_components/angular-mocks' }, { name: 'ui.router', location: 'bower_components/angular-ui-router' }, { name: 'ngtable', location: 'bower_components/ng-table/dist' }, { name: 'ngresource', location: 'bower_components/angular-resource' }, { name: 'nonngdependencies', location: 'tests'} ] }, // non-functional test suite(s) run in each browser suites: [ 'tests/all' ], // functional test suite(s) run in each browser once non-functional tests completed functionalsuites: [ /* 'mypackage/tests/functional' */ ], // regular expression matching urls files should not included in code coverage analysis excludeinstrumentation: /^(?:tests|bower_components|node_modules)\// });
the error when trying run intern is:
undefined: failed load module angular/main /bower_components/angular/main.js (parent: bower_components/ng-table/dist/ng-table) error: failed load module angular/main /bower_components/angular/main.js (parent: bower_components/ng-table/dist/ng-table) @ htmlscriptelement.handler <__intern/node_modules/dojo/dojo.js:731:13> no unit test coverage chrome 34.0.1847.116 on windows nt
from error, guess isn't able load ngtable, not sure start.
any advice on how troubleshoot this?
Comments
Post a Comment