Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
adding ts compilation test and minor gulpfile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed Jun 30, 2017
1 parent 66a255d commit 9a1421f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ node_js:
matrix:
allow_failures:
- node_js: "4"

before_script:
- npm i -g typescript
- tsc
22 changes: 9 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,21 +528,17 @@ gulp.task('default', function () {

//This task is used to generate libraries based on the mappings specified above.
gulp.task('codegen', function (cb) {
if (true) {
if (project === undefined) {
let arr = Object.keys(mappings);
for (let i = 0; i < arr.length; i++) {
codegen(arr[i], i);
}
} else {
if (mappings[project] === undefined) {
console.error('Invalid project name "' + project + '"!');
process.exit(1);
}
codegen(project, null);
if (project === undefined) {
let arr = Object.keys(mappings);
for (let i = 0; i < arr.length; i++) {
codegen(arr[i], i);
}
} else {
process.exit(1);
if (mappings[project] === undefined) {
console.error('Invalid project name "' + project + '"!');
process.exit(1);
}
codegen(project, null);
}
});

Expand Down
31 changes: 31 additions & 0 deletions test/tsTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/

const path = require('path');
const glob = require('glob');
const execSync = require('child_process').execSync;

let packagePaths = glob.sync(path.join(__dirname, '../lib/services', '/**/lib/*.d.ts'),
{ ignore: '**/node_modules/**/*.d.ts' });

describe('tsc compilation:', function () {

packagePaths.forEach(function (path) {
it(`${path} should succeed.`, function (done) {
let cmd = `tsc ${path}`;
let result;
try {
result = execSync(cmd, { encoding: 'utf8' });
done();
} catch (err) {
let output = '';
if (err.stdout) output += err.stdout;
if (err.stderr) output += err.stderr;
done(output);
}
});
});
});

0 comments on commit 9a1421f

Please sign in to comment.