saucectl command line bundles your root directory (specified in the
rootDir parameter of your configuration file) and transmits it to the Sauce Labs cloud or your own infrastructure via Docker, then unpacks the bundle and runs the tests. This functionality is partly what allows Testrunner to operate in a framework-agnostic capacity. However, you can and should manage the inclusion and exclusion of files that get bundled to optimize performance and ensure security.
.sauceignore file is generated when you run
saucectl new, allowing you to designate certain files to exclude from bundling.
Add any files that are not direct test dependencies to
.sauceignore to reduce the size of your bundle, improve test speed, and protect sensitive information.
Examples of what can be included in
.sauceignore file lists
node_modules/ so locally installed node dependencies are excluded from the bundle. If your tests require node dependencies to run, you can either:
Remove "node_modules" from
Delete or comment out
node_modules/ in your
.sauceignore file to bundle your node dependencies. For example,
Node dependencies can increase your bundle by potentially hundreds of megabytes, so consider including only the required dependencies rather than the entire
node_modules directory. The following sections provide some methods for limiting the scope of dependencies you must include.
Consider only installing NPM
devDependencies if your tests do not require all prod
If your standard install includes dependencies that aren't needed to run your tests, uninstall them prior to bundling.
If you know that your tests require only specific dependencies, install them individually instead of running
npm install or
Set NPM Packages in
As an alternative to installing or uninstalling certain dependencies prior to each bundle operation, you can set the list of NPM packages to install in your sauce configuration file.