-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from ckeditor/t/297
Fix: Fixed paths in webpack-plugin for Windows environment. Closes #297.
- Loading branch information
Showing
3 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = { | ||
CKEditor5CoreRegExp: /.+[/\\]ckeditor5-core/, | ||
CKEditor5PackageNameRegExp: /[/\\]ckeditor5-[^/\\]+[/\\]/, | ||
CKEditor5PackageSrcFileRegExp: /[/\\]ckeditor5-[^/\\]+[/\\]src[/\\].+\.js$/ | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const { expect } = require( 'chai' ); | ||
const utils = require( '../lib/utils.js' ); | ||
|
||
describe( 'webpack-plugin/utils', () => { | ||
describe( 'CKEditor5CoreRegExp', () => { | ||
it( 'should match CKEditor5 core package on Unix systems', () => { | ||
const path = 'path/to/the/ckeditor5-core/src/file.js'; | ||
|
||
const match = path.match( utils.CKEditor5CoreRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( 'path/to/the/ckeditor5-core' ); | ||
} ); | ||
|
||
it( 'should match CKEditor5 core package on Windows systems', () => { | ||
const path = 'C:\\some path\\to\\the\\ckeditor5-core\\src\\file.js'; | ||
|
||
const match = path.match( utils.CKEditor5CoreRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( 'C:\\some path\\to\\the\\ckeditor5-core' ); | ||
} ); | ||
} ); | ||
|
||
describe( 'CKEditor5PackageNameRegExp', () => { | ||
it( 'should match CKEditor5 package name on Unix systems', () => { | ||
const path = 'path/to/the/ckeditor5-enter/src/file.js'; | ||
|
||
const match = path.match( utils.CKEditor5PackageNameRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( '/ckeditor5-enter/' ); | ||
} ); | ||
|
||
it( 'should match CKEditor5 package name on Windows systems', () => { | ||
const path = 'C:\\some path\\to\\the\\ckeditor5-enter\\src\\file.js'; | ||
|
||
const match = path.match( utils.CKEditor5PackageNameRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( '\\ckeditor5-enter\\' ); | ||
} ); | ||
} ); | ||
|
||
describe( 'CKEditor5PackageSrcFileRegExp', () => { | ||
it( 'should match CKEditor5 package src file on Unix systems', () => { | ||
const path = 'path/to/the/ckeditor5-enter/src/file.js'; | ||
|
||
const match = path.match( utils.CKEditor5PackageSrcFileRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( '/ckeditor5-enter/src/file.js' ); | ||
} ); | ||
|
||
it( 'should match CKEditor5 package src file on Windows systems', () => { | ||
const path = 'C:\\some path\\to\\the\\ckeditor5-enter\\src\\file.js'; | ||
|
||
const match = path.match( utils.CKEditor5PackageSrcFileRegExp ); | ||
|
||
expect( match ).to.not.be.null; | ||
expect( match.length ).to.equal( 1 ); | ||
expect( match[ 0 ] ).to.equal( '\\ckeditor5-enter\\src\\file.js' ); | ||
} ); | ||
} ); | ||
} ); | ||
|