2014-05-17 1 views
5

Ich versuche, es für ein paar Stunden herauszufinden, und ich denke, dass es mit meiner falsch konfigurierten requirjs-Datei ('test.main.js') zu tun hat, aber ich bin nicht ganz sicher, also kann mir bitte jemand erklären, was ist falsch?Warum bekomme ich 'Es gibt keinen Zeitstempel für /base/src/tests/core/types.tests'?

Wenn Sie weitere Informationen von mir benötigen, würde ich gerne zur Verfügung stellen.

Hier ist die Ausgabe des Stack-Trace.

Eyal [email protected] /d/Projects/Code/Development/tsToolkit 
$ ./karma.sh start 
INFO [karma]: Karma v0.12.16 server started at http://localhost:8380/ 
INFO [IE 11.0.0 (Windows 7)]: Connected on socket GCSNAkUAY24F-MN7dkGQ with id manual-4464 
IE 11.0.0 (Windows 7) ERROR: 'There is no timestamp for /base/src/tests/core/types.tests!' 

WARN [web-server]: 404: /base/src/tests/core/types.tests 
IE 11.0.0 (Windows 7) ERROR 
    Script error for: /base/src/tests/core/types.tests 
    http://requirejs.org/docs/errors.html#scripterror 
    at D:/Projects/Code/Development/tsToolkit/node_modules/requirejs/require.js:141 

Hier ist die Verzeichnisstruktur I atm bin mit.

. 
|-- WebEssentials-Settings.json 
|-- jake.sh 
|-- jakefile.js 
|-- karma.sh 
|-- node_modules 
| |-- jake 
| | |-- Jakefile 
| | |-- Makefile 
| | |-- README.md 
| | |-- bin 
| | |-- lib 
| | |-- node_modules 
| | |-- package.json 
| | `-- test 
| |-- jasmine-node 
| | |-- Gruntfile.coffee 
| | |-- LICENSE 
| | |-- README.md 
| | |-- bin 
| | |-- bower.json 
| | |-- index.js 
| | |-- lib 
| | |-- node_modules 
| | |-- package.json 
| | |-- scripts 
| | |-- spec 
| | `-- src 
| |-- karma 
| | |-- CHANGELOG.md 
| | |-- LICENSE 
| | |-- README.md 
| | |-- bin 
| | |-- config.tpl.coffee 
| | |-- config.tpl.js 
| | |-- config.tpl.ls 
| | |-- karma-completion.sh 
| | |-- lib 
| | |-- node_modules 
| | |-- package.json 
| | |-- requirejs.config.tpl.coffee 
| | |-- requirejs.config.tpl.js 
| | `-- static 
| |-- karma-jasmine 
| | |-- LICENSE 
| | |-- README.md 
| | |-- lib 
| | `-- package.json 
| |-- karma-requirejs 
| | |-- LICENSE 
| | |-- README.md 
| | |-- lib 
| | `-- package.json 
| |-- karma-requirejs-preprocessor 
| | `-- index.js 
| |-- requirejs 
| | |-- README.md 
| | |-- bin 
| | |-- package.json 
| | `-- require.js 
| `-- shelljs 
|  |-- LICENSE 
|  |-- README.md 
|  |-- bin 
|  |-- global.js 
|  |-- make.js 
|  |-- package.json 
|  |-- scripts 
|  |-- shell.js 
|  `-- src 
|-- scratchpad.txt 
|-- src 
| |-- app.main.js 
| |-- app.main.js.map 
| |-- app.main.ts 
| |-- framework 
| | |-- core 
| | |-- css 
| | `-- widgets 
| |-- index.html 
| |-- libs 
| | |-- jquery-2.1.0.js 
| | |-- require.js 
| | `-- typings 
| |-- tests 
| | |-- core 
| | `-- test.main.js 
| |-- tsToolkit.csproj 
| |-- tsToolkit.csproj.user 
| |-- web.Debug.config 
| |-- web.Release.config 
| `-- web.config 
|-- tools 
| |-- karma 
| | |-- karma.conf.js 
| | `-- karma.conf.js.back 
| `-- mocha 
|  `-- mocha.ext.js 
|-- tsToolkit.sln 
|-- tsToolkit.sln.DotSettings.user 
`-- tsToolkit.v12.suo 

41 directories, 59 files 

Hier ist die Konfigurationsdatei für Karma.

// Karma configuration 
// Generated on Fri May 16 2014 08:27:07 GMT+0300 (Jerusalem Daylight Time) 

module.exports = function(config) { 
    config.set({ 

     // base path that will be used to resolve all patterns (eg. files, exclude) 
     basePath: '../../', 


     // frameworks to use 
     // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 
     frameworks: ['jasmine', 'requirejs'], 


     // list of files/patterns to load in the browser 
     files: [ 
      {pattern: 'src/libs/*.js', included: false}, 
      {pattern: 'src/framework/**/*.js', included: false}, 
      {pattern: 'src/tests/**/*tests.js', included: false}, 
      'src/tests/test.main.js' 
     ], 


     // list of files to exclude 
     exclude: [ 
      'src/app.main.js' 
     ], 


     // preprocess matching files before serving them to the browser 
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 
     preprocessors: { 

     }, 


     // test results reporter to use 
     // possible values: 'dots', 'progress' 
     // available reporters: https://npmjs.org/browse/keyword/karma-reporter 
     reporters: ['progress'], 


     // web server port 
     port: 8380, 


     // enable/disable colors in the output (reporters and logs) 
     colors: true, 


     // level of logging 
     // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 
     logLevel: config.LOG_INFO, 


     // enable/disable watching file and executing tests whenever any file changes 
     autoWatch: true, 


     // start these browsers 
     // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 
     browsers: [], 


     // Continuous Integration mode 
     // if true, Karma captures browsers, runs the tests and exits 
     singleRun: false 
    }); 
}; 

und schließlich hier ist meine Datei 'test.main.js' Setup requirejs für Karma.

var tests = []; 
for (var file in window.__karma__.files) { 
    if (window.__karma__.files.hasOwnProperty(file)) { 
     if (/\.tests\.js$/.test(file)) { 
      tests.push(file.replace(/\.js$/, "")); 
     } 
    } 
} 

requirejs.config({ 
    baseUrl: '/base', 
    deps: tests, 
    callback: window.__karma__.start 
}); 
+0

Dies kann auch passieren, wenn die Dateien nicht existieren, wie in [diese Antwort auf eine ähnliche Frage] beschrieben (http://stackoverflow.com/a/37259893/26510) –

Antwort

9

Es tooks mir wenige Tage, um herauszufinden, waren die Wege falsch überall sowohl in meinen Karma-Konfigurationsdateien und die Datei requirejs ‚tests.main.js‘.

Also, was ich tat, ging zu Karma - RequireJS Tutorial, heruntergeladen project von Github und im Grunde restrukturieren es Stück für Stück, um zu verstehen, warum es nicht in meinem eigenen Projekt funktioniert.

Ich hatte zwei wiederkehrende Fehler und beide auf falsche Pfade bezogen, so dass ich die full solution in einer anderen Frage, die ich bei StackOverflow fragte geschrieben.

Die Lösung ist jetzt verfügbar unter GitHub.

Verwandte Themen