Skip to content

Commit

Permalink
Merge branch 'master' into appveyor-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Sep 19, 2018
2 parents 76e2fe5 + 0f31b42 commit 45d44d1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -10,13 +10,13 @@
"build": "tsc -p tsconfig.build.json",
"build:watch": "tsc -p tsconfig.build.json -w",
"clean": "node scripts/clean.js",
"pretest": "run-p typecheck lint",
"pretest": "run-s typecheck lint",
"test": "run-s -s test:e2e \"test:unit -- {@}\" --",
"test:prepare": "npm run test:e2e -- --prepareOnly",
"test:e2e": "node scripts/e2e.js",
"test:unit": "jest",
"test:external": "node scripts/test-external-project.js",
"lint": "run-p lint:ts lint:js",
"lint": "run-s lint:ts lint:js",
"lint:js": "eslint . -f stylish",
"lint:ts": "tslint -t stylish --project .",
"lint:fix": "run-s lint:fix:ts lint:fix:js",
Expand Down
34 changes: 15 additions & 19 deletions src/config/config-set.spec.ts
Expand Up @@ -2,6 +2,7 @@ import { testing } from 'bs-logger'
import { resolve } from 'path'
import ts, { Diagnostic, ModuleKind, ScriptTarget } from 'typescript'

import { version as currentVersion } from '../../package.json'
import * as fakers from '../__helpers__/fakers'
import { mocked } from '../__helpers__/mocks'
import { TsJestGlobalOptions } from '../types'
Expand All @@ -20,6 +21,7 @@ backports.backportJestConfig.mockImplementation((_, config) => ({
}))

const defaultResolve = (path: string) => `resolved:${path}`
const pkgVersion = (pkgName: string) => require(`${pkgName}/package.json`).version || '????'

function createConfigSet({
jestConfig,
Expand Down Expand Up @@ -314,29 +316,23 @@ describe('readTsConfig', () => {
describe('versions', () => {
describe('without babel', () => {
it('should return correct version map', () => {
expect(createConfigSet().versions).toMatchInlineSnapshot(`
Object {
"jest": "23.6.0",
"ts-jest": "23.10.0-beta.6",
"tslib": "1.9.3",
"typescript": "3.0.3",
}
`)
expect(createConfigSet().versions).toEqual({
jest: pkgVersion('jest'),
'ts-jest': currentVersion,
typescript: pkgVersion('typescript'),
})
})
})
describe('with babel', () => {
it('should return correct version map', () => {
expect(createConfigSet({ tsJestConfig: { babelConfig: {} } }).versions).toMatchInlineSnapshot(`
Object {
"@babel/core": "-",
"babel-core": "6.26.3",
"babel-jest": "23.6.0",
"jest": "23.6.0",
"ts-jest": "23.10.0-beta.6",
"tslib": "1.9.3",
"typescript": "3.0.3",
}
`)
expect(createConfigSet({ tsJestConfig: { babelConfig: {} } }).versions).toEqual({
'@babel/core': '-',
'babel-core': pkgVersion('babel-core'),
'babel-jest': pkgVersion('babel-jest'),
jest: pkgVersion('jest'),
'ts-jest': currentVersion,
typescript: pkgVersion('typescript'),
})
})
})
}) // versions
Expand Down
2 changes: 1 addition & 1 deletion src/config/config-set.ts
Expand Up @@ -234,7 +234,7 @@ export class ConfigSet {

@Memoize()
get versions(): Record<string, string> {
const modules = ['jest', this.tsJest.compiler, 'tslib']
const modules = ['jest', this.tsJest.compiler]
if (this.tsJest.babelConfig) {
modules.push('@babel/core', 'babel-core', 'babel-jest')
}
Expand Down
1 change: 1 addition & 0 deletions tslint.json
Expand Up @@ -6,6 +6,7 @@
],
"linterOptions": {
"exclude": [
"package.json",
"dist/**/*",
"**/node_modules/**/*",
"e2e/__cases__/**/*"
Expand Down

0 comments on commit 45d44d1

Please sign in to comment.