From a36282e3a6c63f1f4dd1fab16be23766965c8432 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 22 Sep 2015 12:15:45 -0400 Subject: [PATCH 1/9] integrate istanbul and codecov --- .gitignore | 1 + package.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 5000af5..41653e5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules .gobble* dist _actual +coverage diff --git a/package.json b/package.json index dfa2420..b29639b 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,8 @@ }, "scripts": { "test": "mocha", + "test-coverage": "istanbul cover --report cobertura node_modules/.bin/_mocha -- -u exports -R spec test/test.js", + "ci": "npm run test-coverage && codecov < coverage/cobertura-coverage.xml", "pretest": "npm run build", "build": "gobble build -f dist", "prepublish": "npm test", @@ -37,6 +39,7 @@ "devDependencies": { "babel": "^5.8.21", "babel-core": "^5.5.8", + "codecov.io": "^0.1.6", "console-group": "^0.1.2", "eslint": "^1.1.0", "gobble": "^0.10.1", @@ -46,6 +49,7 @@ "gobble-esperanto-bundle": "^0.2.0", "gobble-rollup": "^0.8.0", "gobble-rollup-babel": "^0.1.0", + "istanbul": "^0.3.20", "mocha": "^2.2.4", "source-map": "^0.4.4" }, From 69b745f761bef205b7ca5eb4abae439bde2f5de1 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 22 Sep 2015 12:28:34 -0400 Subject: [PATCH 2/9] update travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7fdfdb4..998ec6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,5 @@ node_js: env: global: - BUILD_TIMEOUT=10000 +install: npm install --ignore-scripts +script: npm run ci From 3784c013a86316625df05d4284407a0ee033bb0b Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 22 Sep 2015 12:34:40 -0400 Subject: [PATCH 3/9] fix scripts --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b29639b..68690c4 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,11 @@ "rollup": "./bin/rollup" }, "scripts": { + "pretest": "npm run build", "test": "mocha", + "pretest-coverage": "npm run build", "test-coverage": "istanbul cover --report cobertura node_modules/.bin/_mocha -- -u exports -R spec test/test.js", "ci": "npm run test-coverage && codecov < coverage/cobertura-coverage.xml", - "pretest": "npm run build", "build": "gobble build -f dist", "prepublish": "npm test", "lint": "eslint src" From 7f1a78fae3b439c37be238600f575a6db927be55 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 22 Sep 2015 12:37:20 -0400 Subject: [PATCH 4/9] argh come on --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 998ec6b..e3099fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,5 @@ node_js: env: global: - BUILD_TIMEOUT=10000 -install: npm install --ignore-scripts +install: npm install script: npm run ci From 74b362baa3d44785a99acd17f5d370c5e8dc7896 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 23 Sep 2015 15:36:00 -0400 Subject: [PATCH 5/9] prevent confusion with sourceMappingURL --- src/Module.js | 6 ++++-- src/rollup.js | 4 +--- src/utils/sourceMappingURL.js | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 src/utils/sourceMappingURL.js diff --git a/src/Module.js b/src/Module.js index c6ec708..c017ad5 100644 --- a/src/Module.js +++ b/src/Module.js @@ -6,6 +6,7 @@ import walk from './ast/walk'; import { blank, keys } from './utils/object'; import getLocation from './utils/getLocation'; import makeLegalIdentifier from './utils/makeLegalIdentifier'; +import SOURCEMAPPING_URL from './utils/sourceMappingUrl'; function isEmptyExportedVarDeclaration ( node, exports, toExport ) { if ( node.type !== 'VariableDeclaration' || node.declarations[0].init ) return false; @@ -18,9 +19,10 @@ function isEmptyExportedVarDeclaration ( node, exports, toExport ) { } function removeSourceMappingURLComments ( source, magicString ) { - const pattern = /\/\/#\s+sourceMappingURL=.+\n?/g; + const SOURCEMAPPING_URL_PATTERN = new RegExp( `\\/\\/#\\s+${SOURCEMAPPING_URL}=.+\\n?`, 'g' ); let match; - while ( match = pattern.exec( source ) ) { + + while ( match = SOURCEMAPPING_URL_PATTERN.exec( source ) ) { magicString.remove( match.index, match.index + match[0].length ); } } diff --git a/src/rollup.js b/src/rollup.js index ee2b3b0..018edf6 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -1,11 +1,9 @@ import { basename } from './utils/path'; import { writeFile } from 'sander'; import { keys } from './utils/object'; +import SOURCEMAPPING_URL from './utils/sourceMappingUrl'; import Bundle from './Bundle'; -let SOURCEMAPPING_URL = 'sourceMa'; -SOURCEMAPPING_URL += 'ppingURL'; - export function rollup ( options ) { if ( !options || !options.entry ) { throw new Error( 'You must supply options.entry to rollup' ); diff --git a/src/utils/sourceMappingURL.js b/src/utils/sourceMappingURL.js new file mode 100644 index 0000000..616c24d --- /dev/null +++ b/src/utils/sourceMappingURL.js @@ -0,0 +1,6 @@ +// this looks ridiculous, but it prevents sourcemap tooling from mistaking +// this for an actual sourceMappingURL +let SOURCEMAPPING_URL = 'sourceMa'; +SOURCEMAPPING_URL += 'ppingURL'; + +export default SOURCEMAPPING_URL; From e174eebc7e91ed269189758dafbceee8fcab562a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 23 Sep 2015 15:36:21 -0400 Subject: [PATCH 6/9] create sourcemap and rig up remap-istanbul --- gobblefile.js | 3 ++- package.json | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gobblefile.js b/gobblefile.js index 6036237..4042dd7 100644 --- a/gobblefile.js +++ b/gobblefile.js @@ -8,7 +8,8 @@ var node = src entry: 'rollup.js', dest: 'rollup.js', format: 'cjs', - external: [ 'sander', 'acorn' ] + external: [ 'sander', 'acorn' ], + sourceMap: true }) .transform( 'babel' ); diff --git a/package.json b/package.json index 68690c4..39de624 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,9 @@ "pretest": "npm run build", "test": "mocha", "pretest-coverage": "npm run build", - "test-coverage": "istanbul cover --report cobertura node_modules/.bin/_mocha -- -u exports -R spec test/test.js", - "ci": "npm run test-coverage && codecov < coverage/cobertura-coverage.xml", + "test-coverage": "istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/test.js", + "posttest-coverage": "remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.json -b dist", + "ci": "npm run test-coverage && codecov < coverage/coverage-remapped.json", "build": "gobble build -f dist", "prepublish": "npm test", "lint": "eslint src" From b24c0e2738d2f730c2fb854cd88485fbb024851a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 23 Sep 2015 15:39:13 -0400 Subject: [PATCH 7/9] oops linux is case sensitive --- src/Module.js | 2 +- src/rollup.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module.js b/src/Module.js index c017ad5..a32c021 100644 --- a/src/Module.js +++ b/src/Module.js @@ -6,7 +6,7 @@ import walk from './ast/walk'; import { blank, keys } from './utils/object'; import getLocation from './utils/getLocation'; import makeLegalIdentifier from './utils/makeLegalIdentifier'; -import SOURCEMAPPING_URL from './utils/sourceMappingUrl'; +import SOURCEMAPPING_URL from './utils/sourceMappingURL'; function isEmptyExportedVarDeclaration ( node, exports, toExport ) { if ( node.type !== 'VariableDeclaration' || node.declarations[0].init ) return false; diff --git a/src/rollup.js b/src/rollup.js index 018edf6..e4d3db2 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -1,7 +1,7 @@ import { basename } from './utils/path'; import { writeFile } from 'sander'; import { keys } from './utils/object'; -import SOURCEMAPPING_URL from './utils/sourceMappingUrl'; +import SOURCEMAPPING_URL from './utils/sourceMappingURL'; import Bundle from './Bundle'; export function rollup ( options ) { From 4e2c6ee085b9b6981a69528c2cea39c41ba339a3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 23 Sep 2015 15:41:50 -0400 Subject: [PATCH 8/9] update package.json with remap-istanbul devDependency --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 39de624..9a6f358 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "gobble-rollup-babel": "^0.1.0", "istanbul": "^0.3.20", "mocha": "^2.2.4", + "remap-istanbul": "^0.2.0", "source-map": "^0.4.4" }, "dependencies": { From 82bac613fca78f76855fb2503c4166ae50c9724d Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 23 Sep 2015 15:45:29 -0400 Subject: [PATCH 9/9] remove node 0.10 from build matrix - remap-istanbul doesnt support it --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e3099fe..46b1d69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: node_js node_js: - - "0.10" - "0.12" - "iojs" env: