From 8c2d0935aa5a75b6649899b2eab4ab7cb2d6d9e7 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Fri, 9 Feb 2018 13:40:28 +1100 Subject: [PATCH] Fixed some path issues in tests --- package-lock.json | 8 +++---- test/unit/is-min-src-defined-for-file-test.js | 21 ++++++++++--------- test/unit/pathify-config-src-test.js | 11 +++++----- test/unit/stream-bundles-test.js | 10 ++++----- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index fa8b07c4..9b4ecfd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2202,14 +2202,14 @@ "gulp-util": "3.0.8", "istanbul": "0.4.5", "istanbul-threshold-checker": "0.1.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "through2": "2.0.3" }, "dependencies": { "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", "dev": true } } diff --git a/test/unit/is-min-src-defined-for-file-test.js b/test/unit/is-min-src-defined-for-file-test.js index 2254add8..39d3459f 100644 --- a/test/unit/is-min-src-defined-for-file-test.js +++ b/test/unit/is-min-src-defined-for-file-test.js @@ -2,7 +2,8 @@ var libPath = './../../lib', should = require('should'), File = require('vinyl'), BundleType = require(libPath + '/model/bundle-type'), - isMinSrcDefinedForFile = require(libPath + '/is-min-src-defined-for-file'); + isMinSrcDefinedForFile = require(libPath + '/is-min-src-defined-for-file'), + path = require('path'); describe('is-min-src-defined-for-file', function () { @@ -77,27 +78,27 @@ describe('is-min-src-defined-for-file', function () { }; minSrcsObj.main[BundleType.SCRIPTS] = [ { - src: 'content/file.js', - minSrc: 'content/file.min.js' + src: path.normalize('content/file.js'), + minSrc: path.normalize('content/file.min.js') }, { - minSrc: 'content/file-with-no-src.js' + minSrc: path.normalize('content/file-with-no-src.js') }, { - src: 'content/file2.js', - minSrc: 'content/file2.min.js' + src: path.normalize('content/file2.js'), + minSrc: path.normalize('content/file2.min.js') } ]; minSrcsObj.vendor[BundleType.SCRIPTS] = [ { - src: 'content/file.js', - minSrc: 'content/file.min.js' + src: path.normalize('content/file.js'), + minSrc: path.normalize('content/file.min.js') } ]; minSrcsObj.header[BundleType.SCRIPTS] = [ { - src: 'content/file-to-find.js', - minSrc: 'content/file-to-find.min.js' + src: path.normalize('content/file-to-find.js'), + minSrc: path.normalize('content/file-to-find.min.js') } ]; isMinSrcDefinedForFile(aFile, minSrcsObj, 'header', BundleType.SCRIPTS).should.be.ok; diff --git a/test/unit/pathify-config-src-test.js b/test/unit/pathify-config-src-test.js index 5a020548..e4b21cbd 100644 --- a/test/unit/pathify-config-src-test.js +++ b/test/unit/pathify-config-src-test.js @@ -1,7 +1,8 @@ 'use strict'; var libPath = './../../lib', pathifySrc = require(libPath + '/pathify-config-src'), - should = require('should'); + should = require('should'), + path = require('path'); describe('pathify-config-src', function () { @@ -16,7 +17,7 @@ describe('pathify-config-src', function () { }); it('should modify when base is something', function () { - pathifySrc('./content/a.js', '/absolute/path/').should.eql('/absolute/path/content/a.js'); + pathifySrc('./content/a.js', '/absolute/path/').should.eql(path.normalize('/absolute/path/content/a.js')); }); }); @@ -32,7 +33,7 @@ describe('pathify-config-src', function () { }); it('should modify when base is something', function () { - pathifySrc(['./content/a.js'], '/absolute/path/').should.eql(['/absolute/path/content/a.js']); + pathifySrc(['./content/a.js'], '/absolute/path/').should.eql([path.normalize('/absolute/path/content/a.js')]); }); }); @@ -48,11 +49,11 @@ describe('pathify-config-src', function () { }); it('should echo string as src with base', function () { - pathifySrc({src: './content/a.js'}, '/absolute/path/').should.eql('/absolute/path/content/a.js'); + pathifySrc({src: './content/a.js'}, '/absolute/path/').should.eql(path.normalize('/absolute/path/content/a.js')); }); it('should echo array as src with base', function () { - pathifySrc({src: ['./content/a.js']}, '/absolute/path/').should.eql(['/absolute/path/content/a.js']); + pathifySrc({src: ['./content/a.js']}, '/absolute/path/').should.eql([path.normalize('/absolute/path/content/a.js')]); }); it('should default to src when no options', function () { diff --git a/test/unit/stream-bundles-test.js b/test/unit/stream-bundles-test.js index 5cd51bae..44c37352 100644 --- a/test/unit/stream-bundles-test.js +++ b/test/unit/stream-bundles-test.js @@ -60,7 +60,7 @@ describe('stream-bundles', function () { }; verifyFileStream(config, done, function (file) { - file.relative.should.eql('content/a.js'); + file.relative.should.eql(path.normalize('content/a.js')); }); }); @@ -78,7 +78,7 @@ describe('stream-bundles', function () { }; verifyFileStream(config, done, function (file) { - file.relative.should.eql('content/a.js'); + file.relative.should.eql(path.normalize('content/a.js')); }); }); @@ -115,7 +115,7 @@ describe('stream-bundles', function () { }; verifyFileStream(config, done, function (file) { - file.relative.should.eql('content/a.js'); + file.relative.should.eql(path.normalize('content/a.js')); }); }); @@ -134,7 +134,7 @@ describe('stream-bundles', function () { }; verifyFileStream(config, done, function (file) { - file.relative.should.eql('content/a.js'); + file.relative.should.eql(path.normalize('content/a.js')); }); }); @@ -175,7 +175,7 @@ describe('stream-bundles', function () { }; verifyFileStream(config, done, function (file) { - file.relative.should.eql('content/a.js'); + file.relative.should.eql(path.normalize('content/a.js')); }); });