Skip to content
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

Merged
merged 5 commits into from
Jun 1, 2018
Merged

Conversation

didi0613
Copy link
Contributor

@didi0613 didi0613 commented May 2, 2018

  • jest config extenable from app level
  • auto detect jest unit tests, can run karma unit tests in parallel

@didi0613 didi0613 changed the title [do not merge]Jest support Jest support May 7, 2018
const Path = require("path");
const optionalRequire = require("optional-require")(require);

const rootDir = Path.join(Path.resolve("node_modules"), "..");
Copy link
Member

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(
Copy link
Member

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`);
Copy link
Member

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(
Copy link
Member

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`);
Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use

mkCmd( `~$karma start`, ... )

@didi0613 didi0613 changed the title Jest support [minor] Jest support May 10, 2018
@jchip jchip merged commit 2c8e15f into electrode-io:master Jun 1, 2018
@didi0613 didi0613 deleted the jest-test-support branch August 3, 2018 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants