Description
Tests found in src/test directory are not currently being ran at any point. Additional inspection from @aduth revealed the tests do not pass in their current state.
Problem statement
These tests were added in #1530, from 2016, when all.scss was renamed to uswds.scss. They are supposed to verify:
- Running
gulp build generates the expected uswds.css and uswds.min.css files with the correct version number string
- Importing
uswds or all from the include path doesn’t generate an error
Not having these tests could cause unintentional regressions to float through such as the version number not outputting correctly, or issues importing USWDS Sass.
Expected behavior
All unit tests should run and complete without failure.
Next steps
- Update tests to reflect modern USWDS repo structure
- Get tests to pass
- Decide when we should run these tests
Additional information
From discussion in #6171:
@mahoneycm I started working on this and it turned into quite a rabbit-hole, since the current tests do not pass as-is.
You can check this by running them directly:
npm exec mocha src/test/include.spec.js src/test/build.spec.js
There's a number of preexisting issues:
- The tests include timeouts which run after very long delays, without anything telling Mocha to wait for their results, perhaps giving false positives on test results
- Test utility paths are outdated and seem to reflect the pre-
packages folder structure
- The tests reference Gulp tasks which no longer exist (
sass, copy-dist-sass)
- The tests are meant to verify that
node_modules/@uswds/uswds/dist is supported as a load path for Sass, but this is actually broken in the published package (the relative path referenced in dist/scss/stylesheets/uswds.scss does not exist)
I've fixed most of these in my local copy of this branch, except for the issues with dist/scss, which are harder to solve.
Perhaps the dist/scss folder should be removed altogether? It doesn't seem to work, the documentation only mentions pacakges, and there's an inline comment referencing the fact that copying scss may not be needed:
|
// TODO: Do we want to copy to the scss any more? |
Originally posted by @aduth in #6171 (comment)
Description
Tests found in src/test directory are not currently being ran at any point. Additional inspection from @aduth revealed the tests do not pass in their current state.
Problem statement
These tests were added in #1530, from 2016, when
all.scsswas renamed touswds.scss. They are supposed to verify:gulp buildgenerates the expecteduswds.cssanduswds.min.cssfiles with the correct version number stringuswdsorallfrom the include path doesn’t generate an errorNot having these tests could cause unintentional regressions to float through such as the version number not outputting correctly, or issues importing USWDS Sass.
Expected behavior
All unit tests should run and complete without failure.
Next steps
Additional information
From discussion in #6171:
@mahoneycm I started working on this and it turned into quite a rabbit-hole, since the current tests do not pass as-is.
You can check this by running them directly:
There's a number of preexisting issues:
packagesfolder structuresass,copy-dist-sass)node_modules/@uswds/uswds/distis supported as a load path for Sass, but this is actually broken in the published package (the relative path referenced indist/scss/stylesheets/uswds.scssdoes not exist)I've fixed most of these in my local copy of this branch, except for the issues with
dist/scss, which are harder to solve.Perhaps the
dist/scssfolder should be removed altogether? It doesn't seem to work, the documentation only mentionspacakges, and there's an inline comment referencing the fact that copyingscssmay not be needed:uswds/tasks/copy.js
Line 16 in b5a332a
Originally posted by @aduth in #6171 (comment)