Note that there are some explanatory texts on larger screens.

plurals
  1. POError in scripting using angularjs, requirejs and karma
    text
    copied!<p>I'm getting a <em>script error</em> every time I try to load the angularjs to a test file.</p> <p>When I try to put the angularjs in the requirejs define block, I get an error.</p> <p><strong>karma conf:</strong></p> <pre><code> module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', 'requirejs'], files: [ {pattern: 'C:/workspaces/trunk/pearl/client/components/angular/angular.js', included: false}, {pattern: '../components/angular-mocks/angular-mocks.js', included: false}, {pattern: '**/*Spec.js', included: false}, 'test-main.js' ], reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_DEBUG, autoWatch: false, browsers: ['PhantomJS'], captureTimeout: 60000, singleRun: true }); }; </code></pre> <p><strong>test conf:</strong></p> <pre><code>var tests = []; for (var file in window.__karma__.files) { if (window.__karma__.files.hasOwnProperty(file)) { if (/Spec\.js$/.test(file)) { tests.push(file); } } } requirejs.config({ paths: { 'angular': '../components/angular/angular', 'angular-mocks': '../components/angular-mocks/angular-mocks' }, shim: { 'angular': {exports: 'angular'}, 'angular-mocks': { deps: ['angular'] } }, // ask Require.js to load these files (all our tests) deps: tests, // start test run, once Require.js is done callback: window.__karma__.start }); </code></pre> <p><strong>test file:</strong></p> <pre><code>define(['angular'], function () { describe('example test', function () { it('should pass the test', function () { expect(true).toBe(true); }) }); }); </code></pre> <p>When i try to run this, I get this error message:</p> <pre><code>PhantomJS 1.9.1 (Windows 7): Executed 0 of 0 SUCCESS (0 secs / 0 secs) PhantomJS 1.9.1 (Windows 7) ERROR Error: Script error for: angular http://requirejs.org/docs/errors.html#scripterror at C:/workspaces/trunk/pearl/client/node_modules/karma-requirejs/lib/require.js:138 PhantomJS 1.9.1 (Windows 7): Executed 0 of 0 ERROR (0.06 secs / 0 secs) </code></pre> <p><strong>All files loaded as you can see here:</strong></p> <pre><code>C:\workspaces\trunk\pearl\client\example&gt;grunt test Running "karma:unit" (karma) task DEBUG [plugin]: Loading karma-* from C:\workspaces\trunk\pearl\client\node_modules DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-chrome-launcher. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-coffee-preprocessor. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-firefox-launcher. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-html2js-preprocessor. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-jasmine. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-phantomjs-launcher. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-requirejs. DEBUG [plugin]: Loading plugin C:\workspaces\trunk\pearl\client\node_modules/karma-script-launcher. DEBUG [plugin]: Loading inlined plugin (defining ). INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/ INFO [launcher]: Starting browser PhantomJS DEBUG [launcher]: Creating temp dir at C:\Users\nirk\AppData\Local\Temp\karma-30300678 DEBUG [launcher]: C:\Program Files (x86)\phantomjs\phantomjs.exe C:\Users\nirk\AppData\Local\Temp\karma-30300678/capture.js DEBUG [watcher]: Resolved files: C:/workspaces/trunk/pearl/client/node_modules/karma-requirejs/lib/require.js C:/workspaces/trunk/pearl/client/node_modules/karma-requirejs/lib/adapter.js C:/workspaces/trunk/pearl/client/node_modules/karma-jasmine/lib/jasmine.js C:/workspaces/trunk/pearl/client/node_modules/karma-jasmine/lib/adapter.js C:/workspaces/trunk/pearl/client/components/angular/angular.js C:/workspaces/trunk/pearl/client/example/welcomeScreen/welcomScreenSpec.js C:/workspaces/trunk/pearl/client/example/test-main.js </code></pre> <p>Why does the angularjs shows an error?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload