Skip to content

Commit

Permalink
Use absolute path (#1508)
Browse files Browse the repository at this point in the history
* use absolute dir option passed to forge api

* update tests
  • Loading branch information
basz authored Jun 15, 2023
1 parent 6325fd8 commit 3646486
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
3 changes: 2 additions & 1 deletion lib/tasks/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const chalk = require('chalk');
const Task = require('ember-cli/lib/models/task');
const { electronProjectPath } = require('../utils/build-paths');
const { api } = require('../utils/forge-core');
const path = require('path');

//
// A task that runs electron-forge make to make installers. The skipPackage
Expand All @@ -18,7 +19,7 @@ class MakeTask extends Task {
ui.writeLine(chalk.green('Making Electron project.'));

let makeOptions = {
dir: electronProjectPath,
dir: path.resolve(electronProjectPath),
outDir: outputPath,
skipPackage,
};
Expand Down
3 changes: 2 additions & 1 deletion lib/tasks/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const chalk = require('chalk');
const Task = require('ember-cli/lib/models/task');
const { electronProjectPath } = require('../utils/build-paths');
const { api } = require('../utils/forge-core');
const path = require('path');

//
// A task that runs electron-forge package to package the app.
Expand All @@ -16,7 +17,7 @@ class PackageTask extends Task {
ui.writeLine(chalk.green('Packaging Electron project.'));

let packageOptions = {
dir: electronProjectPath,
dir: path.resolve(electronProjectPath),
outDir: outputPath,
};
if (platform) {
Expand Down
3 changes: 2 additions & 1 deletion lib/tasks/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const chalk = require('chalk');
const Task = require('ember-cli/lib/models/task');
const { electronProjectPath } = require('../utils/build-paths');
const { api } = require('../utils/forge-core');
const path = require('path');

//
// A task that runs electron-forge publish to publish artifacts.
Expand All @@ -16,7 +17,7 @@ class PublishTask extends Task {
ui.writeLine(chalk.green('Publish Electron project.'));

let publishOptions = {
dir: electronProjectPath,
dir: path.resolve(electronProjectPath),
makeResults,
publishTargets,
};
Expand Down
2 changes: 1 addition & 1 deletion node-tests/integration/commands/electron-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('electron command', function () {
expect(DependencyChecker.prototype.checkDependencies).to.be.calledOnce;
});

it('passes the correct path to electron-forge', async function () {
it('passes the correct (resolved) path to electron-forge', async function () {
await expect(command.validateAndRun([])).to.be.fulfilled;
expect(api.start).to.be.calledOnce;
expect(api.start.firstCall.args[0].dir).to.equal(
Expand Down
18 changes: 10 additions & 8 deletions node-tests/integration/commands/make-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('electron:make command', function () {
);
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: false,
});
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('electron:make command', function () {
expect(buildTaskStub).to.not.be.called;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: false,
});
Expand All @@ -95,7 +95,7 @@ describe('electron:make command', function () {
expect(buildTaskStub).to.not.be.called;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: true,
});
Expand All @@ -106,7 +106,7 @@ describe('electron:make command', function () {
expect(buildTaskStub).to.not.be.called;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: true,
});
Expand All @@ -125,7 +125,7 @@ describe('electron:make command', function () {
).to.be.fulfilled;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.resolve('some-dir'),
platform: 'linux',
arch: 'ia32',
Expand All @@ -137,7 +137,7 @@ describe('electron:make command', function () {
await expect(command.validateAndRun(['--targets', 'zip'])).to.be.fulfilled;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: false,
overrideTargets: ['zip'],
Expand All @@ -149,7 +149,7 @@ describe('electron:make command', function () {
.fulfilled;
expect(api.make).to.be.calledOnce;
expect(api.make.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
skipPackage: false,
overrideTargets: ['zip', 'dmg', 'deb'],
Expand All @@ -169,7 +169,9 @@ describe('electron:make command', function () {
await expect(command.validateAndRun(['---publish'])).to.be.fulfilled;

expect(api.publish).to.be.calledOnce;
expect(api.publish.firstCall.args[0].dir).to.equal('electron-app');
expect(api.publish.firstCall.args[0].dir).to.equal(
path.resolve('electron-app')
);
expect(api.publish.firstCall.args[0].makeResults).to.equal(makeResults);
expect(api.publish.firstCall.args[0].publishTargets).to.be.undefined;
});
Expand Down
4 changes: 2 additions & 2 deletions node-tests/integration/commands/package-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('electron:package command', function () {
);
expect(api.package).to.be.calledOnce;
expect(api.package.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.join('electron-app', 'out'),
});
expect(api.package.firstCall).to.be.calledAfter(buildTaskStub.firstCall);
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('electron:package command', function () {
).to.be.fulfilled;
expect(api.package).to.be.calledOnce;
expect(api.package.firstCall.args[0]).to.deep.equal({
dir: 'electron-app',
dir: path.resolve('electron-app'),
outDir: path.resolve('some-dir'),
platform: 'linux',
arch: 'ia32',
Expand Down

0 comments on commit 3646486

Please sign in to comment.