Closed dten closed 10 months ago
karma-webpack
does not seem to respect the exclude
section of the karma config. though I find i can kind of trick it to not being included by setting files as follows files: ['**/!(karma.conf).js'],
this resolves the immediate issue, but i think karma-webpack
not be including the config file as an entrypoint
karma
itself always lists the config file in the exclusion list which you can see when passing --log-level debug
to karma
(in the example below i have not defined exclude but it's there)
01 02 2022 10:24:27.162:DEBUG [karma-server]: Final config Config {
LOG_DISABLE: 'OFF',
LOG_ERROR: 'ERROR',
LOG_WARN: 'WARN',
LOG_INFO: 'INFO',
LOG_DEBUG: 'DEBUG',
frameworks: [ 'jasmine', 'webpack' ],
protocol: 'http:',
port: 9876,
listenAddress: '0.0.0.0',
hostname: 'localhost',
httpsServerConfig: {},
basePath: 'C:/Users/David/Documents/Repositories/github.com/karma-webpack-issue/test',
files: [
Pattern {
pattern: 'C:/Users/David/Documents/Repositories/github.com/karma-webpack-issue/test/**/!(karma.conf).js',
served: true,
included: true,
watched: true,
nocache: false,
weight: [ 1, 1, 0, 0, 0, 0 ],
type: undefined,
isBinary: undefined
}
],
browserConsoleLogOptions: { level: 'debug', format: '%b %T: %m', terminal: true },
customContextFile: null,
customDebugFile: null,
customClientContextFile: null,
exclude: [
'C:/Users/David/Documents/Repositories/github.com/karma-webpack-issue/test/karma.conf.js'
],
logLevel: 'DEBUG',
...
Expected Behavior
tests run without lots of warning output
Actual Behavior
tests run build includes output such as
Code
See repro
How Do We Reproduce?
get the repo.
npm install && npm run test
observe error outputhttps://github.com/dten/karma-webpack-issue
you can uncommentd stats: 'detailed' in the webpack config to see more output from webpack about the entry points it's passed
Thoughts
This seems to me because karma.conf.js is passed as an entry point to webpack. this means it builds it and then complains that it contains node references that are no longer polyfilled. It suggests adding exclusions but in any complicated webpack config then many plugins are referenced and webpack starts complaining about the whole tree of dependencies. I get the feeling the config file is not supposed to be an entry point