• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-dev / be4e2eec-d0f8-4353-be0d-2b38c57bacb5

12 Aug 2025 08:19AM UTC coverage: 86.735% (-0.01%) from 86.745%
be4e2eec-d0f8-4353-be0d-2b38c57bacb5

Pull #1188

circleci

przemyslaw-zan
Added changeset.
Pull Request #1188: Changes related to cke root package migration

1985 of 2065 branches covered (96.13%)

Branch coverage included in aggregate %.

64 of 65 new or added lines in 2 files covered. (98.46%)

75 existing lines in 1 file now uncovered.

10576 of 12417 relevant lines covered (85.17%)

27.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.32
/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js
1
/**
1✔
2
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
1✔
3
 * For licensing, see LICENSE.md.
1✔
4
 */
1✔
5

6
import path from 'path';
1✔
7
import { fileURLToPath } from 'url';
1✔
8
import { createRequire } from 'module';
1✔
9
import webpack from 'webpack';
1✔
10
import { CKEditorTranslationsPlugin } from '@ckeditor/ckeditor5-dev-translations';
1✔
11
import { loaders } from '@ckeditor/ckeditor5-dev-utils';
1✔
12
import WebpackNotifierPlugin from './webpacknotifierplugin.js';
1✔
13
import getDefinitionsFromFile from '../getdefinitionsfromfile.js';
1✔
14

15
const __filename = fileURLToPath( import.meta.url );
1✔
16
const __dirname = path.dirname( __filename );
1✔
17

18
const require = createRequire( import.meta.url );
1✔
19

20
/**
1✔
21
 * @param {object} options
1✔
22
 * @param {string} options.cwd Current working directory. Usually it points to the CKEditor 5 root directory.
1✔
23
 * @param {boolean} options.requireDll A flag describing whether DLL builds are required for starting the manual test server.
1✔
24
 * @param {object} options.entries
1✔
25
 * @param {string} options.buildDir
1✔
26
 * @param {string} options.themePath
1✔
27
 * @param {boolean} options.disableWatch
1✔
28
 * @param {string} [options.tsconfig]
1✔
29
 * @param {string} [options.language]
1✔
30
 * @param {Array.<string>} [options.additionalLanguages]
1✔
31
 * @param {string|null} [options.identityFile]
1✔
32
 * @returns {object}
1✔
33
 */
