@@ -2,6 +2,9 @@ var cwd = process.cwd();
22var path = require ( 'path' ) ;
33var initJspm = require ( '../src/init' ) ;
44
5+ var normalPath = function ( path ) {
6+ return path . replace ( / \\ / g, '/' ) ;
7+ }
58
69describe ( 'jspm plugin init' , function ( ) {
710 var files , jspm , client ;
@@ -11,7 +14,7 @@ describe('jspm plugin init', function(){
1114 files = [ ] ;
1215 jspm = {
1316 config : 'custom_config.js' ,
14- loadFiles : [ 'src/**/*.js' ] ,
17+ loadFiles : [ 'src/**/*.js' , { pattern : 'not-cached.js' , nocache : true } ] ,
1518 packages : 'custom_packages/' ,
1619 serveFiles : [ 'testfile.js' ]
1720 } ;
@@ -21,22 +24,22 @@ describe('jspm plugin init', function(){
2124 } ) ;
2225
2326 it ( 'should add config.js to the top of the files array' , function ( ) {
24- expect ( files [ 3 ] . pattern ) . toEqual ( basePath + '/custom_config.js' ) ;
27+ expect ( normalPath ( files [ 3 ] . pattern ) ) . toEqual ( normalPath ( basePath + '/custom_config.js' ) ) ;
2528 expect ( files [ 3 ] . included ) . toEqual ( true ) ;
2629 } ) ;
2730
2831 it ( 'should add adapter.js to the top of the files array' , function ( ) {
29- expect ( files [ 2 ] . pattern ) . toEqual ( basePath + '/src/adapter.js' ) ;
32+ expect ( normalPath ( files [ 2 ] . pattern ) ) . toEqual ( normalPath ( basePath + '/src/adapter.js' ) ) ;
3033 expect ( files [ 2 ] . included ) . toEqual ( true ) ;
3134 } ) ;
3235
3336 it ( 'should add systemjs-polyfills to the top of the files array' , function ( ) {
34- expect ( files [ 1 ] . pattern ) . toEqual ( basePath + '/custom_packages/system-polyfills.src.js' ) ;
37+ expect ( normalPath ( files [ 1 ] . pattern ) ) . toEqual ( normalPath ( basePath + '/custom_packages/system-polyfills.src.js' ) ) ;
3538 expect ( files [ 1 ] . included ) . toEqual ( true ) ;
3639 } ) ;
3740
3841 it ( 'should add systemjs to the top of the files array' , function ( ) {
39- expect ( files [ 0 ] . pattern ) . toEqual ( basePath + '/custom_packages/system.src.js' ) ;
42+ expect ( normalPath ( files [ 0 ] . pattern ) ) . toEqual ( normalPath ( basePath + '/custom_packages/system.src.js' ) ) ;
4043 expect ( files [ 0 ] . included ) . toEqual ( true ) ;
4144 } ) ;
4245
@@ -45,17 +48,24 @@ describe('jspm plugin init', function(){
4548 } ) ;
4649
4750 it ( 'should add files from jspm.serveFiles to the end of the files array as served files' , function ( ) {
48- expect ( files [ files . length - 1 ] . pattern ) . toEqual ( cwd + '/testfile.js' ) ;
51+ expect ( normalPath ( files [ files . length - 1 ] . pattern ) ) . toEqual ( normalPath ( cwd + '/testfile.js' ) ) ;
4952 expect ( files [ files . length - 1 ] . included ) . toEqual ( false ) ;
5053 expect ( files [ files . length - 1 ] . served ) . toEqual ( true ) ;
5154 expect ( files [ files . length - 1 ] . watched ) . toEqual ( true ) ;
5255 } ) ;
5356
5457 it ( 'should use the configured jspm_packages path and include it in the files array' , function ( ) {
55- expect ( files [ 4 ] . pattern ) . toEqual ( path . resolve ( cwd , './custom_packages/**/*' ) ) ;
58+ expect ( normalPath ( files [ 4 ] . pattern ) ) . toEqual ( normalPath ( path . resolve ( cwd , './custom_packages/**/*' ) ) ) ;
5659 expect ( files [ 4 ] . included ) . toEqual ( false ) ;
5760 expect ( files [ 4 ] . served ) . toEqual ( true ) ;
5861 expect ( files [ 4 ] . watched ) . toEqual ( false ) ;
5962 } ) ;
6063
64+ it ( 'should assign true to nocache option to served files with nocache option in jspm.loadFiles' , function ( ) {
65+ expect ( normalPath ( files [ files . length - 2 ] . pattern ) ) . toEqual ( normalPath ( cwd + '/not-cached.js' ) ) ;
66+ expect ( files [ files . length - 2 ] . included ) . toEqual ( false ) ;
67+ expect ( files [ files . length - 2 ] . served ) . toEqual ( true ) ;
68+ expect ( files [ files . length - 2 ] . watched ) . toEqual ( true ) ;
69+ expect ( files [ files . length - 2 ] . nocache ) . toEqual ( true ) ;
70+ } ) ;
6171} ) ;
0 commit comments