Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled coverage reports for browsers Solves #8632 #9308

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a4dcd10
enabled coverage reports for browsers
shikhar-scs Dec 17, 2017
ab239ce
included jasmine with istanbul
shikhar-scs Dec 23, 2017
93eb09b
removed lint errors
shikhar-scs Dec 23, 2017
e662d41
implementing changes
shikhar-scs Jan 2, 2018
697d5d6
Merge branch 'master' into generate-test-coverage-statistics
shikhar-scs Jan 2, 2018
b62118b
Removed the .idea folder
shikhar-scs Jan 7, 2018
23a8f3b
changes in test, created readable stream and test query variable
shikhar-scs Jan 7, 2018
88c6de3
removed idea folder
shikhar-scs Jan 7, 2018
3c6b2e8
Merge Conflicts
shikhar-scs Jan 7, 2018
71ce53f
used coverage parameter, removed inject from gulpfile,improved writea…
shikhar-scs Jan 8, 2018
bb41b2e
called coverage reports, improved xhr
shikhar-scs Jan 10, 2018
a12ea4b
removed lint errors
shikhar-scs Jan 10, 2018
fdf0cdb
removed onreadystatechange and other unnecessary code
shikhar-scs Jan 10, 2018
05ac26e
indentation and if conditions
shikhar-scs Jan 10, 2018
796b35e
some more commits
shikhar-scs Jan 15, 2018
2d989b2
JSON data generated
shikhar-scs Jan 15, 2018
2558dec
introduced self.__coverage__
shikhar-scs Jan 18, 2018
a502102
lint erors
shikhar-scs Jan 18, 2018
1180f3f
removed , from package.json
shikhar-scs Jan 18, 2018
3fb4982
changes
shikhar-scs Jan 19, 2018
e14841e
changes
shikhar-scs Jan 19, 2018
bfb48d4
improved events in test/test.js
shikhar-scs Jan 20, 2018
884478d
improved events in test/test.js
shikhar-scs Jan 20, 2018
2e3db84
improved events in test/test.js
shikhar-scs Jan 20, 2018
4d803fe
final for streams
shikhar-scs Jan 20, 2018
2b19337
lint errors
shikhar-scs Jan 20, 2018
647ba0e
reverted changes
shikhar-scs Jan 31, 2018
beb7bd9
new changes
shikhar-scs Feb 1, 2018
12eda40
Merge branch 'master' into generate-test-coverage-statistics
shikhar-scs Feb 5, 2018
6db3cee
New Changes
shikhar-scs Feb 5, 2018
88871b1
Merge branch 'generate-test-coverage-statistics' of https://github.co…
shikhar-scs Feb 5, 2018
da27bfd
lint errors
shikhar-scs Feb 5, 2018
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ node_modules/
examples/node/svgdump/
examples/node/pdf2png/*.png
package-lock.json
.idea
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here, please remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will do that in my next commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is still here (don't forget to remove the new trailing line too).


3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ install:
- npm install -g gulp-cli
- npm install
- npm update

after_success:
- npm run coveralls
30 changes: 30 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var zip = require('gulp-zip');
var webpack2 = require('webpack');
var webpackStream = require('webpack-stream');
var vinyl = require('vinyl-fs');
var istanbul = require('gulp-istanbul');
var inject = require('gulp-inject');

var BUILD_DIR = 'build/';
var L10N_DIR = 'l10n/';
Expand Down Expand Up @@ -84,6 +86,11 @@ var DEFINES = {
SKIP_BABEL: false,
};

var ISTANBUL_PATHS = {
'javascript': ['coverage/**/*.js'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the single quotes around 'javascript'.

tests: ['test/**/*.js'],
};

function safeSpawnSync(command, parameters, options) {
// Execute all commands in a shell.
options = options || {};
Expand Down Expand Up @@ -1168,6 +1175,29 @@ gulp.task('lint', function (done) {
});
});

gulp.task('instrument', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add , ['generic'] after 'instrument', to make sure that the generic target is run before instrument. Otherwise, if you run gulp instrument, you will add instrumentation to the existing build (which may not exist, or be outdated).

return gulp.src(['src/**/*.js'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using ISTANBUL_PATHS elsewhere and an array here?

// Covering files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the purpose of this comment. Could you either remove it or rephrase it? And if you choose to keep the comment, please add space before the line so that it is aligned consistently with the following lines.

.pipe(istanbul({ coverageVariable: '__coverage__',
}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting looks a bit weird. Can you merge it with the previous line?

// instrumented files will go here
.pipe(gulp.dest('coverage/'));
});

gulp.task('inject', ['instrument'], function (cb) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename cb to done and actually call the callback when the task completes.

return gulp.src('index.html')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole task is not doing anything because there is no file called "index.html".

.pipe(inject(
gulp.src(ISTANBUL_PATHS.javascript, { read: false, }), {
relative: true,
}))
.pipe(inject(
gulp.src(ISTANBUL_PATHS.tests, { read: false, }), {
relative: true,
starttag: '<!-- inject:tests:js -->',
}))
.pipe(gulp.dest('.'));
});

gulp.task('server', function (done) {
console.log();
console.log('### Starting local server');
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-env": "^1.6.0",
"core-js": "^2.5.1",
"coveralls": "^3.0.0",
"escodegen": "^1.9.0",
"eslint": "^4.10.0",
"eslint-plugin-mozilla": "^0.4.9",
Expand All @@ -18,6 +19,7 @@
"gulp-transform": "^3.0.5",
"gulp-util": "^3.0.8",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you using this dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove this ok

"gulp-zip": "^4.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you downgrade the gulp-zip dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it back to the same

"istanbul": "^1.0.0-alpha.2",
"jasmine": "^2.8.0",
"jasmine-core": "^2.8.0",
"jsdoc": "^3.5.5",
Expand All @@ -38,11 +40,17 @@
"yargs": "^9.0.1"
},
"scripts": {
"test": "gulp lint unittestcli externaltest"
"test": "gulp lint unittestcli externaltest",
"cover": "istanbul cover --include-all-sources jasmine JASMINE_CONFIG_PATH=test/unit/clitests.json",
"coveralls": "npm run cover && cat ./coverage/lcov.info | coveralls"
},
"repository": {
"type": "git",
"url": "git://github.com/mozilla/pdf.js.git"
},
"license": "Apache-2.0"
"license": "Apache-2.0",
"dependencies": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the dependencies below to devDependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W Thanx for all these reviews, I'll make all the changes accordingly.

"gulp-inject": "^4.3.0",
"gulp-istanbul": "^1.1.2"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these dependencies are used - remove them. In the future, if you add new dependencies, store them in the devDependencies dictionary.

}