Skip to content

Commit

Permalink
Merge pull request #1324 from alphagov/remove-gulp-functionality
Browse files Browse the repository at this point in the history
Remove gulp functionality
  • Loading branch information
BenSurgisonGDS authored May 23, 2022
2 parents 3b1a9c5 + ff47f33 commit c8aba1e
Show file tree
Hide file tree
Showing 16 changed files with 594 additions and 6,532 deletions.
11 changes: 8 additions & 3 deletions __tests__/spec/sanity-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const request = require('supertest')
const sass = require('sass')

const app = require('../../server.js')
const gulpConfig = require('../../gulp/config.json')
const buildConfig = require('../../lib/build/config.json')
const utils = require('../../lib/utils')
const { generateAssets } = require('../../lib/build/build-watch-and-serve')

function readFile (pathFromRoot) {
return fs.readFileSync(path.join(__dirname, '../../' + pathFromRoot), 'utf8')
Expand All @@ -20,6 +21,10 @@ function readFile (pathFromRoot) {
* Basic sanity checks on the dev server
*/
describe('The Prototype Kit', () => {
beforeAll(() => {
generateAssets()
})

it('should generate assets into the /public folder', () => {
assert.doesNotThrow(function () {
fs.accessSync(path.resolve(__dirname, '../../public/javascripts/application.js'))
Expand Down Expand Up @@ -135,9 +140,9 @@ describe('The Prototype Kit', () => {
})
})

const sassFiles = glob.sync(gulpConfig.paths.assets + '/sass/*.scss')
const sassFiles = glob.sync(buildConfig.paths.assets + '/sass/*.scss')

describe(`${gulpConfig.paths.assets}sass/`, () => {
describe(`${buildConfig.paths.assets}sass/`, () => {
it.each(sassFiles)('%s renders to CSS without errors', async (file) => {
return new Promise((resolve, reject) => {
sass.render({
Expand Down
25 changes: 22 additions & 3 deletions __tests__/spec/update-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,24 +368,43 @@ describe('update.sh', () => {
expect(newStat.mtimeMs).toBe(oldStat.mtimeMs)
})

it('removes files that have been removed from docs, gulp and lib folders', () => {
it('removes files that have been removed from docs, build and lib folders', () => {
const testDir = mktestPrototypeSync('remove-dangling-files')

const updateDir = path.join(testDir, 'update')
fs.unlinkSync(path.join(updateDir, 'lib', 'build', 'config.json'))
fs.unlinkSync(path.join(updateDir, 'docs', 'documentation', 'session.md'))
fs.unlinkSync(path.join(updateDir, 'gulp', 'clean.js'))
fs.unlinkSync(path.join(updateDir, 'lib', 'v6', 'govuk_template_unbranded.html'))
fs.rmdirSync(path.join(updateDir, 'lib', 'v6'))

runScriptSyncAndExpectSuccess('copy', { testDir })

expect(execGitStatusSync(testDir)).toEqual([
' D docs/documentation/session.md',
' D gulp/clean.js',
' D lib/build/config.json',
' D lib/v6/govuk_template_unbranded.html'
])
})

it('removes gulp files and adds build files if the release does not contain gulp', () => {
const testDir = mktestPrototypeSync('remove-gulp-files')

fs.mkdirSync(path.join(testDir, 'gulp'))
fs.writeFileSync(path.join(testDir, 'gulp', 'watch.js'), 'foo')
fs.writeFileSync(path.join(testDir, 'gulpfile.js'), 'bar')
child_process.execSync('git add gulp/watch.js gulpfile.js', { cwd: testDir })
child_process.execSync('git rm -r lib/build', { cwd: testDir })
child_process.execSync('git commit -q -m "Ensure gulp files exist"', { cwd: testDir })

runScriptSyncAndExpectSuccess('copy', { testDir })

expect(execGitStatusSync(testDir)).toEqual([
' D gulp/watch.js',
' D gulpfile.js',
'?? lib/build/'
])
})

it('does not change files in apps folder, except for in assets/sass/patterns', () => {
const testDir = mktestPrototypeSync('preserve-app-folder')

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/1-watch-files/watch-routes.cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('watch route file', () => {
waitForApplication()

cy.task('log', 'The cypress test page should be displayed')
cy.visit(pageUrl, { failOnStatusCode: false })
cy.visit(pageUrl)
cy.get('h1', { timeout: 20000 })
.should('contains.text', 'CYPRESS TEST PAGE')

Expand Down
16 changes: 0 additions & 16 deletions gulp/clean.js

This file was deleted.

11 changes: 0 additions & 11 deletions gulp/config.json

This file was deleted.

33 changes: 0 additions & 33 deletions gulp/copy-assets.js

This file was deleted.

44 changes: 0 additions & 44 deletions gulp/nodemon.js

This file was deleted.

64 changes: 0 additions & 64 deletions gulp/sass.js

This file was deleted.

29 changes: 0 additions & 29 deletions gulp/watch.js

This file was deleted.

43 changes: 0 additions & 43 deletions gulpfile.js

This file was deleted.

Loading

0 comments on commit c8aba1e

Please sign in to comment.