Skip to content

Commit

Permalink
Merge pull request #722 from ckeditor/ck/10141
Browse files Browse the repository at this point in the history
Fix (utils): The `tools.clean()` function will resolve paths correctly on Windows environments. Closes ckeditor/ckeditor5#10141.
  • Loading branch information
psmyrek authored Aug 19, 2021
2 parents 8fbe6ce + 035ba43 commit 58d1836
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ckeditor5-dev-utils/lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ module.exports = {
clean( rootDir, glob, options = { verbosity: 'info' } ) {
const del = require( 'del' );

return del( path.join( rootDir, glob ) )
const joinedPath = path.join( rootDir, glob );
const normalizedPath = joinedPath.split( '\\' ).join( '/' );

return del( normalizedPath )
.then( paths => {
const log = require( './logger' )( options.verbosity );

Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-dev-utils/tests/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,13 @@ describe( 'utils', () => {
expect( infoSpy.secondCall.args[ 0 ] ).to.match( new RegExp( files[ 1 ] ) );
} );
} );

it( 'works with paths that contain backslash', () => {
return tools.clean( 'test\\path', '**\\packages' )
.then( () => {
expect( delArg ).to.equal( path.join( 'test/path', '**/packages' ) );
} );
} );
} );
} );
} );

0 comments on commit 58d1836

Please sign in to comment.