Skip to content

Commit f316352

Browse files
authored
refactor(devs-infra): shorten import paths (#3084)
1 parent bacd6af commit f316352

16 files changed

Lines changed: 33 additions & 28 deletions

e2e/__tests__/presets.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import path from 'path'
2+
3+
import execa from 'execa'
4+
15
import { json as runWithJson } from '../run-jest'
6+
import { tsJestBundle } from '../utils'
27

38
const DIR_NAME = 'presets'
49

10+
beforeAll(() => {
11+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
12+
cwd: path.join(__dirname, '..', DIR_NAME),
13+
})
14+
})
15+
516
test(`successfully runs the tests inside ${DIR_NAME}`, () => {
617
const { json } = runWithJson(DIR_NAME)
718

e2e/presets/__tests__/ts-jest-presets.spec.ts renamed to e2e/presets/__tests__/presets.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { JS_EXT_TO_TREAT_AS_ESM, TS_EXT_TO_TREAT_AS_ESM } from '../../../dist/constants'
2-
import * as presets from '../../../presets'
1+
import { JS_EXT_TO_TREAT_AS_ESM, TS_EXT_TO_TREAT_AS_ESM } from 'ts-jest'
2+
import presets from 'ts-jest/presets'
33

4-
const defaultPreset = require('../../../jest-preset')
4+
const defaultPreset = require('ts-jest/jest-preset')
55

66
test('presets', () => {
77
expect(defaultPreset).toEqual({
88
transform: {
99
'^.+\\.tsx?$': 'ts-jest',
1010
},
1111
})
12-
1312
expect(presets.defaultsESM).toEqual({
1413
extensionsToTreatAsEsm: [...TS_EXT_TO_TREAT_AS_ESM],
1514
transform: {

src/__helpers__/fakers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { resolve } from 'path'
33
import type { Config } from '@jest/types'
44
import type { Logger } from 'bs-logger'
55

6-
import { TsCompiler } from '../compiler/ts-compiler'
7-
import { ConfigSet } from '../config/config-set'
6+
import { TsCompiler } from '../compiler'
7+
import { ConfigSet } from '../config'
88
import type { StringMap, TsJestGlobalOptions } from '../types'
99
import type { ImportReasons } from '../utils/messages'
1010

src/__helpers__/mocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { testing } from 'bs-logger'
22

3-
import { rootLogger } from '../utils/logger'
3+
import { rootLogger } from '../utils'
44

55
export const logTargetMock = (): testing.LogTargetMock => (rootLogger as testing.LoggerMock).target
66

src/cli/cli.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as _fs from 'fs'
22
import { normalize, resolve } from 'path'
33

44
import { logTargetMock, mockObject, mockWriteStream } from '../__helpers__/mocks'
5-
import { mocked } from '../utils/testing'
5+
import { mocked } from '../utils'
66

77
import { processArgv } from '.'
88

src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LogContexts, Logger } from 'bs-logger'
22
import type { Arguments } from 'yargs'
33
import yargsParser from 'yargs-parser'
44

5-
import { rootLogger } from '../utils/logger'
5+
import { rootLogger } from '../utils'
66

77
const VALID_COMMANDS = ['help', 'config:migrate', 'config:init']
88

src/compiler/compiler-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { stringify } from '../utils/json'
1+
import { stringify } from '../utils'
22

33
/**
44
* Rely on TypeScript compiled output generation which contains this prefix to point to sourcemap location.

src/compiler/ts-compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {
2222
Diagnostic,
2323
} from 'typescript'
2424

25-
import type { ConfigSet } from '../config/config-set'
25+
import type { ConfigSet } from '../config'
2626
import { LINE_FEED, TS_TSX_REGEX } from '../constants'
2727
import type {
2828
DepGraphInfo,
@@ -32,7 +32,7 @@ import type {
3232
TsJestCompileOptions,
3333
TTypeScript,
3434
} from '../types'
35-
import { rootLogger } from '../utils/logger'
35+
import { rootLogger } from '../utils'
3636
import { Errors, interpolate } from '../utils/messages'
3737

3838
import { updateOutput } from './compiler-utils'

src/compiler/ts-jest-compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConfigSet } from '../config/config-set'
1+
import type { ConfigSet } from '../config'
22
import type { CompilerInstance, StringMap, TsJestCompileOptions } from '../types'
33

44
import { TsCompiler } from './ts-compiler'

src/config/config-set.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import ts from 'typescript'
88
import { createConfigSet } from '../__helpers__/fakers'
99
import { logTargetMock } from '../__helpers__/mocks'
1010
import type { AstTransformerDesc, TsJestGlobalOptions } from '../types'
11+
import { stringify, mocked } from '../utils'
1112
import * as _backports from '../utils/backports'
1213
import { getPackageVersion } from '../utils/get-package-version'
13-
import { stringify } from '../utils/json'
1414
import { normalizeSlashes } from '../utils/normalize-slashes'
1515
import { sha1 } from '../utils/sha1'
16-
import { mocked } from '../utils/testing'
1716

1817
import { ConfigSet, MY_DIGEST } from './config-set'
1918

0 commit comments

Comments
 (0)