Skip to content

Commit

Permalink
build(devs-infra): build package with target es2015 (#2130)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
`ts-jest` no longer ships with `es5` build but now with `es2015`
  • Loading branch information
ahnpnl authored Nov 11, 2020
1 parent 1e0b2ce commit 6bd101c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 30 deletions.
10 changes: 1 addition & 9 deletions src/__helpers__/fakers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { resolve } from 'path'

import { createCompilerInstance } from '../compiler/instance'
import { ConfigSet } from '../config/config-set'
import type { BabelConfig, TsCompiler, TsJestGlobalOptions } from '../types'
import type { TsCompiler, TsJestGlobalOptions } from '../types'
import type { ImportReasons } from '../utils/messages'

export function filePath(relPath: string): string {
Expand All @@ -28,14 +28,6 @@ function getJestConfig<T extends Config.ProjectConfig>(
return res
}

export function babelConfig<T extends BabelConfig>(options?: BabelConfig): T {
return {
...options,
presets: [...(options && options.presets)],
plugins: [...(options && options.plugins)],
} as any
}

export function importReason(text = '[[BECAUSE]]'): ImportReasons {
return text as any
}
Expand Down
12 changes: 6 additions & 6 deletions src/compiler/__snapshots__/language-service.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ Array [
exports[`Language service jsx option should compile tsx file for jsx preserve 1`] = `
===[ FILE: test-jsx.tsx ]=======================================================
"use strict";
var App = function () {
const App = () => {
return <>Test</>;
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxJQUFNLEdBQUcsR0FBRztJQUNWLE9BQU8sRUFBRSxJQUFJLEdBQUcsQ0FBQTtBQUNsQixDQUFDLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZXMiOlsidGVzdC1qc3gudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxNQUFNLEdBQUcsR0FBRyxHQUFHLEVBQUU7SUFDZixPQUFPLEVBQUUsSUFBSSxHQUFHLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbInRlc3QtanN4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJcbiAgICAgICAgY29uc3QgQXBwID0gKCkgPT4ge1xuICAgICAgICAgIHJldHVybiA8PlRlc3Q8Lz5cbiAgICAgICAgfVxuICAgICAgIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-jsx.tsx
mappings: ';AACQ,IAAM,GAAG,GAAG;IACV,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- test-jsx.tsx
Expand All @@ -157,13 +157,13 @@ exports[`Language service jsx option should compile tsx file for jsx preserve 1`
exports[`Language service jsx option should compile tsx file for other jsx options 1`] = `
===[ FILE: test-jsx.tsx ]=======================================================
"use strict";
var App = function () {
const App = () => {
return React.createElement(React.Fragment, null, "Test");
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxJQUFNLEdBQUcsR0FBRztJQUNWLE9BQU8saURBQVMsQ0FBQTtBQUNsQixDQUFDLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZXMiOlsidGVzdC1qc3gudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxNQUFNLEdBQUcsR0FBRyxHQUFHLEVBQUU7SUFDZixPQUFPLGlEQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbInRlc3QtanN4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJcbiAgICAgICAgY29uc3QgQXBwID0gKCkgPT4ge1xuICAgICAgICAgIHJldHVybiA8PlRlc3Q8Lz5cbiAgICAgICAgfVxuICAgICAgIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-jsx.tsx
mappings: ';AACQ,IAAM,GAAG,GAAG;IACV,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- test-jsx.tsx
Expand Down
12 changes: 6 additions & 6 deletions src/compiler/__snapshots__/transpiler.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ exports[`Transpiler diagnostics should report diagnostics related to codes with
exports[`Transpiler jsx option should compile tsx file for jsx preserve 1`] = `
===[ FILE: foo.tsx ]============================================================
"use strict";
var App = function () {
const App = () => {
return <>Test</>;
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsSUFBTSxHQUFHLEdBQUc7SUFDVixPQUFPLEVBQUUsSUFBSSxHQUFHLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbImZvby50c3giXSwic291cmNlc0NvbnRlbnQiOlsiXG4gICAgICAgIGNvbnN0IEFwcCA9ICgpID0+IHtcbiAgICAgICAgICByZXR1cm4gPD5UZXN0PC8+XG4gICAgICAgIH1cbiAgICAgICJdLCJ2ZXJzaW9uIjozfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsTUFBTSxHQUFHLEdBQUcsR0FBRyxFQUFFO0lBQ2YsT0FBTyxFQUFFLElBQUksR0FBRyxDQUFBO0FBQ2xCLENBQUMsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJmb28udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
===[ INLINE SOURCE MAPS ]=======================================================
file: foo.tsx
mappings: ';AACQ,IAAM,GAAG,GAAG;IACV,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- foo.tsx
Expand All @@ -31,13 +31,13 @@ exports[`Transpiler jsx option should compile tsx file for jsx preserve 1`] = `
exports[`Transpiler jsx option should compile tsx file for other jsx options 1`] = `
===[ FILE: foo.tsx ]============================================================
"use strict";
var App = function () {
const App = () => {
return React.createElement(React.Fragment, null, "Test");
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsSUFBTSxHQUFHLEdBQUc7SUFDVixPQUFPLGlEQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbImZvby50c3giXSwic291cmNlc0NvbnRlbnQiOlsiXG4gICAgICAgIGNvbnN0IEFwcCA9ICgpID0+IHtcbiAgICAgICAgICByZXR1cm4gPD5UZXN0PC8+XG4gICAgICAgIH1cbiAgICAgICJdLCJ2ZXJzaW9uIjozfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsTUFBTSxHQUFHLEdBQUcsR0FBRyxFQUFFO0lBQ2YsT0FBTyxpREFBUyxDQUFBO0FBQ2xCLENBQUMsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJmb28udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
===[ INLINE SOURCE MAPS ]=======================================================
file: foo.tsx
mappings: ';AACQ,IAAM,GAAG,GAAG;IACV,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- foo.tsx
Expand Down
4 changes: 1 addition & 3 deletions src/config/config-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ export class ConfigSet {
}
})
if (astTransformers.before) {
this.customTransformers = {
before: [...this.customTransformers.before, ...resolveTransformers(astTransformers.before)],
}
this.customTransformers.before?.push(...resolveTransformers(astTransformers.before))
}
if (astTransformers.after) {
this.customTransformers = {
Expand Down
9 changes: 3 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"target": "ES2015",
"module": "CommonJS",
"declaration": false,
"noEmit": true,
"downlevelIteration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"lib": [
"es2015",
"es2016.array.include"
],
"lib": ["esnext"],
"moduleResolution": "node",
"resolveJsonModule": true,
"noEmitOnError": true,
Expand Down

0 comments on commit 6bd101c

Please sign in to comment.