Skip to content

Commit

Permalink
Merge pull request #1 from brokenmass/chore/travis-build
Browse files Browse the repository at this point in the history
chore: add travis configuration
  • Loading branch information
brokenmass authored Apr 2, 2017
2 parents 4876748 + 2da255e commit 6d0583a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion __snapshots__/index.spec.js.snap-shot
Original file line number Diff line number Diff line change
Expand Up @@ -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};"
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
Expand All @@ -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
}
}
7 changes: 5 additions & 2 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
};

Expand Down

0 comments on commit 6d0583a

Please sign in to comment.