public
public copied to clipboard
Add template to wallaby config file with typings
I made this to help me not have to check docs every time. It's nowhere near enough because I know there's a lot more.
It's using JSDoc to have comments, autocomplete and type checking. (lines ending in double space is to break lines on the comment)
If you can update/complete all that and have somewhere to easily copy and paste the types.
module.exports = () => /** @type {Partial<Wallaby>} */({
name: 'React',
autoDetect: true,
workers: {
initial: 6,
regular: 4,
restart: false,
},
delays: {
// run: 1500
},
ignoreFileLoadingDependencyTracking: true,
// files: [
// 'src/**/*.js',
// ],
tests: [
// 'src/**/*.test.js',
{ pattern: "node_modules", ignore: true, instrument: false },
],
runMode: 'onsave',
maxLogEntrySize: 999999,
slowTestThreshold: 60000,
runAllTestsWhenNoAffectedTests: true,
});
/**
* @typedef {Object} Wallaby
*
* @property {string} name This will change the displayed project name (the project folder name by default) to the My Project Name text in wallaby app.
*
* @property {boolean|('angular'|'jest'|'vitest')[]} autoDetect Whether to automatically detect the project name.
* Default to true, will detect and configure in the following order: ['angular', 'jest', 'vitest'].
*
* @property {Object} workers
* @property {number} workers.initial number of parallel processes to use to run your tests when your start/restart wallaby.js
* @property {number} workers.regular number of parallel processes to use to run your tests every time your code changes
* @property {boolean} workers.restart whether wallaby.js should restart workers.
* When set to true, wallaby.js will restart processes for each run.
* When set to false, wallaby.js will forever keep using processes that were started once, relying on your test cleanup code.
*
* @property {Object} delays object property specifies how much time (in milliseconds) wallaby.js
* should wait before proceeding to the next stage of the automated test run workflow.
* @property {number} delays.run number of milliseconds to wait before running a test as a result of your code changes.
*
* @property {boolean} ignoreFileLoadingDependencyTracking If you want to ignore file loading chains for files dependency tracking purposes,
* so that wallaby only re-runs tests that are directly using affected files exported functionality
*
* @property {(string|WallabyFile)[]} files array of source files or file name patterns.
*
* @property {(string|WallabyFile)[]} tests array of test files or test file name patterns.
*
* @property {'automatic'|'onsave'} runMode The automatic option makes your current Wallaby session start
* a test run whenever code is changed in your editor or when code is saved on disk.
* The onsave option starts a test run ONLY when your code is saved to disk.
*
* @property {number} maxLogEntrySize maximum log entry size before the log is truncated
*
* @property {number} slowTestThreshold number of milliseconds a test is considered as slow and reported as such in the wallaby.js app
*
* @property {boolean} runAllTestsWhenNoAffectedTests whether wallaby.js should run all tests when no affected tests
*/
/**
* @typedef {Object} WallabyFile
* @property {string} pattern string property represents the file name or pattern.
* @property {boolean} [instrument=true] determines whether the file is instrumented.
* Setting the property to false stops the file from being compiled, disables file code coverage reporting,
* and prevents file changes from triggering automatic test execution.
* @property {boolean} [load=true] determines whether the file is loaded to the sandbox HTML (via the script tag in case of JavaScript files).
* @property {boolean} [ignore=false] used to completely exclude the file from being processed by wallaby.js
* @property {boolean} [binary=false] whether the file is binary (this affects how the file gets copied to wallaby cache).
*/