1✔
34
export default function getWebpackConfigForManualTests( options ) {
1✔
35
        const definitions = Object.assign( {}, getDefinitionsFromFile( options.identityFile ) );
5✔
36

37
        const webpackConfig = {
5✔
38
                mode: 'none',
5✔
39

40
                watchOptions: {
5✔
41
                        aggregateTimeout: 500
5✔
42
                },
5✔
43

44
                entry: options.entries,
5✔
45

46
                output: {
5✔
47
                        path: options.buildDir
5✔
48
                },
5✔
49

50
                plugins: [
5✔
51
                        new WebpackNotifierPlugin( {
5✔
52
                                onTestCompilationStatus: options.onTestCompilationStatus,
5✔
53
                                processName: options.requireDll ? 'DLL' : 'non-DLL'
5!
54
                        } ),
5✔
55
                        new CKEditorTranslationsPlugin( {
5✔
56
                                // See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
5✔
57
                                language: options.language,
5✔
58
                                additionalLanguages: options.additionalLanguages,
5✔
59
                                addMainLanguageTranslationsToAllAssets: true,
5✔
60
                                packageNamesPattern: /packages[/\\]ckeditor5-[^/\\]+[/\\]/
5✔
61
                        } ),
5✔
62
                        new webpack.DefinePlugin( definitions ),
5✔
63
                        new webpack.ProvidePlugin( {
5✔
64
                                Buffer: [ 'buffer', 'Buffer' ],
5✔
65
                                process: 'process/browser.js'
5✔
66
                        } )
5✔
67
                ],
5✔
68

69
                resolve: {
5✔
70
                        fallback: {
5✔
71
                                'timers': false
5✔
72
                        },
5✔
73
                        extensions: [ '.ts', '.js', '.json' ],
5✔
74
                        extensionAlias: {
5✔
75
                                '.js': [ '.ts', '.js' ]
5✔
76
                        }
5✔
77
                },
5✔
78

79
                module: {
5✔
80
                        rules: [
5✔
81
                                loaders.getIconsLoader( { matchExtensionOnly: true } ),
5✔
82

83
                                loaders.getStylesLoader( {
5✔
84
                                        themePath: options.themePath,
5✔
85
                                        sourceMap: true
5✔
86
                                } ),
5✔
87

88
                                loaders.getFormattedTextLoader(),
5✔
89

90
                                loaders.getTypeScriptLoader( {
5✔
91
                                        configFile: options.tsconfig,
5✔
92
                                        includeDebugLoader: true,
5✔
93
                                        debugFlags: options.debug
5✔
94
                                } ),
5✔
95

96
                                loaders.getJavaScriptLoader( { debugFlags: options.debug } )
5✔
97
                        ]
5✔
98
                },
5✔
99

100
                resolveLoader: {
5✔
101
                        modules: [
5✔
102
                                'node_modules',
5✔
103
                                path.resolve( __dirname, '..', '..', '..', 'node_modules' )
5✔
104
                        ]
5✔
105
                }
5✔
106
        };
5✔
107

108
        if ( !options.disableWatch ) {
5✔
109
                webpackConfig.plugins = webpackConfig.plugins || [];
2!
110
                webpackConfig.plugins.push(
2✔
111
                        // After bumping the webpack to v5 and other related tools/libs/whatever, the source maps stopped working, because for unknown
2✔
112
                        // reasons the path to the generated source map was invalid. The solution for this problem is to manually configure the path to
2✔
113
                        // the source maps using the `append` configuration option.
2✔
114
                        //
2✔
115
                        // Example:
2✔
116
                        //
2✔
117
                        // After running `yarn run manual -f alignment` we have:
2✔
118
                        // - the `[base]` placeholder contains only the file name: `alignment.js`,
2✔
119
                        // - the `[file]` placeholder contains the relative path to the test file: `ckeditor5-alignment/tests/manual/alignment.js`.
2✔
120
                        //
2✔
121
                        // See https://github.com/ckeditor/ckeditor5/issues/11006.
2✔
122
                        //
2✔
123
                        // Previously, the 'cheap-source-map' was used, because Safari had problem with ES6 + inline source maps.
2✔
124
                        // We could use cheap source maps everywhere, but karma-webpack doesn't support it. The `columns` and `module` options
2✔
125
                        // set to `false` are equivalent to the use of `webpackConfig.devtool = 'cheap-source-map'`.
2✔
126
                        //
2✔
127
                        // See https://github.com/webpack/karma-webpack/pull/76.
2✔
128
                        new webpack.SourceMapDevToolPlugin( {
2✔
129
                                columns: false,
2✔
130
                                module: true,
2✔
131
                                filename: '[file].map',
2✔
132
                                append: '\n//# sourceMappingURL=[base].map'
2✔
133
                        } )
2✔
134
                );
2✔
135
                webpackConfig.watch = true;
2✔
136
        }
2✔
137

138
        if ( options.requireDll ) {
5!
139
                // When processing manual tests, if any of them require a DLL build, the manual test server adds the `DllReferencePlugin` plugin
×
140
                // to the configuration to avoid the duplicated modules error when using an import statement behind the `CK_DEBUG_*` flags.
×
141
                //
×
142
                // Otherwise, webpack tries to import a file from a file system instead of the DLL build.
×
143
                // It leads to the CKEditor 5 duplicated modules error.
×
144
                //
×
145
                // See: https://github.com/ckeditor/ckeditor5/issues/12791.
×
NEW
146
                const manifestPath = path.join( 'ckeditor5', 'build', 'ckeditor5-dll.manifest.json' );
×
147
                const dllReferencePlugin = new webpack.DllReferencePlugin( {
×
148
                        manifest: require( manifestPath ),
×
149
                        scope: 'ckeditor5/src',
×
150
                        name: 'CKEditor5.dll'
×
151
                } );
×
152

153
                webpackConfig.plugins.push( dllReferencePlugin );
×
154
        }
×
155

156
        return webpackConfig;
5✔
157
}
5✔
158

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc