Skip to content
This repository was archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #408 from Financial-Times/update-deps
Browse files Browse the repository at this point in the history
Update deps once again
  • Loading branch information
JakeChampion authored Feb 21, 2017
2 parents 1264f50 + a59337f commit e45ad10
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
"gulp-lintspaces": "^0.5.0",
"gulp-mustache": "^2.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sass": "^3.1.0",
"gulp-sass-lint": "^1.3.2",
"gulp-sourcemaps": "^1.11.1",
"gulp-sourcemaps": "^2.4.1",
"gulp-util": "^3.0.6",
"gulp-webserver": "^0.9.1",
"haikro": "^1.14.1",
"imports-loader": "^0.6.4",
"imports-loader": "^0.7.0",
"isomorphic-fetch": "^2.1.0",
"json-loader": "^0.5.3",
"merge-stream": "^1.0.0",
Expand Down
108 changes: 54 additions & 54 deletions test/tasks/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
'use strict';

const denodeify = require('denodeify');
const exec = denodeify(require('child_process').exec, function(err, stdout) { return [err, stdout]; });
const exec = denodeify(require('child_process').exec, function (err, stdout) {
return [err, stdout];
});

const expect = require('expect.js');
const gulp = require('gulp');
Expand All @@ -15,36 +17,34 @@ const build = require('../../lib/tasks/build');
const obtPath = process.cwd();
const oTestPath = 'test/fixtures/o-test';

describe('Build task', function() {
describe('Build Js', function() {
describe('Build task', function () {
describe('Build Js', function () {
const pathSuffix = '-build-js';
const buildTestPath = path.resolve(obtPath, oTestPath + pathSuffix);

before(function() {
before(function () {
fs.copySync(path.resolve(obtPath, oTestPath), buildTestPath);
process.chdir(buildTestPath);
fs.writeFileSync('bower.json', JSON.stringify(
{
name: 'o-test',
main: 'main.js'
}
), 'utf8');
fs.writeFileSync('bower.json', JSON.stringify({
name: 'o-test',
main: 'main.js'
}), 'utf8');
});

after(function() {
after(function () {
process.chdir(obtPath);
fs.removeSync(buildTestPath);
});

afterEach(function() {
return fs.emptydirSync('build', function(){
afterEach(function () {
return fs.emptydirSync('build', function () {
fs.removeSync('build');
});
});

it('should work with default options', function(done) {
it('should work with default options', function (done) {
build.js(gulp)
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('build/main.js', 'utf8');
expect(builtJs).to.contain('sourceMappingURL');
expect(builtJs).to.contain('var Test');
Expand All @@ -55,28 +55,28 @@ describe('Build task', function() {
});
});

it('should work with production option', function(done) {
it('should work with production option', function (done) {
build
.js(gulp, {
env: 'production'
})
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('build/main.js', 'utf8');
expect(builtJs).to.not.contain('sourceMappingURL');
expect(builtJs).to.not.contain('var Test');
expect(builtJs).to.not.contain('function Test() {\n\t\tvar name = \'test\';');
expect(builtJs).to.not.contain('"This is a test"');
expect(builtJs).to.not.contain('function Test() {\n\t\tvar name = \'test\';');
done();
});
});
});

it('should build from custom source', function(done) {
it('should build from custom source', function (done) {
build
.js(gulp, {
js: './src/js/test.js'
})
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('build/main.js', 'utf8');
expect(builtJs).to.contain('sourceMappingURL');
expect(builtJs).to.not.contain('var Test');
Expand All @@ -85,12 +85,12 @@ describe('Build task', function() {
});
});

it('should build to a custom directory', function(done) {
it('should build to a custom directory', function (done) {
build
.js(gulp, {
buildFolder: 'test-build'
})
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('test-build/main.js', 'utf8');
expect(builtJs).to.contain('sourceMappingURL');
expect(builtJs).to.contain('var Test');
Expand All @@ -101,12 +101,12 @@ describe('Build task', function() {
});
});

it('should build to a custom file', function(done) {
it('should build to a custom file', function (done) {
build
.js(gulp, {
buildJs: 'bundle.js'
})
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('build/bundle.js', 'utf8');
expect(builtJs).to.contain('sourceMappingURL');
expect(builtJs).to.contain('var Test');
Expand All @@ -117,45 +117,45 @@ describe('Build task', function() {
});
});

it('should fail on syntax error', function(done) {
it('should fail on syntax error', function (done) {
build
.js(gulp, {
js: './src/js/syntax-error.js'
})
.on('error', function(e) {
.on('error', function (e) {
expect(e.message).to.contain('SyntaxError');
expect(e.message).to.contain('Unexpected token');
done();
})
.on('end', function() {
.on('end', function () {
// Fail quickly to not wait for test to timeout
expect(true).to.be(false);
done();
});
});

it('should fail when a dependency is not found', function(done) {
it('should fail when a dependency is not found', function (done) {
build
.js(gulp, {
js: './src/js/missing-dep.js'
})
.on('error', function(e) {
.on('error', function (e) {
expect(e.message).to.contain('ModuleNotFoundError: Module not found: Error: Cannot resolve module \'dep\'');
done();
})
.on('end', function() {
.on('end', function () {
// Fail quickly to not wait for test to timeout
expect(true).to.be(false);
done();
});
});

it('should support a standalone option which creates a global variable', function(done) {
it('should support a standalone option which creates a global variable', function (done) {
build
.js(gulp, {
standalone: 'origami'
})
.on('end', function() {
.on('end', function () {
const builtJs = fs.readFileSync('build/main.js', 'utf8');
expect(builtJs).to.contain('sourceMappingURL');
expect(builtJs).to.contain('var Test');
Expand All @@ -168,82 +168,82 @@ describe('Build task', function() {
});
});

describe('Build Sass', function() {
describe('Build Sass', function () {
const pathSuffix = '-build-sass';
const buildTestPath = path.resolve(obtPath, oTestPath + pathSuffix);

before(function() {
before(function () {
fs.copySync(path.resolve(obtPath, oTestPath), buildTestPath);
process.chdir(buildTestPath);
fs.writeFileSync('bower.json', JSON.stringify(
{
name: 'o-test',
main: 'main.scss'
}
), 'utf8');
fs.writeFileSync('bower.json', JSON.stringify({
name: 'o-test',
main: 'main.scss'
}), 'utf8');
});

after(function() {
after(function () {
process.chdir(obtPath);
fs.removeSync(path.resolve(obtPath, buildTestPath));
});

afterEach(function() {
afterEach(function () {
return exec('rm -rf build');
});

it('should work with default options', function(done) {
it('should work with default options', function (done) {
build.sass(gulp)
.on('end', function() {
.on('end', function () {
const builtCss = fs.readFileSync('build/main.css', 'utf8');
expect(builtCss).to.contain('div {\n color: blue; }\n');
done();
});
});

it('should work with production option', function(done) {
it('should work with production option', function (done) {
build
.sass(gulp, {
env: 'production'
})
.on('end', function() {
.on('end', function () {
const builtCss = fs.readFileSync('build/main.css', 'utf8');
expect(builtCss).to.be('div{color:#00f}');
done();
});
});
});

it('should build from custom source', function(done) {
it('should build from custom source', function (done) {
build
.sass(gulp, {
sass: './src/scss/test.scss'
})
.on('end', function() {
.on('end', function () {
const builtCss = fs.readFileSync('build/main.css', 'utf8');
expect(builtCss).to.contain('p {\n color: #000000; }\n');
done();
});
});

it('should build to a custom directory', function(done) {
it('should build to a custom directory', function (done) {
build
.sass(gulp, {
buildFolder: 'test-build'
})
.on('end', function() {
.on('end', function () {
const builtCss = fs.readFileSync('test-build/main.css', 'utf8');
expect(builtCss).to.contain('div {\n color: blue; }\n');
exec('rm -rf test-build')
.then(function() { done(); }, done);
.then(function () {
done();
}, done);
});
});

it('should build to a custom file', function(done) {
it('should build to a custom file', function (done) {
build
.sass(gulp, {
buildCss: 'bundle.css'
})
.on('end', function() {
.on('end', function () {
const builtCss = fs.readFileSync('build/bundle.css', 'utf8');
expect(builtCss).to.contain('div {\n color: blue; }\n');
done();
Expand Down

0 comments on commit e45ad10

Please sign in to comment.