Skip to content
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

Test bundle, Documentation & Codi 🐶 Update #1707

Open
wants to merge 16 commits into
base: patch
Choose a base branch
from

Conversation

RobAndrewHurst
Copy link
Contributor

@RobAndrewHurst RobAndrewHurst commented Nov 13, 2024

Description

Implemented a comprehensive test bundle system to enhance test reusability across different environments. This update includes:

Test Bundle Features

  • Created reusable workspace assets for cross-environment testing
  • Did a review and optimization of the majority of existing test suites. (Some still need to be revisted and reworked.)
  • Standardized test configurations for better maintainability

Codi 🐶 v0.0.47 Updates

  • Enhanced test output control with --quiet flag
    • Streamlines output by displaying only test failures
    • Reduces noise in CI/CD pipelines
    • Backward compatible with existing test configurations

GitHub Issue

Resolves #1440

Type of Change

  • ✅ New feature (non-breaking change which adds functionality)
    • Test bundle system
    • Enhanced output control
  • ✅ Documentation
    • Updated test configuration guides
  • ✅ Testing
    • Improved test organization
    • Enhanced cross-environment compatibility
    • Optimized test asset reusability

@RobAndrewHurst RobAndrewHurst changed the title Test bundle Test bundle, Documentation & Codi 🐶 Update Nov 14, 2024
@RobAndrewHurst RobAndrewHurst marked this pull request as ready for review November 14, 2024 06:20
@RobAndrewHurst RobAndrewHurst linked an issue Nov 14, 2024 that may be closed by this pull request
@@ -4,13 +4,14 @@ import * as esbuild from 'esbuild'
const isDev = process.env.NODE_ENV !== 'DEVELOPMENT';

const buildOptions = {
entryPoints: ['./lib/mapp.mjs', './lib/ui.mjs'],
entryPoints: isDev ? ['./lib/mapp.mjs', './lib/ui.mjs'] : ['./lib/mapp.mjs', './lib/ui.mjs', './tests/_mapp.test.mjs'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We bundle the test assets if we are in DEVELOPMENT mode. We can discuss if we want this all the time or in other certain situations.

@@ -11,7 +11,7 @@
"scripts": {
"test": "codi tests",
"_build": "node esbuild.config.mjs",
"browser-sync": "npx browser-sync start --proxy localhost:3000 --port 3001 --ui-port 3002 --files public/js/lib/**/* --no-open --no-notify",
"browser-sync": "npx browser-sync start --proxy localhost:3000 --port 3001 --ui-port 3002 --files public/js/**/* --no-open --no-notify",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Browser sync will now reload for either changes to lib or tests

if (integrity) {
results = await codi.runWebTests(testFiles);
} else {
results = await codi.runWebTestFunction(_mappTest.coreTest);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This webTestFunction might be better used on each test function in the test bundle to try aid parallel testing in the future.

import { formatTest } from './lib/layer/format/_format.test.mjs';
import { ui_locations } from './lib/ui/locations/_locations.test.mjs';

self._mappTest = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the test bundle entry point that self assigns just like mapp

@@ -0,0 +1,67 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of saving away a configuration, which can be imported from the bundled test library.

}
}
}
import mvt_layer_default from '../../../assets/layers/mvt/layer.json';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of importing the asset. This will be applied more as I continue the re-review and structure of current tests

//TODO
});
});
// await codi.describe('TODO: Mapview: allfeaturesTest', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping these TODO's in the test base so I can get to the asap

@@ -3,67 +3,7 @@
* @function Tabview
*/
export async function Tabview() {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This need to be re-reviewed

@RobAndrewHurst RobAndrewHurst added Testing Changes relating to existing or new unit tests. Documentation Adding or updating documentation. labels Nov 14, 2024
Copy link
Contributor

@AlexanderGeere AlexanderGeere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quiet flag is a nice addition. The testing.md makes sense to me 👍

Copy link
Contributor

@simon-leech simon-leech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integrity tests are not working correctly.

At the start of the integrity test it throws an error that /js/tests/_mapp.test.js does not exist (404).

I also see an error 'Erroringrunning test file' using this path /public/tests/integrity.test.mjs. This is also timing out after 5000ms in the webRunner.

The tests then also say that they have finished way before all the thematics have finished running through the test.

@RobAndrewHurst
Copy link
Contributor Author

The integrity tests are not working correctly.

At the start of the integrity test it throws an error that /js/tests/_mapp.test.js does not exist (404).

I also see an error 'Erroringrunning test file' using this path /public/tests/integrity.test.mjs. This is also timing out after 5000ms in the webRunner.

The tests then also say that they have finished way before all the thematics have finished running through the test.

How are you running the tests?

Copy link
Member

@dbauszus-glx dbauszus-glx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nodemon.json references local resources and must be added to ignore. The file and it's content must be referenced in the testing.md to explain the build process.

@RobAndrewHurst
Copy link
Contributor Author

The nodemon.json references local resources and must be added to ignore. The file and it's content must be referenced in the testing.md to explain the build process.

I have updated the documentation and removed nodemon.json and added in an example config into the DEVELOPING docs

Copy link

sonarcloud bot commented Nov 15, 2024

@RobAndrewHurst
Copy link
Contributor Author

After some discussion @simon-leech has pushed a change where the test bundle will happen all the time. This is fine because only on the _test.html view do we call the bundle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Adding or updating documentation. Testing Changes relating to existing or new unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codi tests documentation and options
4 participants