Skip to content

Commit

Permalink
build(devs-dep): adopt Jest 28.0.0-alpha.11 (#3449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Apr 24, 2022
1 parent 45ca79e commit 724d2b0
Show file tree
Hide file tree
Showing 35 changed files with 27,327 additions and 14,567 deletions.
8 changes: 5 additions & 3 deletions .eslintignore
@@ -1,4 +1,6 @@
dist/
node_modules/
coverage/
dist
node_modules
coverage
presets/index.d.ts
website/build
website/.docusaurus
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/const-enum.test.ts.snap
Expand Up @@ -9,7 +9,7 @@ exports[`partial successfully runs the tests inside const-enum with 'isolatedMod
However, Jest was able to find:
'../hoo-constant.d.ts'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'jsx', 'ts', 'tsx', 'json', 'node'].
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'].
See https://jestjs.io/docs/configuration#modulefileextensions-arraystring
Expand All @@ -19,7 +19,7 @@ exports[`partial successfully runs the tests inside const-enum with 'isolatedMod
3 | const getTwo = (): string => HooConstEnum.two
4 |
at Resolver.resolveModule (../../node_modules/jest-resolve/build/resolver.js:324:11)
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:493:11)
at Object.<anonymous> (__tests__/import-from-d-ts-no-js.spec.ts:1:1)
PASS __tests__/import-from-d-ts-has-js.spec.ts
Expand Down
20 changes: 10 additions & 10 deletions e2e/__tests__/__snapshots__/enum.test.ts.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`partial successfully runs the tests inside \`enum/\` with \`isolatedModules: false\` 1`] = `
exports[`partial successfully runs the tests inside enum with 'isolatedModules: false' 1`] = `
"FAIL __tests__/import-from-d-ts-no-js.spec.ts
● Test suite failed to run
Expand All @@ -9,24 +9,24 @@ exports[`partial successfully runs the tests inside \`enum/\` with \`isolatedMod
However, Jest was able to find:
'../hoo-constant.d.ts'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'jsx', 'ts', 'tsx', 'json', 'node'].
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'].
See https://jestjs.io/docs/configuration#modulefileextensions-arraystring
> 1 | import { HooEnum } from '../hoo-constant'
> 1 | import { FooEnum } from '../hoo-constant'
| ^
2 |
3 | const getTwo = (): string => HooEnum.two
3 | const getTwo = (): string => FooEnum.two
4 |
at Resolver.resolveModule (../../node_modules/jest-resolve/build/resolver.js:324:11)
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:493:11)
at Object.<anonymous> (__tests__/import-from-d-ts-no-js.spec.ts:1:1)
PASS __tests__/import-from-d-ts-has-js.spec.ts
PASS __tests__/import-from-ts.spec.ts"
`;
exports[`partial successfully runs the tests inside \`enum/\` with \`isolatedModules: true\` 1`] = `
exports[`partial successfully runs the tests inside enum with 'isolatedModules: true' 1`] = `
"FAIL __tests__/import-from-d-ts-no-js.spec.ts
● Test suite failed to run
Expand All @@ -35,17 +35,17 @@ exports[`partial successfully runs the tests inside \`enum/\` with \`isolatedMod
However, Jest was able to find:
'../hoo-constant.d.ts'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'jsx', 'ts', 'tsx', 'json', 'node'].
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'].
See https://jestjs.io/docs/configuration#modulefileextensions-arraystring
> 1 | import { HooEnum } from '../hoo-constant'
> 1 | import { FooEnum } from '../hoo-constant'
| ^
2 |
3 | const getTwo = (): string => HooEnum.two
3 | const getTwo = (): string => FooEnum.two
4 |
at Resolver.resolveModule (../../node_modules/jest-resolve/build/resolver.js:324:11)
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:493:11)
at Object.<anonymous> (__tests__/import-from-d-ts-no-js.spec.ts:1:1)
PASS __tests__/import-from-d-ts-has-js.spec.ts
Expand Down
10 changes: 5 additions & 5 deletions e2e/__tests__/enum.test.ts
@@ -1,16 +1,16 @@
import runJest from '../run-jest'
import { extractSortedSummary } from '../utils'

const DIR = 'enum'
const DIR_NAME = 'enum'

test('partial successfully runs the tests inside `enum/` with `isolatedModules: false`', () => {
const result = runJest(DIR)
test(`partial successfully runs the tests inside ${DIR_NAME} with 'isolatedModules: false'`, () => {
const result = runJest(DIR_NAME)

expect(extractSortedSummary(result.stderr).rest).toMatchSnapshot()
})

test('partial successfully runs the tests inside `enum/` with `isolatedModules: true`', () => {
const result = runJest(DIR, ['-c=jest-isolated.config.js'])
test(`partial successfully runs the tests inside ${DIR_NAME} with 'isolatedModules: true'`, () => {
const result = runJest(DIR_NAME, ['-c=jest-isolated.config.js'])

expect(extractSortedSummary(result.stderr).rest).toMatchSnapshot()
})
4 changes: 2 additions & 2 deletions e2e/enum/__tests__/import-from-d-ts-no-js.spec.ts
@@ -1,6 +1,6 @@
import { HooEnum } from '../hoo-constant'
import { FooEnum } from '../hoo-constant'

const getTwo = (): string => HooEnum.two
const getTwo = (): string => FooEnum.two

test('should pass', () => {
expect(getTwo()).toBe('TWO')
Expand Down
2 changes: 1 addition & 1 deletion e2e/enum/hoo-constant.d.ts
@@ -1,3 +1,3 @@
export declare enum HooEnum {
export declare enum FooEnum {
two = 'TWO',
}
3 changes: 3 additions & 0 deletions e2e/native-esm-js/__tests__/native-esm.spec.ts
Expand Up @@ -23,8 +23,11 @@ test('should have correct import.meta', () => {
expect(typeof require).toBe('undefined')
expect(typeof jest).toBe('undefined')
expect(import.meta).toEqual({
jest: expect.anything(),
url: expect.any(String),
})
// @ts-expect-error `jest` exists in import.meta in Jest 28
expect(import.meta.jest).toBe(jestObject)
expect(import.meta.url.endsWith('/e2e/native-esm-js/__tests__/native-esm.spec.ts')).toBe(true)
})

Expand Down
1 change: 1 addition & 0 deletions e2e/native-esm-js/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "ES2017",
"module": "ESNext",
"allowJs": true,
"checkJs": false,
"esModuleInterop": true,
Expand Down

0 comments on commit 724d2b0

Please sign in to comment.