Package Exports
- @toolbuilder/rollup-plugin-test-tools
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@toolbuilder/rollup-plugin-test-tools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Rollup Plugin Test Tools
This package supports pack file testing for dual module packages.
Here are the basic steps:
- converts your units tests so that they use package instead of relative imports (e.g.
"../src/index.js"to"your-package") - builds ES and CommonJS test projects around those tests
- and run the tests
Installation
npm install @toolbuilder/rollup-plugin-test-toolsAPI
The re-exported packages are exported like this. Links to documentation for these packages are provided above.
export { default as createTestPackageJson } from 'rollup-plugin-create-test-package-json'
export { default as multiInput } from 'rollup-plugin-multi-input'
export { default as relativeToPackage } from 'rollup-plugin-relative-to-package'
export { default as createPackFile } from '@toolbuilder/rollup-plugin-create-pack-file'
export { default as runCommands, shellCommand } from '@toolbuilder/rollup-plugin-commands'Configurations
The package exports two Rollup configurations. If they are suitable, do the following in your rollup.config.js:
export { testConfigs as default } from '@toolbuilder/rollup-plugin-test-tools'The testConfigs object is an Array with two configurations. The first configuration tests your package in a CommonJS project, and the second configuration tests your package in an ES project. Rollup will run one after the other.
These configurations expect the following:
- Unit tests are written using ES module
- Unit tests produce TAP output and are standalone - I use zora becuase it also runs in the browser.
- Unit tests match this glob
test/**/*test.js - Source code matches this glob
src/**/*.js - The pnpm package manager is installed on your system
NOTE: Since the pack file is being tested, the unit tests must use only package imports that are accessible when using the package. Specifically, the unit test imports must match the exports
declared in the package.exports portion of package.json. If you have unit tests that import package internals, you can control which unit tests are used for pack file testing with glob specifications.
Stability
This package will be a bit looser interpreting the semver numbering for the test configurations.
Contributing
Contributions are welcome. Please create a pull request.
I use pnpm instead of npm, which is why you see pnpm-lock.yaml instead of npm lock files.
Issues
This project uses Github issues.
License
MIT