Skip to content

Commit

Permalink
Don’t crash because of PNGs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow committed Feb 6, 2019
1 parent 51a1491 commit bc95151
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .nycrc-frontend.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"sourceMap": false,
"instrument": false,
"include": ["frontend/**/*.js"],
"exclude": ["**/*.spec.js"]
"exclude": ["**/*.spec.js", "**/mocha-*.js"]
}
5 changes: 5 additions & 0 deletions frontend/mocha-ignore-pngs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import requireHacker from 'require-hacker'

// https://diessi.ca/blog/how-to-exclude-css-images-anything-from-unit-tests/

requireHacker.hook('png', () => 'module.exports = ""')
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"test:js:server": "echo \"Deprecated; run `npm run test:core` instead.\" && npm run test:core",
"test:js:frontend": "echo \"Deprecated; run `npm run test:frontend` instead.\" && npm run test:frontend",
"test:js:package": "echo \"Deprecated; run `npm run test:package` instead.\" && npm run test:package",
"test:frontend": "cross-env NODE_ENV=test mocha --opts mocha.opts --require @babel/polyfill --require @babel/register --require mocha-yaml-loader \"frontend/**/*.spec.js\"",
"test:frontend": "cross-env NODE_ENV=test mocha --opts mocha.opts --require @babel/polyfill --require @babel/register --require mocha-yaml-loader --require frontend/mocha-ignore-pngs \"frontend/**/*.spec.js\"",
"test:core": "cross-env NODE_CONFIG_ENV=test mocha --opts mocha.opts \"core/**/*.spec.js\" \"lib/**/*.spec.js\" \"services/**/*.spec.js\"",
"test:package": "mocha --opts mocha.opts \"gh-badges/**/*.spec.js\"",
"test:entrypoint": "cross-env NODE_CONFIG_ENV=test mocha --opts mocha.opts entrypoint.spec.js",
Expand Down Expand Up @@ -201,6 +201,7 @@
"react-select": "^2.3.0",
"read-all-stdin-sync": "^1.0.5",
"redis-server": "^1.2.2",
"require-hacker": "^3.0.1",
"rimraf": "^2.6.3",
"sazerac": "^0.4.2",
"sinon": "^7.2.3",
Expand Down

0 comments on commit bc95151

Please sign in to comment.