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

chore: convert jest-cli and jest-validate to esm #8874

Merged
merged 5 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
- `[*]` Add Node 12 to CI ([#8411](https://github.com/facebook/jest/pull/8411))
- `[*]` [**BREAKING**] Upgrade to Micromatch v4 ([#8852](https://github.com/facebook/jest/pull/8852))
- `[docs]` Fix broken link pointing to legacy JS file in "Snapshot Testing".
- `[jest-cli]` [**BREAKING**] Use ESM exports ([#8874](https://github.com/facebook/jest/pull/8874))
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade JSDOM from v11 to v15 ([#8851](https://github.com/facebook/jest/pull/8851))
- `[jest-util]` [**BREAKING**] Remove deprecated exports ([#8863](https://github.com/facebook/jest/pull/8863))
- `[jest-validate]` [**BREAKING**] Use ESM exports ([#8874](https://github.com/facebook/jest/pull/8874))

### Performance

Expand Down
13 changes: 2 additions & 11 deletions packages/jest-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@
*/

// TODO: remove @jest/core exports for the next major
SimenB marked this conversation as resolved.
Show resolved Hide resolved
import {
export {
SearchSource,
TestScheduler,
TestWatcher,
getVersion,
runCLI,
} from '@jest/core';
import {run} from './cli';

export = {
SearchSource,
TestScheduler,
TestWatcher,
getVersion,
run,
runCLI,
thymikee marked this conversation as resolved.
Show resolved Hide resolved
};
export {run} from './cli';
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function jasmine2(
});

const env = jasmine.getEnv();
const jasmineInterface = jasmineFactory.interface(jasmine, env);
const jasmineInterface = jasmineFactory._interface(jasmine, env);
Object.assign(environment.global, jasmineInterface);
env.addReporter(jasmineInterface.jsApiReporter);

Expand Down
8 changes: 3 additions & 5 deletions packages/jest-jasmine2/src/jasmine/jasmineLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import SpyRegistry from './spyRegistry';
import Suite from './Suite';
import Timer from './Timer';

const create = function(createOptions: Record<string, any>): Jasmine {
export const create = function(createOptions: Record<string, any>): Jasmine {
const j$ = {...createOptions} as Jasmine;

j$._DEFAULT_TIMEOUT_INTERVAL = createOptions.testTimeout || 5000;
Expand All @@ -63,7 +63,8 @@ const create = function(createOptions: Record<string, any>): Jasmine {
return j$;
};

const _interface = function(jasmine: Jasmine, env: any) {
// Interface is a reserved word in strict mode, so can't export it as ESM
export const _interface = function(jasmine: Jasmine, env: any) {
const jasmineInterface = {
describe(description: string, specDefinitions: Function) {
return env.describe(description, specDefinitions);
Expand Down Expand Up @@ -146,6 +147,3 @@ const _interface = function(jasmine: Jasmine, env: any) {

return jasmineInterface;
};

// Interface is a reserved word in strict mode, so can't export it as ESM
export = {create, interface: _interface};
18 changes: 4 additions & 14 deletions packages/jest-validate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import {
export {
ValidationError,
createDidYouMeanMessage,
format,
logValidationWarning,
} from './utils';
import validate from './validate';
import validateCLIOptions from './validateCLIOptions';
import {multipleValidOptions} from './condition';

export = {
ValidationError,
createDidYouMeanMessage,
format,
logValidationWarning,
multipleValidOptions,
validate,
validateCLIOptions,
};
export {default as validate} from './validate';
export {default as validateCLIOptions} from './validateCLIOptions';
export {multipleValidOptions} from './condition';