-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
206 additions
and
53 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
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": "/mocked/root/path/integration_tests/showConfig/tmp", | ||
"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/integration_tests/showConfig" | ||
], | ||
"snapshotSerializers": [], | ||
"testEnvironment": "/mocked/root/path/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/integration_tests/showConfig", | ||
"name": "9899e51dcb776e8e85239505414e0d13", | ||
"setupFiles": [ | ||
"/mocked/root/path/node_modules/regenerator-runtime/runtime.js" | ||
], | ||
"testRunner": "/mocked/root/path/packages/jest-jasmine2/build/index.js", | ||
"transform": [ | ||
[ | ||
"^.+\\\\.jsx?$", | ||
"/mocked/root/path/integration_tests/showConfig/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,36 @@ | ||
/** | ||
* 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, '..', 'showConfig'); | ||
|
||
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'), | ||
test: val => typeof val === 'string' && val.indexOf(root) > -1, | ||
}); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"jest": { | ||
"cacheDirectory": "tmp", | ||
"testEnvironment": "node" | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
/** | ||
* 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 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 jestPath = 'packages/jest/node_modules/.bin/jest'; | ||
const workspace = new ProjectWorkspace('.', jestPath); | ||
const completed = jest.fn(); | ||
const settings = new Settings(workspace); | ||
|
||
settings.getConfig(completed); | ||
|
||
// Should have been called but isn't | ||
expect(completed).not.toHaveBeenCalled(); | ||
}); | ||
}); |