Skip to content

Fixing a bug with webpack 3.4.0 with extra arg as an entry #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/encore.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const context = require('../lib/context');
const chalk = require('chalk');

const runtimeConfig = parseRuntime(
require('yargs').argv,
require('yargs/yargs')(process.argv.slice(2)).argv,
process.cwd()
);
context.runtimeConfig = runtimeConfig;
Expand Down
50 changes: 50 additions & 0 deletions test/bin/encore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

'use strict';

const chai = require('chai');
chai.use(require('chai-fs'));
const path = require('path');
const testSetup = require('../../lib/test/setup');
const fs = require('fs-extra');
const exec = require('child_process').exec;

describe('bin/encore.js', function() {
// being functional tests, these can take quite long
this.timeout(8000);

it('Basic smoke test', (done) => {
testSetup.emptyTmpDir();
const testDir = testSetup.createTestAppDir();

fs.writeFileSync(
path.join(testDir, 'webpack.config.js'),
`
const Encore = require('../../index.js');
Encore
.setOutputPath('build/')
.setPublicPath('/build')
.addEntry('main', './js/no_require')
;

module.exports = Encore.getWebpackConfig();
`
);

const binPath = path.resolve(__dirname, '../', '../', 'bin', 'encore.js');
exec(`node ${binPath} dev --context=${testDir}`, { cwd: testDir }, (err, stdout, stderr) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 2 paths need to be escaped as they could contain spaces

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I just pushed an imperfect escape at sha: 172a670120e79dd6b5f6aaa65845f9892b982ea0 - which is good enough for test paths I think :)

if (err) {
throw new Error(`Error executing encore: ${err} ${stderr} ${stdout}`);
}

done();
});
});
});