javascript - Disable Jasmine's fdescribe() and fit() based on environment -
fdescribe()
, fit()
great reducing noise when you're working on subset of tests. forget change them describe()
/it()
before merging branch master. (it's okay have them in separate branch while working on code - i.e. pre-commit check wouldn't work me.)
my ci environment codeship. there solution problem fail tests in codeship if came across focused methods?
using no-focused-tests okay. idea how enable rule error in codeship , disable locally?
using no-focused-tests okay. idea how enable rule error in codeship , disable locally?
you use combination of environment variables , redefining fdescribe/fit global functions:
npm --save cross-env
package.json:
"scripts": { "test": "jasmine", "test-safe": "cross-env focused_tests=off jasmine" },
disablefocusedtestsifnecessary.js (included after jasmine defines globals):
if (process.env.focused_tests === "off") { console.log("focused tests must off"); global.fdescribe = global.fit = function() { throw new error("fdescribe , fit disabled in environment"); }; } else { console.log("focused tests enabled"); }
tell codeship run
npm run test-safe
instead ofnpm run test
Comments
Post a Comment