diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..eaa08ff --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: node_js +node_js: + - "6" + - "7" +os: + - linux +sudo: false +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 +before_install: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-4.8; fi +install: + - npm install + - npm install -g codecov +script: + - npm run lint + - npm run test +after_success: + - cat ./coverage/lcov.info | codecov + - npm run semantic-release diff --git a/__snapshots__/index.spec.js.snap-shot b/__snapshots__/index.spec.js.snap-shot index 58c9bc5..571faca 100644 --- a/__snapshots__/index.spec.js.snap-shot +++ b/__snapshots__/index.spec.js.snap-shot @@ -166,7 +166,7 @@ exports['name can be a function 1'] = { "width": "original", "quality": 95 }, - "resourcePath": "/Users/massa/Dev/advanced-image-loader/test/assets/test.png" + "resourcePath": "assets/test.png" } exports['name can be a function 2'] = "module.exports = {\n src: __webpack_public_path__ + \"image.jpg\",\n width: 1600,\n height: 900,\n toString: function() {return __webpack_public_path__ + \"image.jpg\";},\n images: [\n {\n src: __webpack_public_path__ + \"image.jpg\",\n width: 1600,\n height: 900\n }\n ]\n};" diff --git a/package.json b/package.json index ccefe33..5a62d73 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "lint": "eslint --ignore-path .gitignore '**/*.js'", "precommit": "npm run lint", "prepush": "npm run test", + "semantic-release": "semantic-release pre && npm publish && semantic-release post", "test": "SHOW=1 nyc mocha test/**/*.spec.js", "test:update-snapshot": "UPDATE=1 mocha test/**/*.spec.js" }, @@ -41,6 +42,7 @@ "husky": "^0.13.3", "mocha": "^3.2.0", "nyc": "^10.2.0", + "semantic-release": "^6.3.2", "sinon": "^2.1.0", "sinon-chai": "^2.9.0", "snap-shot": "^2.16.3" @@ -50,5 +52,21 @@ "ajv-keywords": "^1.5.1", "loader-utils": "^1.1.0", "sharp": "^0.17.2" + }, + "nyc": { + "lines": 100, + "statements": 100, + "functions": 100, + "branches": 100, + "include": [ + "src/**/*.js" + ], + "reporter": [ + "lcov", + "text" + ], + "cache": true, + "check-coverage": true, + "all": true } } diff --git a/test/index.spec.js b/test/index.spec.js index 448a2e5..a4e3d79 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -338,8 +338,11 @@ describe('advanced-image-loader', () => { it('name can be a function', () => { const nameFunction = (data) => { - // ignore buffer in the snapshot - snapshot(Object.assign(data, { buffer: 'buffer' })); + // ignore buffer and make path relative in the snapshot + snapshot(Object.assign(data, { + buffer: 'buffer', + resourcePath: path.relative(__dirname, data.resourcePath) + })); return 'image'; };