-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[minor] Jest support #775
[minor] Jest support #775
Conversation
didi0613
commented
May 2, 2018
•
edited
Loading
edited
- jest config extenable from app level
- auto detect jest unit tests, can run karma unit tests in parallel
ed772e5
to
d78cb21
Compare
const Path = require("path"); | ||
const optionalRequire = require("optional-require")(require); | ||
|
||
const rootDir = Path.join(Path.resolve("node_modules"), ".."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so essentially process.cwd()
const optionalRequire = require("optional-require")(require); | ||
|
||
const rootDir = Path.join(Path.resolve("node_modules"), ".."); | ||
const devPkgPath = Path.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically Path.join(__dirname, "../..")
const srcJestFiles = glob.sync(`${Path.resolve(AppMode.src.dir)}/**/\*.{test,spec}.{js,jsx}`); | ||
|
||
if (shell.test("-d", "_test_") || srcJestFiles.length > 0) { | ||
console.log(`\n*** Running jest unit tests: ***\n`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a logger.
|
||
if (shell.test("-d", "_test_") || srcJestFiles.length > 0) { | ||
console.log(`\n*** Running jest unit tests: ***\n`); | ||
return exec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
mkCmd( `~$jest`, `--config ${archetype.config.jest}/jest.config.js`)
), | ||
"karma-test-frontend-cov": () => { | ||
if (shell.test("-d", "test")) { | ||
console.log(`\n*** Running karma unit tests: ***\n`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid console.log. we have a logger.
"karma-test-frontend-cov": () => { | ||
if (shell.test("-d", "test")) { | ||
console.log(`\n*** Running karma unit tests: ***\n`); | ||
return exec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
mkCmd( `~$karma start`, ... )
…to jest-test-support