Skip to content

Commit

Permalink
Merge pull request #726 from ckeditor/ci/741
Browse files Browse the repository at this point in the history
Other (tests): Added in the Karma configuration a list of available plugins to avoid an error related to loading a non-registered plugin.
  • Loading branch information
pomek authored Sep 20, 2021
2 parents cac0658 + a8a95a7 commit 69b1fec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ module.exports = function getKarmaConfig( options ) {
// Frameworks to use. Available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ 'mocha', 'sinon-chai' ],

// For unknown reasons, sometimes Karma does not fill the list automatically. So, all available plugins must be specified manually.
plugins: [
require.resolve( 'karma-chai' ),
require.resolve( 'karma-chrome-launcher' ),
require.resolve( 'karma-coverage' ),
require.resolve( 'karma-firefox-launcher' ),
require.resolve( 'karma-mocha' ),
require.resolve( 'karma-mocha-reporter' ),
require.resolve( 'karma-sinon' ),
require.resolve( 'karma-sinon-chai' ),
require.resolve( 'karma-sourcemap-loader' ),
require.resolve( 'karma-webpack' )
],

// Files saved in directory `ckeditor5/packages/ckeditor5-utils/tests/_assets/` are available under: http://0.0.0.0:{port}/assets/
proxies: {
'/assets/': '/base/packages/ckeditor5-utils/tests/_assets/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,24 @@ describe( 'getKarmaConfig()', () => {
expect( karmaConfig.proxies ).to.have.own.property( '/example.com/image.png' );
expect( karmaConfig.proxies ).to.have.own.property( '/www.example.com/image.png' );
} );

it( 'should contain a list of available plugins', () => {
const karmaConfig = getKarmaConfig( {
files: [ '*' ],
reporter: 'mocha',
sourceMap: false,
coverage: false,
browsers: [ 'Chrome' ],
watch: false,
verbose: false,
themePath: 'workspace/path/to/theme.css',
entryFile: 'workspace/entry-file.js',
globPatterns: {
'*': 'workspace/packages/ckeditor5-*/tests/**/*.js'
}
} );

expect( karmaConfig.plugins ).to.be.an( 'array' );
expect( karmaConfig.plugins ).to.have.lengthOf.above( 0 );
} );
} );

0 comments on commit 69b1fec

Please sign in to comment.