Skip to content

Commit

Permalink
fix: ensure that AEM_NO_OPEN works as expected (#2324)
Browse files Browse the repository at this point in the history
fixes #2323
  • Loading branch information
tripodsan authored Mar 7, 2024
1 parent d0f0bca commit c985c13
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ function envAwareStrict(args, aliases) {
hlxEnv[camelcase(key.substring(4))] = key;
}
});
// setting the AEM_NO_OPEN doesn't seem to set args.open to false automatically...
if (args.noOpen) {
// eslint-disable-next-line no-param-reassign
args.open = false;
}

const unknown = [];
Object.keys(args).forEach((key) => {
Expand Down
3 changes: 3 additions & 0 deletions src/up.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export default function up() {
executor = new UpCommand(getOrCreateLogger(argv));
}

console.log(' open', argv.open);

Check warning on line 105 in src/up.js

View workflow job for this annotation

GitHub Actions / Test

Unexpected console statement
console.log('no-open', argv.noOpen);

Check warning on line 106 in src/up.js

View workflow job for this annotation

GitHub Actions / Test

Unexpected console statement

await executor
.withHttpPort(argv.port)
.withBindAddr(argv.addr)
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/all.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AEM_FILES=*.htl,*.js
# up
AEM_PRINT_INDEX=true
AEM_HOST=www.project-helix.io
AEM_OPEN=false
AEM_NO_OPEN=true
AEM_LIVERELOAD=false
AEM_PORT=1234
AEM_ADDR=*
Expand Down
2 changes: 1 addition & 1 deletion test/import-cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('hlx import', () => {
it('hlx import can use env', async () => {
dotenv.config({ path: path.resolve(__rootdir, 'test', 'fixtures', 'all.env') });
await cli.run(['import']);
sinon.assert.calledWith(mockImport.withOpen, 'false');
sinon.assert.calledWith(mockImport.withOpen, false);
sinon.assert.calledWith(mockImport.withHttpPort, 1234);
sinon.assert.calledOnce(mockImport.run);
});
Expand Down
2 changes: 1 addition & 1 deletion test/up-cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('hlx up', () => {
it('hlx up can use env', async () => {
dotenv.config({ path: path.resolve(__rootdir, 'test', 'fixtures', 'all.env') });
await cli.run(['up']);
sinon.assert.calledWith(mockUp.withOpen, 'false');
sinon.assert.calledWith(mockUp.withOpen, false);
sinon.assert.calledWith(mockUp.withLiveReload, false);
sinon.assert.calledWith(mockUp.withHttpPort, 1234);
sinon.assert.calledWith(mockUp.withBindAddr, '*');
Expand Down

0 comments on commit c985c13

Please sign in to comment.