diff --git a/.travis.yml b/.travis.yml index 44470c31af..a5627be12b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,4 +20,4 @@ script: - npm run build_cover after_script: - - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + - cat ./coverage/coverage-remapped.lcov | ./node_modules/coveralls/bin/coveralls.js diff --git a/README.md b/README.md index 57cd9e14b9..55f0bc81f6 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ The build and test structure is fairly primitive at the moment. There are variou - build_test: builds ES6, then CommonJS, then runs the tests with `jasmine` - build_perf: builds ES6, CommonJS, then global, then runs the performance tests with `protractor` - build_docs: generates API documentation from `dist/es6` to `dist/docs` +- build_cover: runs `istanbul` code coverage against test cases - test: runs tests with `jasmine`, must have built prior to running. ### Example @@ -65,6 +66,7 @@ npm run build_all ## Performance Tests Run `npm run build_perf` or `npm run perf` to run the performance tests with `protractor`. +Run `npm run perf_micro` to run micro performance test benchmarking operator. ## Adding documentation RxNext uses [ESDoc](https://esdoc.org/) to generate API documentation. Refer to ESDoc's documentation for syntax. Run `npm run build_docs` to generate. diff --git a/lib/stage_sourcemap.js b/lib/stage_sourcemap.js new file mode 100644 index 0000000000..b2cd15b635 --- /dev/null +++ b/lib/stage_sourcemap.js @@ -0,0 +1,22 @@ +var fs = require('fs-extra'); +var glob = require('glob'); +var jsonfile = require('jsonfile'); +var transfer = require('multi-stage-sourcemap').transfer; + +glob('dist/es6/**/*.js.map', null, function (er, files) { + files.forEach(function (file) { + var source = jsonfile.readFileSync(file); + var destFile = file.replace('es6', 'cjs'); + var dest = jsonfile.readFileSync(destFile); + + var transferred = transfer({ fromSourceMap: JSON.stringify(dest), + toSourceMap: JSON.stringify(source) }); + + fs.unlink(destFile); + jsonfile.writeFile(destFile, transferred, function (err) { + if (err) { + console.log(err); + } + }); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index 7d7ba55c42..0a1b8373e0 100644 --- a/package.json +++ b/package.json @@ -6,19 +6,20 @@ "scripts": { "build_all": "npm run build_es6 && npm run build_amd && npm run build_cjs && npm run build_global", "build_amd": "rm -rf dist/amd && tsc typings/es6-shim/es6-shim.d.ts src/Rx.ts -m amd --outDir dist/amd --sourcemap --target ES5", - "build_cjs": "rm -rf dist/cjs && babel dist/es6 --out-dir dist/cjs --modules common --sourceMaps --loose all && node lib/copy_dts.js", - "build_es6": "rm -rf dist/es6 && tsc src/Rx.ts src/Rx.KitchenSink.ts --outDir dist/es6 --target ES6 -d", + "build_cjs": "rm -rf dist/cjs && babel dist/es6 --out-dir dist/cjs --modules common --source-maps --loose all && node lib/copy_dts.js", + "build_es6": "rm -rf dist/es6 && tsc src/Rx.ts src/Rx.KitchenSink.ts --outDir dist/es6 --sourceMap --target ES6 -d", "build_closure": "java -jar ./node_modules/google-closure-compiler/compiler.jar ./dist/global/Rx.js --create_source_map ./dist/global/Rx.min.js.map --js_output_file ./dist/global/Rx.min.js", "build_global": "rm -rf dist/global && mkdir \"dist/global\" && browserify src/Rx.global.js --outfile dist/global/Rx.js && npm run build_closure", "build_perf": "npm run build_es6 && npm run build_cjs && npm run build_global && webdriver-manager update && npm run perf", "build_test": "rm -rf dist/ && npm run lint && npm run build_es6 && npm run build_cjs && jasmine", - "build_cover": "rm -rf dist/ && npm run lint && npm run build_es6 && npm run build_cjs && istanbul cover jasmine", + "build_cover": "rm -rf dist/ && npm run lint && npm run build_es6 && npm run build_cjs && npm run cover", "build_docs": "./docgen.sh", "lint_perf": "eslint perf/ --fix", "lint_spec": "eslint spec/**/*.js --fix", "lint_src": "tslint -c .tslintrc src/**/*.ts", "lint": "npm run lint_src && npm run lint_spec && npm run lint_perf", - "cover": "istanbul cover jasmine", + "cover": "istanbul cover -x \"*-spec.js index.js *-helper.js\" jasmine && npm run cover_remapping", + "cover_remapping": "node lib/stage_sourcemap.js && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.json && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.lcov -t lcovonly && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped -t html", "test": "jasmine", "watch": "watch \"echo triggering build && npm run build_test && echo build completed\" src -d -u -w=15", "perf": "protractor protractor.conf.js", @@ -82,10 +83,13 @@ "istanbul": "0.3.22", "jasmine": "2.3.2", "jasmine-core": "2.3.4", + "jsonfile": "2.2.2", "lodash": "3.5.0", + "multi-stage-sourcemap": "0.2.1", "platform": "1.3.0", "promise": "7.0.3", "protractor": "2.2.0", + "remap-istanbul": "0.3.1", "rx": "latest", "tslint": "2.5.0", "typescript": "1.8.0-dev.20151017", diff --git a/src/testing/HotObservable.ts b/src/testing/HotObservable.ts index 841f01849c..9d7ba06a38 100644 --- a/src/testing/HotObservable.ts +++ b/src/testing/HotObservable.ts @@ -1,5 +1,5 @@ import Subject from '../Subject'; -import Subscriber from './Subscriber'; +import Subscriber from '../Subscriber'; import Subscription from '../Subscription'; import Scheduler from '../Scheduler'; import TestMessage from './TestMessage';