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

Fix components relying on global builds #588

Merged
merged 3 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Internal:
(PR [#574](https://github.com/alphagov/govuk-frontend/pull/574))
- Ensure render function does not have undefined object
(PR [#587](https://github.com/alphagov/govuk-frontend/pull/587))
- Fix components relying on global builds
Copy link
Contributor

Choose a reason for hiding this comment

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

Given footer hasn't been released yet, is this something we need to document? As the thing we're fixing was never actually released?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, that's why this change is under 'Internal' not 'Fix'

(PR [#588](https://github.com/alphagov/govuk-frontend/pull/588))

## 0.0.25-alpha (Breaking release)

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:dist": "node bin/check-nvmrc.js && gulp build:dist --destination 'dist' && npm run test:build:dist",
"test": "standard && gulp test && npm run test:app && npm run test:components && npm run test:generate:readme",
"test:app": "jest app/__tests__/app.test.js --forceExit # express server fails to end process",
"test:components": "jest src/",
"test:components": "jest src/ && jest tasks/gulp/__tests__/check-individual-components-compile.test.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this run all tests under tasks/gulp/__tests__ rather than a specific case?

Copy link
Contributor Author

@NickColley NickColley Mar 8, 2018

Choose a reason for hiding this comment

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

Some of the task tests run 'after' tasks. So they're dependant on a task running.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

"test:generate:readme": "jest tasks/gulp/__tests__/check-generate-readme.test.js",
"test:build:packages": "jest tasks/gulp/__tests__/after-build-packages.test.js",
"test:build:dist": "jest tasks/gulp/__tests__/after-build-dist.test.js"
Expand Down Expand Up @@ -57,6 +57,7 @@
"js-yaml": "^3.10.0",
"lerna": "^2.3.1",
"merge-stream": "^1.0.1",
"node-sass": "^4.7.2",
"nodemon": "^1.12.1",
"oldie": "^1.3.0",
"postcss-normalize": "^3.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/footer/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../globals/common";

@include govuk-exports("footer") {

$govuk-footer-background: $govuk-grey-3;
Expand Down
37 changes: 37 additions & 0 deletions tasks/gulp/__tests__/check-individual-components-compile.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* eslint-env jest */

const path = require('path')

const sass = require('node-sass')

const lib = require('../../../lib/file-helper')
const configPaths = require('../../../config/paths.json')

const sassRender = (options) => {
return new Promise((resolve, reject) => {
sass.render(options, (error, result) => {
if (error) {
return reject(error)
}
return resolve(result)
})
})
}

describe('Individual components', () => {
it('should compile individual scss files without throwing exceptions', done => {
const componentNames = lib.SrcFilteredComponentList.slice()

const getSassRenders = () => {
return componentNames.map(name => {
const filePath = path.join(configPaths.src, name, `_${name}.scss`)
return sassRender({ file: filePath })
})
}

Promise
.all(getSassRenders())
.then(() => { done() })
.catch(error => { throw error })
})
})