2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2025-02-13 08:18:31 +00:00

Make main test try multiple platforms

This commit is contained in:
Jia Hao 2016-01-25 01:31:11 +08:00
parent 0fece8dfb7
commit 68a5f46798

View File

@ -4,9 +4,13 @@ import fs from 'fs';
import os from 'os'; import os from 'os';
import path from 'path'; import path from 'path';
import nativefier from './../../lib/index'; import nativefier from './../../lib/index';
import _ from 'lodash';
import async from 'async';
let assert = chai.assert; let assert = chai.assert;
const PLATFORMS = ['darwin', 'linux', 'win32'];
function checkApp(appPath, inputOptions, callback) { function checkApp(appPath, inputOptions, callback) {
try { try {
let relPathToConfig; let relPathToConfig;
@ -37,9 +41,9 @@ function checkApp(appPath, inputOptions, callback) {
} }
describe('Nativefier Module', function() { describe('Nativefier Module', function() {
this.timeout(20000); this.timeout(30000);
it('Can build an app from a target url', function(done) { it('Can build an app from a target url', function(done) {
try {
var tmpObj = tmp.dirSync({unsafeCleanup: true}); var tmpObj = tmp.dirSync({unsafeCleanup: true});
after(function() { after(function() {
tmpObj.removeCallback(); tmpObj.removeCallback();
@ -51,20 +55,24 @@ describe('Nativefier Module', function() {
targetUrl: 'http://google.com', targetUrl: 'http://google.com',
outDir: tmpPath, outDir: tmpPath,
overwrite: true, overwrite: true,
platform: 'win32' platform: null
}; };
nativefier(options, (error, appPath) => {
async.each(PLATFORMS, (platform, callback) => {
let platformOptions = _.clone(options);
platformOptions.platform = platform;
nativefier(platformOptions, (error, appPath) => {
if (error) { if (error) {
done(error); callback(error);
return; return;
} }
checkApp(appPath, options, error => { checkApp(appPath, platformOptions, error => {
callback(error);
});
});
}, error => {
done(error); done(error);
}); });
}); });
} catch (exception) {
done(exception);
}
});
}); });