Skip to content

Commit

Permalink
tests(image-cli): migrate to jest
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Apr 6, 2019
1 parent f8dbaef commit 251135d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
script:
- npm run build
- npm run test:lint
- npm run test:coverage
- npm install -g coveralls nyc
- nyc report --reporter=text-lcov | coveralls || echo 'Failed to upload to coveralls...'
- npm run test:unit -- --coverage --runInBand --verbose
- npm install -g coveralls
- cat coverage/lcov.info | coveralls || echo 'Failed to upload to coveralls...'
- stage: deploy
os: linux
dist: trusty
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module.exports = {
'\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'json'],
setupFilesAfterEnv: ['./packages/image/test/utils.js'],
transformIgnorePatterns: ['/node_modules/(?!@tensorflow).*/'],
testPathIgnorePatterns: ['/node_modules/', 'shared-image.test.ts'],
testMatch: ['**/exif/**/*.test.js', '**/image/**/*.test.js', '**/image/**/*.test.ts'],
testMatch: ['**/*.test.js', '**/*.test.ts'],
}
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
"build:watch": "lerna exec --parallel 'tsc -w'",
"test": "npm run build && npm run test:lint && npm run test:unit",
"test:lint": "lint",
"test:unit": "mocha --require source-map-support/register --timeout 20000 'packages/*/test/**/*.test.js'",
"test:unit": "jest",
"test:coverage": "nyc npm run test:unit"
},
"devDependencies": {
"@patrickhulce/lint": "^3.0.2",
"@types/jest": "^24.0.11",
"jest": "^24.7.1",
"lerna": "^3.10.7",
"mocha": "^5.2.0",
"nyc": "^12.0.1",
"source-map-support": "^0.5.6",
"ts-jest": "^24.0.2",
"tslint": "^5.11.0",
"typescript": "^3.3.1"
Expand Down
1 change: 1 addition & 0 deletions packages/image-cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../jest.config')
9 changes: 2 additions & 7 deletions packages/image-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
"download-prebuilt": "./scripts/download-prebuilt.sh",
"build": "tsc && bash ./scripts/build.sh",
"test": "npm run test:lint && npm run test:unit",
"test:unit": "mocha --reporter spec --timeout 4000 'test/**/*.test.js'",
"test:unit": "jest",
"test:lint": "lint",
"test:coverage": "nyc npm run test:unit",
"test:watch": "mocha --watch --reporter dot 'test/**/*.test.js'"
"test:watch": "jest --watch"
},
"publishConfig": {
"access": "public"
Expand All @@ -40,12 +39,8 @@
"@eris/image": "^0.1.0-development",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"cz-conventional-changelog": "^2.0.0",
"execa": "^0.8.0",
"mocha": "^4.0.1",
"nyc": "^11.2.1",
"pkg": "^4.3.7",
"semantic-release": "^8.0.3",
"sinon": "^4.0.1",
"sinon-chai": "^2.14.0"
},
Expand Down
15 changes: 2 additions & 13 deletions packages/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
"build:rollup": "rollup -c rollup.config.js && cp dist/bundle.js demo/ && cp dist/browser-index.d.ts dist/bundle.d.ts",
"build:rollup:minify": "cross-env MINIFY=true rollup -c rollup.config.js && cp dist/bundle.min.js demo/",
"test": "npm run test:lint && npm run test:unit",
"test:unit": "mocha --require source-map-support/register --timeout 20000 --reporter spec --recursive ./test",
"test:unit": "jest",
"test:lint": "lint",
"test:update-expectations": "cross-env UPDATE_EXPECTATIONS=true npm run test:unit",
"test:upload": "bash test/fixtures/upload.sh",
"test:update-all": "npm run test:update-expectations && npm run test:upload",
"test:download": "bash test/fixtures/download.sh",
"test:coverage": "nyc npm run test:unit",
"test:watch": "mocha --watch --reporter dot 'test/**/*.test.js'",
"semantic-release": "semantic-release pre && npm publish --access public && semantic-release post"
"test:watch": "jest --watch"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -51,21 +46,15 @@
"babili": "^0.1.2",
"chai": "^3.5.0",
"cross-env": "^5.1.0",
"cz-conventional-changelog": "^2.0.0",
"istanbul": "^0.4.5",
"lodash": "^4.17.4",
"mocha": "^3.3.0",
"nyc": "^10.3.2",
"rollup": "^0.41.6",
"rollup-plugin-alias": "^1.3.1",
"rollup-plugin-babili": "^3.0.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"semantic-release": "^6.3.2",
"sinon": "^2.1.0",
"sinon-chai": "^2.9.0",
"source-map-support": "^0.4.15",
"tslint": "^5.2.0",
"typescript": "^3.3.1"
},
Expand Down

0 comments on commit 251135d

Please sign in to comment.