According to https://stackoverflow.com/a/45350941/4148175 part A I should be able to run a specific test file by "karma start --grep my-test-file.js". I tried but it run two test files I have.
According to https://stackoverflow.com/a/29151264/4148175 I should firstly start karma and then run the specific file but after I started karma I also have my two files triggered and when I try run the spesific file I get that the port isn't answering.
As far as I understood, I must setup autoWatch: true and singleRun: true and it is that way in my karma.conf.js
Console:
# karma start
03 07 2019 14:02:29.713:WARN [filelist]: Pattern "C:/_d/samples/../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js" does not match any file.
03 07 2019 14:02:29.730:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
03 07 2019 14:02:29.731:INFO [launcher]: Launching browsers Chrome, Firefox with concurrency unlimited
03 07 2019 14:02:29.739:INFO [launcher]: Starting browser Chrome
03 07 2019 14:02:29.754:INFO [launcher]: Starting browser Firefox
03 07 2019 14:02:35.891:INFO [Chrome 75.0.3770 (Windows 10.0.0)]: Connected on socket R657DrSW7GAKGkPxAAAA with id 98561767
**** certain test from a file
**** another test from other file
Chrome 75.0.3770 (Windows 10.0.0): Executed 6 of 6 SUCCESS (0.096 secs / 0.01 secs)
Firefox 67.0.0 (Windows 10.0.0): Executed 6 of 6 SUCCESS (0.073 secs / 0.017 secs)
TOTAL: 12 SUCCESS
mycompany@DESKTOPF C:\_d\samples\how-to-test-web-component
# karma run -- --grep=text.component.test.js
03 07 2019 14:03:02.469:ERROR [runner]: There is no server listening on port 9876
Karma.conf.js
module.exports = function(config) {
config.set({
basePath: "",
frameworks: ["jasmine"],
files: [
"node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js",
{ pattern: "**/*.test.js", type: "module", included: true },
{ pattern: "**/*.js", type: "module", included: false }
],
exclude: [],
preprocessors: {},
reporters: ["spec"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["Chrome", "Firefox"],
singleRun: true,
concurrency: Infinity
});
};
To summarize: what I am doing wrong or missing in order to test via karma just the tests found in a specific file?