forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanups for jest-editor-support (jestjs#2308)
* Cleanups for jest-editor-support * Disable a test on windows.
- Loading branch information
Showing
13 changed files
with
255 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 16 additions & 9 deletions
25
...es/jest-editor-support/src/JestProcess.js → packages/jest-editor-support/src/Process.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
// @flow | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const {ChildProcess, spawn} = require('child_process'); | ||
const ProjectWorkspace = require('./ProjectWorkspace'); | ||
|
||
/** | ||
* Spawns and returns a Jest process with specific args | ||
* | ||
* Spawns and returns a Jest process with specific args | ||
* | ||
* @param {string[]} args | ||
* @returns {ChildProcess} | ||
*/ | ||
module.exports.jestChildProcessWithArgs = ( | ||
workspace: ProjectWorkspace, args: string[], | ||
): ChildProcess => { | ||
workspace: ProjectWorkspace, args: Array<string>, | ||
): ChildProcess => { | ||
|
||
// A command could look like `npm run test`, which we cannot use as a command | ||
// as they can only be the first command, so take out the command, and add | ||
// any other bits into the args | ||
const runtimeExecutable = workspace.pathToJest; | ||
const [command, ...initialArgs] = runtimeExecutable.split(' '); | ||
const runtimeArgs = [...initialArgs, ...args]; | ||
// To use our own commands in create-react, we need to tell the command that | ||
|
||
// To use our own commands in create-react, we need to tell the command that | ||
// we're in a CI environment, or it will always append --watch | ||
const env = process.env; | ||
env['CI'] = 'true'; | ||
|
||
return spawn(command, runtimeArgs, {cwd: workspace.rootPath, env}); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 25 additions & 17 deletions
42
...ges/jest-editor-support/src/JestRunner.js → packages/jest-editor-support/src/Runner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.