-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up testing environment and coverage integration #25
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Added `mocha` as test runner * Added `nyc` (Istanbul) as code coverage collector
* Added `audioconv.spec.mjs` * Added `config.spec.mjs` * Added `utils.spec.mjs` * Added `yt-urlfmt.spec.mjs`
Added as dev-dependency for ESLint config.
* Resolved the `ignores` field to exactly ignore specfied files * Integrate with mocha plugin for testing * Changed the value of 'reportUnusedDisableDirectives' to 'true' (boolean) * Removed the 'global module:readonly' in JSDoc config file
* Added test suite for `utils.createDirIfNotExistSync` function * Added test suite for `utils.logger` object along with its methods
* Added a new test suite which test the `checkFfmpeg` function to rejects if FFMPEG_PATH environment variable is set to a directory
mitsuki31
force-pushed
the
test/add-test-suites
branch
from
August 15, 2024 10:34
be2bf17
to
17125ef
Compare
* Changed the array reversion method to use ES6 supported instead * Added double checker to check ffmpeg binary
Due to the `ReadableStream` was released stable on Node.js version 18
* Improved status checker of child process that calls ffmpeg and prevent return `true` if null or undefined * Disabled the verbose option in `checkFfmpeg` test to avoid confusion when `ffmpeg` is not installed on system
Due to YouTube bot detection when downloading YouTube videos, the "IRL Test" workflow will not be triggered automatically until we address it. As far as I did tests on my local machine, the IRL tests did not throw an error with message If want to run the test, type command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces several significant updates to set up the testing infrastructure and enhance code quality for the project. The changes include the addition of new testing dependencies, the creation of initial unit and integration tests, updates to ESLint configurations, and the inclusion of various
npm
scripts.Notable Changes
Added
mocha
as the test runner to facilitate running and managing tests.Added
nyc
(Istanbul) for code coverage collection to ensure comprehensive test coverage reporting.Added unit tests in the following files:
audioconv.spec.mjs
config.spec.mjs
utils.spec.mjs
yt-urlfmt.spec.mjs
Implemented an initial integration test to validate end-to-end functionality, this also include batch download test to validate bulk processing capabilities.
Added
eslint-plugin-mocha
as a dev-dependency to integrate Mocha testing framework with ESLint.Updated main ESLint configuration to:
reportUnusedDisableDirectives
totrue
to improve directive management.Removed the
global module:readonly
configuration from the JSDoc config file.Added ESLint configuration for the test environment to accommodate the new test dependencies and ensure consistency in code quality.
Added
nycrc.json
to configurenyc
(Istanbul) for code coverage thresholds.Added several new npm scripts to streamline development and testing processes.
Enhanced
utils
tests by adding a line break and resolving path issues.Added several
npm
scripts for testing environment.lint
npm run lint:prod && npm run lint:test
lint:prod
eslint . -c eslint.config.js
lint:test
eslint . -c eslint.config.test.js
test
npm run test:unit && npm run test:irl
test:nyan
mocha --recursive --reporter nyan
test:unit
mocha test/unittest
test:nyan:unit
mocha test/unittest --reporter nyan
test:irl
mocha test/irl.test.js
coverage
nyc --reporter lcov --reporter text npm test
Impact
These changes will provide a more robust testing framework, improve code coverage insights, and enforce higher code quality standards. The new configurations and scripts will also enhance development efficiency and maintainability.
Future Work
We will continuously monitor and update code coverage thresholds as possible as we can.
Testing
npm test
to execute the unit and integration tests.npm run coverage
to check code coverage reports generated bynyc
for test completeness.