mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-08 22:18:25 +00:00
Make main test try multiple platforms
This commit is contained in:
parent
0fece8dfb7
commit
68a5f46798
@ -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,34 +41,38 @@ 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});
|
|
||||||
after(function() {
|
|
||||||
tmpObj.removeCallback();
|
|
||||||
});
|
|
||||||
|
|
||||||
const tmpPath = tmpObj.name;
|
var tmpObj = tmp.dirSync({unsafeCleanup: true});
|
||||||
const options = {
|
after(function() {
|
||||||
appName: 'google-test-app',
|
tmpObj.removeCallback();
|
||||||
targetUrl: 'http://google.com',
|
});
|
||||||
outDir: tmpPath,
|
|
||||||
overwrite: true,
|
const tmpPath = tmpObj.name;
|
||||||
platform: 'win32'
|
const options = {
|
||||||
};
|
appName: 'google-test-app',
|
||||||
nativefier(options, (error, appPath) => {
|
targetUrl: 'http://google.com',
|
||||||
|
outDir: tmpPath,
|
||||||
|
overwrite: true,
|
||||||
|
platform: null
|
||||||
|
};
|
||||||
|
|
||||||
|
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 => {
|
||||||
done(error);
|
callback(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (exception) {
|
}, error => {
|
||||||
done(exception);
|
done(error);
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user