Skip to content

Commit

Permalink
Merge pull request #7 from bingnz/update-packages
Browse files Browse the repository at this point in the history
chore: update packages and fix test coverage.
  • Loading branch information
bingnz authored Feb 10, 2018
2 parents 2952484 + 150eb8d commit 3f0c1ff
Show file tree
Hide file tree
Showing 9 changed files with 4,947 additions and 2,045 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
release
*.map
coverage
/.nyc_output
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ env:
before_script:
- npm prune

script:
- npm run build
- npm test

after_success:
- npm install -g codeclimate-test-reporter
- codeclimate-test-reporter < coverage/remapped-lcov.info
- codeclimate-test-reporter < coverage/lcov.info
- npm run semantic-release

branches:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2017 David Chandler
Copyright (c) 2016-2018 David Chandler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ If no options are specified, looks for a CSS file in the same path as the LESS f

## License

Copyright (c) 2016-2017 David Chandler
Copyright (c) 2016-2018 David Chandler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
8 changes: 8 additions & 0 deletions generate-coverage-reports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var remapIstanbul = require('remap-istanbul');

remapIstanbul('./coverage/coverage-final.json', {
'json': './coverage/coverage-remapped.json',
'html': './coverage/html',
'lcovonly': './coverage/lcov.info',
'text': null
});
53 changes: 10 additions & 43 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ var plugins = require('gulp-load-plugins')();
var through2 = require('through2');
var os = require('os');
var lazypipe = require('lazypipe');
var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');

var tsProject = plugins.typescript.createProject('tsconfig.json', {
typescript: require('typescript')
});

function istanbulTypeScriptIgnores() {
var ignoreReplacement = '/* istanbul ignore next */\n$1'
return lazypipe()
.pipe(plugins.replace, /(var __extends =)/, ignoreReplacement)
.pipe(plugins.replace, /(var __awaiter =)/, ignoreReplacement)
.pipe(plugins.replace, /(var __generator =)/, ignoreReplacement)
.pipe(plugins.replace, /(var _this = _super\.call)/, ignoreReplacement)();
}

gulp.task('compile', function () {
var tsResult = gulp.src(['src/**/*.ts', 'custom-typings/*.d.ts'])
.pipe(plugins.sourcemaps.init())
Expand All @@ -20,6 +28,7 @@ gulp.task('compile', function () {
tsResult.dts
.pipe(gulp.dest('release')),
tsResult.js
.pipe(istanbulTypeScriptIgnores())
.pipe(plugins.sourcemaps.write('./', {
includeContent: false,
sourceRoot: function (file) {
Expand All @@ -30,46 +39,4 @@ gulp.task('compile', function () {
]);
});

function istanbulTypeScriptIgnores() {
var ignoreReplacement = '/* istanbul ignore next */\n$1'
return lazypipe()
.pipe(plugins.replace, /(var __extends =)/, ignoreReplacement)
.pipe(plugins.replace, /(var __awaiter =)/, ignoreReplacement)
.pipe(plugins.replace, /(var __generator =)/, ignoreReplacement)
.pipe(plugins.replace, /(var _this = _super\.call)/, ignoreReplacement)();
}

gulp.task('pre-test', ['compile'], function () {
return gulp.src(['release/**/*.js'])
.pipe(istanbulTypeScriptIgnores())
// Covering files
.pipe(plugins.istanbul())
// Force `require` to return covered files
.pipe(plugins.istanbul.hookRequire());
});

gulp.task('test-and-coverage', ['pre-test'], function () {
return gulp.src('test/**/*.js', { read: false })
.pipe(plugins.mocha({
reporter: 'spec',
require: [
'babel-polyfill',
'babel-core/register'
]
}))
.pipe(plugins.istanbul.writeReports());
});

gulp.task('run-tests', ['test-and-coverage'], function () {
return gulp.src('coverage/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'json': 'coverage/remapped-coverage.json',
'html': 'coverage/remapped-report',
'lcovonly': 'coverage/remapped-lcov.info'
}
}))
.pipe(gulp.dest('coverage'));
});

gulp.task('default', ['compile']);
Loading

0 comments on commit 3f0c1ff

Please sign in to comment.