Closed sreenara closed 2 months ago
Looks good. Can we update the CONTRIBUTING also to mention how to use it?
@mkesavan13 If we add the --help
argument to the command we will get the options anyway. Is it necessary to update the CONTRIBUTING as well?
$ yarn workspace @webex/internal-plugin-dss test:unit --help
Usage: index test [options]
Test a legacy package
Options:
--automation Run automation-scoped tests.
--documentation Run documentation-scoped tests.
--integration Run integration-scoped tests.
-browsers, --karma-browsers <array> Browsers to use when running Karma tests. (default: ["chrome","firefox"])
-debug, --karma-debug Run Karma in debug mode
-port, --karma-port <string> Port to run the Karma server on
--runner <array> Test runner to use.
--targets <string> Override the default test target for reading files.
--unit Run unit-scoped tests.
-h, --help
COMPLETES # NA
This pull request addresses
The inability to run test files separately. Currently, the
test:unit
ortest:integration
command collects all test files for a package and runs them even though we try mentioning the test file names using commands such as this:yarn workspace @webex/internal-plugin-dss test:unit -- test/unit/spec/dss.ts
Due to this, it is difficult to add
.only()
to tests and run them separately to troubleshoot problems.by making the following changes
The
run-tests
script takes an argumenttargets
which overrides the traditional test file collection. In this PR, I've enhanced thePackage
class to consider thetargets
argument and collect only the file that has been mentioned as a target. This ensures that the tooling runs only the tests we want them to.Change Type
The following scenarios where tested
yarn workspace @webex/internal-plugin-dss test:unit --targets dss.ts
I certified that
[x] I have read and followed contributing guidelines
[x] I discussed changes with code owners prior to submitting this pull request
[x] I have not skipped any automated checks
[x] All existing and new tests passed
[x] I have updated the documentation accordingly
Make sure to have followed the contributing guidelines before submitting.