@@ -4,33 +4,36 @@ const mm = require('mm');
44const assert = require ( 'assert' ) ;
55const utils = require ( '../utils' ) ;
66
7- describe ( 'test/load_file.test.js' , function ( ) {
7+ describe ( 'test/load_file.test.js' , ( ) => {
88 let app ;
99 afterEach ( mm . restore ) ;
1010 afterEach ( ( ) => app . close ( ) ) ;
1111
12- it ( 'should load file' , function ( ) {
12+ it ( 'should load file' , ( ) => {
1313 app = utils . createApp ( 'load_file' ) ;
1414 const exports = app . loader . loadFile ( utils . getFilepath ( 'load_file/obj.js' ) ) ;
1515 assert . deepEqual ( exports , { a : 1 } ) ;
1616 } ) ;
1717
18- it ( 'should load file when exports is function' , function ( ) {
18+ it ( 'should load file when exports is function' , ( ) => {
1919 app = utils . createApp ( 'load_file' ) ;
2020 const exports = app . loader . loadFile ( utils . getFilepath ( 'load_file/function.js' ) , 1 , 2 ) ;
2121 assert . deepEqual ( exports , [ 1 , 2 ] ) ;
2222 } ) ;
2323
24- it ( 'should throw with filepath when file syntax error' , function ( ) {
24+ it ( 'should throw with filepath when file syntax error' , ( ) => {
2525 assert . throws ( ( ) => {
2626 app = utils . createApp ( 'syntaxerror' ) ;
2727 app . loader . loadCustomApp ( ) ;
2828 } , / P a r s e E r r o r : U n e x p e c t e d t o k e n / ) ;
2929 } ) ;
3030
31- it ( 'should load custom file' , function ( ) {
31+ it ( 'should load custom file' , ( ) => {
3232 app = utils . createApp ( 'load_file' ) ;
33- const result = app . loader . loadFile ( utils . getFilepath ( 'load_file/no-js.yml' ) ) . toString ( ) ;
33+ let result = app . loader . loadFile ( utils . getFilepath ( 'load_file/no-js.yml' ) ) . toString ( ) ;
34+ if ( process . platform === 'win32' ) {
35+ result = result . replace ( / \r \n / g, '\n' ) ;
36+ }
3437 assert ( result === '---\nmap:\n a: 1\n b: 2' ) ;
3538 } ) ;
3639} ) ;
0 commit comments