Skip to content

Commit

Permalink
Rename jest-matchers to expect (#4345)
Browse files Browse the repository at this point in the history
* Rename jest-matchers to expect

* lint
  • Loading branch information
SimenB authored and cpojer committed Aug 24, 2017
1 parent 64535a1 commit a397aba
Show file tree
Hide file tree
Showing 34 changed files with 25 additions and 33 deletions.
2 changes: 1 addition & 1 deletion integration_tests/browser-support/browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

/* eslint-disable */
var expect = require('../../packages/jest-matchers/build-es5/index.js');
var expect = require('../../packages/expect/build-es5/index.js');
var mock = require('../../packages/jest-mock/build-es5/index.js');
var prettyFormat = require('../../packages/pretty-format/build-es5/index.js');

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "jest-matchers",
"name": "expect",
"version": "20.0.3",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Expected the function to throw an error of type:
<green>\\"Err2\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrow() error class threw, but should not have 1`] = `
Expand All @@ -25,7 +25,7 @@ Expected the function not to throw an error of type:
<green>\\"Err\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrow() invalid actual 1`] = `
Expand Down Expand Up @@ -58,7 +58,7 @@ Expected the function to throw an error matching:
<green>/banana/</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrow() regexp threw, but should not have 1`] = `
Expand All @@ -68,7 +68,7 @@ Expected the function not to throw an error matching:
<green>/apple/</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrow() strings did not throw at all 1`] = `
Expand All @@ -86,7 +86,7 @@ Expected the function to throw an error matching:
<green>\\"banana\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrow() strings threw, but should not have 1`] = `
Expand All @@ -96,7 +96,7 @@ Expected the function not to throw an error matching:
<green>\\"apple\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() error class did not throw at all 1`] = `
Expand All @@ -114,7 +114,7 @@ Expected the function to throw an error of type:
<green>\\"Err2\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() error class threw, but should not have 1`] = `
Expand All @@ -124,7 +124,7 @@ Expected the function not to throw an error of type:
<green>\\"Err\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() invalid actual 1`] = `
Expand Down Expand Up @@ -157,7 +157,7 @@ Expected the function to throw an error matching:
<green>/banana/</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() regexp threw, but should not have 1`] = `
Expand All @@ -167,7 +167,7 @@ Expected the function not to throw an error matching:
<green>/apple/</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() strings did not throw at all 1`] = `
Expand All @@ -185,7 +185,7 @@ Expected the function to throw an error matching:
<green>\\"banana\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
exports[`.toThrowError() strings threw, but should not have 1`] = `
Expand All @@ -195,5 +195,5 @@ Expected the function not to throw an error matching:
<green>\\"apple\\"</>
Instead, it threw:
<red> Error </>
<red> <dim>at jestExpect (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
<red> <dim>at jestExpect (packages/expect/src/__tests__/toThrowMatchers-test.js<dim>:24:74)</>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Error {
this.stack =
'Error\n' +
' at jestExpect' +
' (packages/jest-matchers/src/__tests__/toThrowMatchers-test.js:24:74)';
' (packages/expect/src/__tests__/toThrowMatchers-test.js:24:74)';
}
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/jest-circus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"main": "build/index.js",
"dependencies": {
"chalk": "^2.0.1",
"expect": "^20.0.3",
"jest-snapshot": "^20.0.3",
"jest-matchers": "^20.0.3",
"jest-matcher-utils": "^20.0.3",
"jest-message-util": "^20.0.3",
"jest-diff": "^20.0.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import type {TestResult, Status} from 'types/TestResult';
import type {GlobalConfig, Path, ProjectConfig} from 'types/Config';
import type {Event, TestEntry} from 'types/Circus';

import {
extractExpectedAssertionsErrors,
getState,
setState,
} from 'jest-matchers';
import {extractExpectedAssertionsErrors, getState, setState} from 'expect';
import {formatResultsErrors} from 'jest-message-util';
import {SnapshotState, addSerializer} from 'jest-snapshot';
import {addEventHandler, ROOT_DESCRIBE_BLOCK_NAME} from '../state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import type {RawMatcherFn} from 'types/Matchers';

import expect from 'jest-matchers';
import expect from 'expect';

import {
addSerializer,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"main": "build/index.js",
"dependencies": {
"chalk": "^2.0.1",
"expect": "^20.0.3",
"graceful-fs": "^4.1.11",
"jest-diff": "^20.0.3",
"jest-matcher-utils": "^20.0.3",
"jest-matchers": "^20.0.3",
"jest-message-util": "^20.0.3",
"jest-snapshot": "^20.0.3"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`matchers proxies matchers to jest-matchers 1`] = `
exports[`matchers proxies matchers to expect 1`] = `
"<dim>expect(<red>received</><dim>).toBe(<green>expected</><dim>)
Expected value to be (using ===):
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/__tests__/matchers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'use strict';

describe('matchers', () => {
it('proxies matchers to jest-matchers', () => {
it('proxies matchers to expect', () => {
expect(() => expect(1).toBe(2)).toThrowErrorMatchingSnapshot();
});
});
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jest_expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import type {RawMatcherFn} from 'types/Matchers';

import expect from 'jest-matchers';
import expect from 'expect';
import {
addSerializer,
toMatchSnapshot,
Expand Down
6 changes: 1 addition & 5 deletions packages/jest-jasmine2/src/setup_jest_globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
import type {GlobalConfig, Path, ProjectConfig} from 'types/Config';
import type {Plugin} from 'types/PrettyFormat';

import {
extractExpectedAssertionsErrors,
getState,
setState,
} from 'jest-matchers';
import {extractExpectedAssertionsErrors, getState, setState} from 'expect';
import {SnapshotState, addSerializer} from 'jest-snapshot';

export type SetupOptions = {|
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-matcher-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-matcher-utils",
"description": "A set of utility functions for jest-matchers and related packages",
"description": "A set of utility functions for expect and related packages",
"version": "20.0.3",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const JS_FILES_PATTERN = '**/*.js';
const IGNORE_PATTERN = '**/__tests__/**';
const PACKAGES_DIR = path.resolve(__dirname, '../packages');

const INLINE_REQUIRE_BLACKLIST = /packages\/(jest-(circus|diff|get-type|jasmine2|matcher-utils|matchers|message-util|regex-util|snapshot))|pretty-format\//;
const INLINE_REQUIRE_BLACKLIST = /packages\/expect|(jest-(circus|diff|get-type|jasmine2|matcher-utils|message-util|regex-util|snapshot))|pretty-format\//;

const transformOptions = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '..', '.babelrc'), 'utf8')
Expand Down

0 comments on commit a397aba

Please sign in to comment.