This repository was archived by the owner on Dec 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
sync jest dir from nuclide repo #273
Open
boujeepossum
wants to merge
1
commit into
facebookarchive:master
Choose a base branch
from
boujeepossum:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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,18 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict-local | ||
| * @format | ||
| */ | ||
|
|
||
| test('pass', () => { | ||
| const atom = require('atom'); | ||
| const electron = require('electron'); | ||
|
|
||
| expect(atom).toBeDefined(); | ||
| expect(electron).toBeDefined(); | ||
| }); |
This file contains hidden or 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,16 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict-local | ||
| * @format | ||
| */ | ||
|
|
||
| test('fake timers are not available yet', () => { | ||
| expect(() => { | ||
| jest.useFakeTimers(); | ||
| }).toThrow('fakeTimers are not supproted in atom environment'); | ||
| }); |
This file contains hidden or 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,14 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| test('atom', () => { | ||
| expect(1).toBe(1); | ||
| }); |
This file contains hidden or 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,14 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| test('atom', () => { | ||
| expect(2).toBe(2); | ||
| }); |
This file contains hidden or 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,13 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| // eslint-disable-next-line nuclide-internal/no-commonjs | ||
| module.exports = {}; |
This file contains hidden or 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) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| const logger: log4js$Logger = { | ||
| debug: jest.fn(), | ||
| error: jest.fn(), | ||
| fatal: jest.fn(), | ||
| info: jest.fn(), | ||
| isLevelEnabled: jest.fn(), | ||
| // $FlowFixMe | ||
| level: jest.fn(), | ||
| log: jest.fn(), | ||
| mark: jest.fn(), | ||
| removeLevel: jest.fn(), | ||
| setLevel: jest.fn(), | ||
| trace: jest.fn(), | ||
| warn: jest.fn(), | ||
| }; | ||
|
|
||
| export const getLogger = (name: string): log4js$Logger => logger; | ||
|
|
||
| const log4js = { | ||
| getLogger, | ||
| // $FlowFixMe | ||
| configure: jest.fn(), | ||
| }; | ||
|
|
||
| export default log4js; |
This file contains hidden or 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,35 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow | ||
| * @format | ||
| */ | ||
|
|
||
| export function trackTiming<T>( | ||
| eventName: string, | ||
| operation: () => T, | ||
| values?: {[key: string]: any} = {}, | ||
| ): T { | ||
| return operation(); | ||
| } | ||
|
|
||
| export const track: any = jest.fn(); | ||
|
|
||
| export const startTracking = () => { | ||
| const timingTracker: any = { | ||
| onError: jest.fn(), | ||
| onSuccess: jest.fn(), | ||
| }; | ||
|
|
||
| return timingTracker; | ||
| }; | ||
|
|
||
| export const trackImmediate: any = jest.fn(); | ||
|
|
||
| export const setRawAnalyticsService: any = jest.fn(); | ||
|
|
||
| export const trackTimingSampled: any = jest.fn((event, fn) => fn()); |
This file contains hidden or 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,28 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| import waitsFor from '../waits_for'; | ||
|
|
||
| it('waits', async () => { | ||
| let condition = false; | ||
| Promise.resolve().then(() => (condition = true)); | ||
| await waitsFor(() => condition); | ||
| }); | ||
|
|
||
| it("can't wait anymore", async () => { | ||
| await expect(waitsFor(() => false, undefined, 1)).rejects.toThrow( | ||
| 'but it never did', | ||
| ); | ||
| }); | ||
|
|
||
| it('gives a message', async () => { | ||
| await expect(waitsFor(() => false, 'lol', 1)).rejects.toThrow('lol'); | ||
| }); |
This file contains hidden or 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,15 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright (c) 2015-present, Facebook, Inc. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the license found in the LICENSE file in | ||
| # the root directory of this source tree. | ||
|
|
||
| THIS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
| FBSOURCE_ROOT=$(realpath "$THIS_DIR""/../../..") | ||
|
|
||
|
|
||
| cd "$FBSOURCE_ROOT""/xplat/nuclide/modules/jest-atom-runner" || exit | ||
|
|
||
| ./node_modules/.bin/babel src --out-dir build |
This file contains hidden or 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) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @noflow | ||
| */ | ||
| 'use strict'; | ||
|
|
||
| /* eslint | ||
| comma-dangle: [1, always-multiline], | ||
| prefer-object-spread/prefer-object-spread: 0, | ||
| nuclide-internal/no-commonjs: 0, | ||
| */ | ||
|
|
||
| const path = require('path'); | ||
|
|
||
| module.exports = { | ||
| displayName: 'atom', | ||
| rootDir: path.resolve(__dirname, '../../..'), | ||
| roots: ['<rootDir>/xplat/nuclide'], | ||
| testMatch: ['**/__atom_tests__/**/*.js?(x)'], | ||
| transform: { | ||
| '\\.js$': '<rootDir>/xplat/nuclide/modules/nuclide-jest/jestTransformer.js', | ||
| }, | ||
| setupTestFrameworkScriptFile: '<rootDir>/xplat/nuclide/jest/setupTestFrameworkScriptFile.atom.js', | ||
| testPathIgnorePatterns: ['/node_modules/'], | ||
| runner: path.resolve(__dirname, '../modules/jest-atom-runner/build/index.js'), | ||
| moduleNameMapper: { | ||
| oniguruma: path.resolve(__dirname, './__mocks__/emptyObject.js'), | ||
| }, | ||
| testEnvironment: | ||
| '<rootDir>/xplat/nuclide/modules/jest-atom-runner/build/environment.js', | ||
| }; |
This file contains hidden or 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,31 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @noflow | ||
| */ | ||
| 'use strict'; | ||
|
|
||
| /* eslint | ||
| comma-dangle: [1, always-multiline], | ||
| prefer-object-spread/prefer-object-spread: 0, | ||
| nuclide-internal/no-commonjs: 0, | ||
| */ | ||
|
|
||
| const path = require('path'); | ||
|
|
||
| module.exports = { | ||
| displayName: 'node', | ||
| rootDir: path.resolve(__dirname, '../../../'), | ||
| roots: ['<rootDir>/xplat/nuclide'], | ||
| testMatch: ['**/__tests__/**/*.js?(x)'], | ||
| transform: { | ||
| '\\.js$': '<rootDir>/xplat/nuclide/modules/nuclide-jest/jestTransformer.js', | ||
| }, | ||
| setupTestFrameworkScriptFile: '<rootDir>/xplat/nuclide/jest/setupTestFrameworkScriptFile.node.js', | ||
| setupFiles: ['<rootDir>/xplat/nuclide/jest/setup.js'], | ||
| testPathIgnorePatterns: ['/node_modules/'], | ||
| }; |
This file contains hidden or 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,15 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the license found in the LICENSE file in | ||
| * the root directory of this source tree. | ||
| * | ||
| * @flow strict | ||
| * @format | ||
| */ | ||
|
|
||
| jest.mock('nuclide-commons/analytics'); | ||
| jest.mock('log4js'); | ||
|
|
||
| global.NUCLIDE_DO_NOT_LOG = true; |
Oops, something went wrong.
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.
ugh.. seems like this file wasn't prettified before