Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Bumps #62

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ before_cache:
# * Generate all symlink across generators
# * Install global packages needed
before_script:
- sudo wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb
- sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
- node test/cache/backup-node_modules.js
- rm -rf fountain-generator/ generator-fountain-*/
- sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
Expand Down
2 changes: 1 addition & 1 deletion generator-fountain-inject
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
"semver": "^5.1.0",
"through2-spy": "^2.0.0",
"toposort": "^1.0.0",
"tslint": "^3.7.4",
"typescript": "^2.0.3",
"tslint": "^4.1.1",
"typescript": "^2.1.0",
"webdriverio": "^4.0.5",
"yeoman-test": "^1.1.0"
},
"scripts": {
"test": "mocha test/test-jsdom",
"test": "mocha test/test-phantom",
"localTest": "mocha test/local-test",
"linkAll": "node scripts/links",
"unlinkAll": "node scripts/unlinks"
Expand Down
10 changes: 5 additions & 5 deletions test/helpers/linter-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const globby = require('globby');
const fs = require('mz/fs');
const CLIEngine = require('eslint').CLIEngine;
const cli = new CLIEngine({});
const Linter = require('tslint');
const Linter = require('tslint').Linter;
const workPath = path.join(__dirname, '../../test/work');

exports.linterTest = function *(options) {
Expand All @@ -31,14 +31,14 @@ exports.tslint = function *(framework) {
const tslintConf = yield fs.readFile(`${workPath}/tslint.json`);
const configuration = JSON.parse(tslintConf);
const options = {
formatter: 'json',
configuration
formatter: 'json'
};
let failureCount = 0;
for (const path of paths) {
const contents = yield fs.readFile(path, 'utf8');
const ll = new Linter(path, contents, options);
const result = ll.lint();
const linter = new Linter(options);
linter.lint(path, contents, configuration);
const result = linter.getResult();
failureCount += result.failureCount;
}
expect(failureCount).to.equal(0);
Expand Down
17 changes: 17 additions & 0 deletions test/helpers/phantom-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const expect = require('chai').expect;
const spawn = require('cross-spawn');

exports.run = function run(url) {
return new Promise((resolve, reject) => {
const result = spawn.sync(`${__dirname}/phantomjs`, [`${__dirname}/phantom-runner.js`, url], {stdio: 'inherit'});
if (result.status === 0) {
console.log('phantom run success');
resolve();
} else {
console.log('phantom run failed', result.output);
reject();
}
});
};
40 changes: 40 additions & 0 deletions test/helpers/phantom-runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable */
"use strict";
const args = require('system').args;
const page = require('webpage').create();
const url = args[1];

page.open(url, status => {
if (status === 'success') {
waitFor(() => {
return page.evaluate(() => {
return document.getElementsByTagName('h3').length === 8;
});
}, phantom.exit, 10000);
} else {
console.log('Unable to access network');
throw new Error('Unable to access network');
phantom.exit(1);
}
});

function waitFor(testFx, onReady, timeOutMillis) {
const maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3000;
const start = new Date().getTime();
let condition = false;
const interval = setInterval(() => {
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
condition = (typeof (testFx) === 'string' ? eval(testFx) : testFx());
} else if (condition) {
if (typeof onReady === 'string') {
eval(onReady);
} else {
onReady();
}
clearInterval(interval);
} else {
console.log('Not found');
phantom.exit(1);
}
}, 250);
}
Binary file added test/helpers/phantomjs
Binary file not shown.
69 changes: 69 additions & 0 deletions test/test-phantom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict';

require('co-mocha');
const product = require('cartesian-product');

const gulp = require('./helpers/gulp-helper');
const yeoman = require('./helpers/yeoman-helper');
const linter = require('./helpers/linter-helper');
const unit = require('./helpers/unit-helper');
const phantom = require('./helpers/phantom-helper');

describe('fountain travis integration test with jsdom', function () {
this.timeout(0);

const combinations = product([
['angular2', 'angular1', 'react', 'vue'],
['webpack', 'systemjs', 'inject'],
['babel', 'typescript', 'js']
])
// Angular 2 and Bower are not supported right now
.filter(combination => combination[0] !== 'angular2' || combination[1] !== 'inject')
// Vue only with Webpack and Babel
.filter(combination => combination[0] !== 'vue' || (combination[1] === 'webpack' && combination[2] === 'babel'));

combinations.forEach(combination => {
const options = {
framework: combination[0],
modules: combination[1],
css: 'scss',
js: combination[2],
sample: 'techs',
router: combination[0] === 'angular1' ? 'uirouter' : 'router',
ci: 'travis'
};

describe(`tests with ${options.framework}, ${options.modules}, ${options.js}`, () => {
before(function * () {
console.log(`travis_fold:start:${options.framework}-${options.modules}-${options.js}`);
yield yeoman.prepare();
yield yeoman.run(options);
});

it('test linter', function * () {
yield linter.linterTest(options);
});

it('run "gulp test"', function * () {
const result = yield gulp.test();
unit.unitTests(result);
});

it('run "gulp serve" and e2e on number of Techs listed', function * () {
const url = yield gulp.serve();
yield phantom.run(url);
gulp.killServe();
});

it('run "gulp serve:dist" and e2e on number of Techs listed', function * () {
const url = yield gulp.serveDist();
yield phantom.run(url);
gulp.killServe();
});

after(() => {
console.log(`travis_fold:end:${options.framework}-${options.modules}-${options.js}`);
});
});
});
});