Skip to content

ijlee2/ember-codemod-add-missing-tests

Repository files navigation

This project uses GitHub Actions for continuous integration.

ember-codemod-add-missing-tests

Codemod to add missing tests

Why use it?

Large projects without tests are hard to maintain and extend. Run this codemod to find untested code and create default tests.

The codemod:

  • Supports 10 entities in Ember and Ember Data
  • Accounts for TypeScript, <template> tag, and route splitting
  • Blazingly fast compared to Ember CLI

Usage

Step 1. Quickly migrate.

cd <path/to/your/project>
pnpx ember-codemod-add-missing-tests <arguments>

Step 2. Review the package.

  • Fix format and lint errors.
  • Run the new integration and unit tests. Update assertions or skip tests as needed.

Arguments

Optional: Specify the component structure

By default, an Octane project has the flat component structure. Pass --component-structure to indicate otherwise.

pnpx ember-codemod-add-missing-tests --component-structure nested
Optional: Specify the project root

Pass --root to run the codemod somewhere else (i.e. not in the current directory).

pnpx ember-codemod-add-missing-tests --root <path/to/your/project>
Optional: Specify the test-app location

By default, the codemod creates tests in the package where it is run. Pass --test-app-location to override the logic.

pnpx ember-codemod-add-missing-tests --test-app-location ../../tests/my-v2-addon

Limitations

The codemod is designed to cover typical cases. It is not designed to cover one-off cases.

To better meet your needs, consider cloning the repo and running the codemod locally.

cd <path/to/cloned/repo>

# Compile TypeScript
pnpm build

# Run codemod
./dist/bin/ember-codemod-add-missing-tests.js --root <path/to/your/project>

Compatibility

  • Node.js v22 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

About

Codemod to add missing tests

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors