codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

Is it possible to execute single test ? #387

Closed wolendranh closed 3 years ago

wolendranh commented 5 years ago

Was not able to find if that possible to execute separate test with this setup.

ryanclark commented 5 years ago

Normally you'd use whatever test framework you're using to signal you only want to run a specific test - what one are you using? I.e. Jest (I know it's not usable with this but it's the first one that came to mind), you use it.only instead of it to only run the one test.

wolendranh commented 5 years ago

I am using mocha with karma and karma-webpack . Was curious if that's possible to specify something like: karma start karma.conf.js --test=testname

daKmoR commented 5 years ago

if you want to execute only a single file it could be something like this... e.g. you will need to have it specific in your karma.config https://open-wc.org/testing/testing-karma.html#testing-single-files-or-folders

if it's really just a single specific test then maybe something like this https://stackoverflow.com/questions/29150998/karma-running-a-single-test-file-from-command-line

codymikol commented 3 years ago

I thought there must be a cli flag that karma exposed because intellij is able to run a single test. Turns out it actually builds a new karma configuration on the fly limiting the test files and merges it with your own configuration :exploding_head: . I know most test frameworks also have an option to specify it.only or describe.only to limit the test scope. Since this is outside the scope of karma-webpack and some examples have been posted, I'm going to close this issue.