Skip to content

Commit 5f8ff97

Browse files
committed
Fixing a small bug when reporting the relative output path
1 parent 6c65840 commit 5f8ff97

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

lib/config/path-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454
* @return {String}
5555
*/
5656
getRelativeOutputPath(webpackConfig) {
57-
return webpackConfig.outputPath.replace(webpackConfig.getContext() + '/', '');
57+
return webpackConfig.outputPath.replace(webpackConfig.getContext() + path.sep, '');
5858
},
5959

6060
/**

test/config/path-util.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,32 @@ describe('path-util getContentBase()', () => {
124124
}).to.throw('Cannot determine how to prefix the keys in manifest.json. Call Encore.setManifestKeyPrefix() to choose what path (e.g. build/) to use');
125125
});
126126
});
127+
128+
describe('getRelativeOutputPath', () => {
129+
it('Works with Unix paths', function() {
130+
if (isWindows()) {
131+
this.skip();
132+
}
133+
134+
const config = createConfig();
135+
config.runtimeConfig.context = '/tmp/webpack-encore';
136+
config.outputPath = '/tmp/webpack-encore/public/build';
137+
138+
const actualPath = pathUtil.getRelativeOutputPath(config);
139+
expect(actualPath).to.equal('public/build');
140+
});
141+
142+
it('Works with Windows paths', function() {
143+
if (!isWindows()) {
144+
this.skip();
145+
}
146+
147+
const config = createConfig();
148+
config.runtimeConfig.context = 'C:\\projects\\webpack-encore';
149+
config.outputPath = 'C:\\projects\\webpack-encore\\public\\build';
150+
151+
const actualPath = pathUtil.getRelativeOutputPath(config);
152+
expect(actualPath).to.equal('public\\build');
153+
});
154+
});
127155
});

test/functional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function convertToManifestPath(assetSrc, webpackConfig) {
3939

4040
describe('Functional tests using webpack', function() {
4141
// being functional tests, these can take quite long
42-
this.timeout(5000);
42+
this.timeout(8000);
4343

4444
after(() => {
4545
testSetup.emptyTmpDir();

0 commit comments

Comments
 (0)