Skip to content

Commit

Permalink
Merge pull request #588 from alphagov/fix-components-relying-on-globa…
Browse files Browse the repository at this point in the history
…l-builds

Fix components relying on global builds
  • Loading branch information
NickColley authored Mar 8, 2018
2 parents 06312a6 + 1f6892b commit aeb1350
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
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
(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",
"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 })
})
})

0 comments on commit aeb1350

Please sign in to comment.