Skip to content
Permalink
Browse files

test(maker): add test to confirm dummy maker does not get called

  • Loading branch information
anulman authored and MarshallOfSound committed Mar 13, 2017
1 parent fa53340 commit 556deaac8f20e46de643aa88f80d3ea0723d98a0
Showing with 26 additions and 5 deletions.
  1. +5 −0 test/fixture/dummy-maker.js
  2. +21 −5 test/slow/api_spec_slow.js
@@ -0,0 +1,5 @@
export const supportedPlatforms = [];

export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { // eslint-disable-line
return 'i will resolve, but i\'m supposed to throw upstream';
};
@@ -224,7 +224,7 @@ describe(`electron-forge API (with installer=${installer.substr(12)})`, () => {
}
const genericTargets = fs.readdirSync(path.resolve(__dirname, '../../src/makers/generic')).map(file => path.parse(file).name);

const testMakeTarget = function testMakeTarget(target, ...options) {
const testMakeTarget = function testMakeTarget(target, shouldPass, ...options) {
describe(`make (with target=${target})`, async () => {
before(async () => {
const packageJSON = await readPackageJSON(dir);
@@ -233,16 +233,32 @@ describe(`electron-forge API (with installer=${installer.substr(12)})`, () => {
});

options.forEach((optionsFetcher) => {
it(`successfully makes for config: ${JSON.stringify(optionsFetcher(), 2)}`, async () => {
await forge.make(optionsFetcher());
});
if (shouldPass) {
it(`successfully makes for config: ${JSON.stringify(optionsFetcher(), 2)}`, async () => {
await forge.make(optionsFetcher());
});
} else {
it(`fails for config: ${JSON.stringify(optionsFetcher(), 2)}`, async () => {
await expect(forge.make(optionsFetcher())).to.eventually.be.rejected;
});
}
});
});
};

[].concat(targets).concat(genericTargets).forEach((target) => {
const testOptions = [() => ({ dir, skipPackage: true })];
testMakeTarget(target, ...testOptions);
testMakeTarget(target, true, ...testOptions);
});

testMakeTarget('zip', true, { dir, skipPackage: true, outDir: `${dir}/foo` });

const dummyMakerPath = `${process.cwd()}/test/fixture/dummy-maker`;
testMakeTarget('dummy', false, {
dir,
overrideTargets: [dummyMakerPath],
platform: process.platform === 'darwin' ? 'linux' : 'darwin',
skipPackage: true,
});
});

0 comments on commit 556deaa

Please sign in to comment.
You can’t perform that action at this time.