-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Add --showConfig argument #3296
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
83 changes: 83 additions & 0 deletions
83
integration_tests/__tests__/__snapshots__/showConfig-test.js.snap
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`jest --showConfig outputs config info and exits 1`] = ` | ||
{ | ||
"version": "19.0.2", | ||
"framework": "jasmine2", | ||
"config": { | ||
"automock": false, | ||
"bail": false, | ||
"browser": false, | ||
"cacheDirectory": "/tmp/jest", | ||
"clearMocks": false, | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/" | ||
], | ||
"coverageReporters": [ | ||
"json", | ||
"text", | ||
"lcov", | ||
"clover" | ||
], | ||
"expand": false, | ||
"globals": {}, | ||
"haste": { | ||
"providesModuleNodeModules": [] | ||
}, | ||
"mapCoverage": false, | ||
"moduleDirectories": [ | ||
"node_modules" | ||
], | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"jsx", | ||
"node" | ||
], | ||
"moduleNameMapper": {}, | ||
"modulePathIgnorePatterns": [], | ||
"noStackTrace": false, | ||
"notify": false, | ||
"preset": null, | ||
"resetMocks": false, | ||
"resetModules": false, | ||
"roots": [ | ||
"/mocked/root/path/jest/integration_tests/verbose_reporter" | ||
], | ||
"snapshotSerializers": [], | ||
"testEnvironment": "/mocked/root/path/jest/packages/jest-environment-node/build/index.js", | ||
"testMatch": [ | ||
"**/__tests__/**/*.js?(x)", | ||
"**/?(*.)(spec|test).js?(x)" | ||
], | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/" | ||
], | ||
"testRegex": "", | ||
"testResultsProcessor": null, | ||
"testURL": "about:blank", | ||
"timers": "real", | ||
"transformIgnorePatterns": [ | ||
"/node_modules/" | ||
], | ||
"useStderr": false, | ||
"verbose": null, | ||
"watch": false, | ||
"rootDir": "/mocked/root/path/jest/integration_tests/verbose_reporter", | ||
"name": "[md5 hash]", | ||
"setupFiles": [ | ||
"/mocked/root/path/jest/node_modules/regenerator-runtime/runtime.js" | ||
], | ||
"testRunner": "/mocked/root/path/jest/packages/jest-jasmine2/build/index.js", | ||
"transform": [ | ||
[ | ||
"^.+\\\\.jsx?$", | ||
"/mocked/root/path/jest/integration_tests/verbose_reporter/node_modules/babel-jest/build/index.js" | ||
] | ||
], | ||
"cache": false, | ||
"watchman": true | ||
} | ||
} | ||
|
||
`; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const {linkJestPackage} = require('../utils'); | ||
const path = require('path'); | ||
const runJest = require('../runJest'); | ||
const skipOnWindows = require('skipOnWindows'); | ||
|
||
describe('jest --showConfig', () => { | ||
skipOnWindows.suite(); | ||
|
||
const dir = path.resolve(__dirname, '..', 'verbose_reporter'); | ||
|
||
beforeEach(() => { | ||
if (process.platform !== 'win32') { | ||
linkJestPackage('babel-jest', dir); | ||
} | ||
}); | ||
|
||
it('outputs config info and exits', () => { | ||
const root = path.join(__dirname, '..', '..', '..'); | ||
expect.addSnapshotSerializer({ | ||
print: val => val | ||
.replace(new RegExp(root, 'g'), '/mocked/root/path') | ||
.replace(/"name": "(.+)"/, '"name": "[md5 hash]"') | ||
.replace(/"cacheDirectory": "(.+)"/, '"cacheDirectory": "/tmp/jest"'), | ||
test: val => typeof val === 'string', | ||
}); | ||
const {stdout} = runJest(dir, ['--showConfig', '--no-cache']); | ||
expect(stdout).toMatchSnapshot(); | ||
}); | ||
}); |
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
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
51 changes: 51 additions & 0 deletions
51
packages/jest-editor-support/src/__tests__/Settings-test.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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const {EventEmitter} = require('events'); | ||
const ProjectWorkspace = require('../ProjectWorkspace'); | ||
const Settings = require('../Settings'); | ||
|
||
describe('Settings', () => { | ||
it('sets itself up fom the constructor', () => { | ||
const workspace = new ProjectWorkspace('root_path', 'path_to_jest'); | ||
const settings = new Settings(workspace); | ||
expect(settings.workspace).toEqual(workspace); | ||
expect(settings.settings).toEqual(expect.any(Object)); | ||
}); | ||
|
||
it('reads and parses the config', () => { | ||
const workspace = new ProjectWorkspace('root_path', 'path_to_jest'); | ||
const completed = jest.fn(); | ||
const config = {cacheDirectory: '/tmp/jest', name: '[md5 hash]'}; | ||
const json = { | ||
config, | ||
version: '19.0.0', | ||
}; | ||
const createProcess = () => ({stdout: new EventEmitter()}); | ||
const buffer = makeBuffer(JSON.stringify(json)); | ||
const settings = new Settings(workspace, {createProcess}); | ||
|
||
settings.getConfig(completed); | ||
settings.debugprocess.stdout.emit('data', buffer); | ||
|
||
expect(completed).toHaveBeenCalled(); | ||
expect(settings.jestVersionMajor).toBe(19); | ||
expect(settings.settings).toEqual(config); | ||
}); | ||
}); | ||
|
||
const makeBuffer = (content: string) => { | ||
// Buffer.from is not supported in < Node 5.10 | ||
if (typeof Buffer.from === 'function') { | ||
return Buffer.from(content); | ||
} | ||
|
||
return new Buffer(content); | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This file lacks
'use strict';
declaration, can you add it?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.
Sure thing!