From a2a4be20dbb1bb9c58df78505ed456767e739b41 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 09:36:55 +0200 Subject: [PATCH 1/7] fix(config): warn instead of forcing ESM interoperability --- .../__snapshots__/hoisting.test.ts.snap | 49 +++----- src/config/config-set.spec.ts | 71 ++++++++++- src/config/config-set.ts | 117 ++++++++++++------ src/util/messages.ts | 1 + 4 files changed, 167 insertions(+), 71 deletions(-) diff --git a/e2e/__tests__/__snapshots__/hoisting.test.ts.snap b/e2e/__tests__/__snapshots__/hoisting.test.ts.snap index 2b7777502b..f7b393bac8 100644 --- a/e2e/__tests__/__snapshots__/hoisting.test.ts.snap +++ b/e2e/__tests__/__snapshots__/hoisting.test.ts.snap @@ -3,12 +3,9 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "default": io 1`] = ` ===[ FILE: hello.spec.ts ]====================================================== "use strict"; - var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); jest.mock('./hello'); - var hello_1 = __importDefault(require("./hello")); + var hello_1 = require("./hello"); afterAll(function () { jest.unmock('./hello'); // this should go after @@ -25,11 +22,11 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "defaul expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiaGVsbG8uc3BlYy50cyIsIm1hcHBpbmdzIjoiOzs7OztBQVFBLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7QUFSckIsa0RBQTRCO0FBRTVCLFFBQVEsQ0FBQztJQUdQLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUM7SUFGdkIsdUJBQXVCO0lBQ3ZCLElBQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQztDQUVmLENBQUMsQ0FBQTtBQUlGLFFBQVEsQ0FBQyxPQUFPLEVBQUU7SU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AAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAEpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC names: [] sourceRoot: / sources: @@ -84,10 +81,7 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b "use strict"; jest.mock('./hello'); - var __importDefault = this && this.__importDefault || function (mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true });var hello_1 = __importDefault(require("./hello")); + Object.defineProperty(exports, "__esModule", { value: true });var hello_1 = require("./hello"); afterAll(function () { jest.unmock('./hello'); // this should go after @@ -106,10 +100,10 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7QUFRQSxLQUFLLElBQUwsQ0FBVSxTQUFWOzs7OzhEQVJBLElBQUEsVUFBQSxnQkFBQSxR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BQ0EsZUFBTyxHQUFQLEVBQVksYUFBWjtBQUNBLGVBQU8sUUFBQSxPQUFQLEVBQWMsY0FBZCxDQUE2QixNQUE3QjtBQUNBLGVBQU8sUUFBUSxLQUFSLENBQVAsRUFBdUIsSUFBdkIsQ0FBNEIsS0FBNUI7QUFFRCxLQVBEO0FBUUQsQ0FWRCIsIm5hbWVzIjpbXSwic291cmNlUm9vdCI6Ijxjd2Q+LyIsInNvdXJjZXMiOlsiaGVsbG8uc3BlYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgaGVsbG8gZnJvbSAnLi9oZWxsbyc7XG5cbmFmdGVyQWxsKCgpID0+IHtcbiAgLy8gdGhpcyBzaG91bGQgZ28gYWZ0ZXJcbiAgY29uc3QgenogPSAyMDtcbiAgamVzdC51bm1vY2soJy4vaGVsbG8nKTtcbn0pXG5cbmplc3QubW9jaygnLi9oZWxsbycpO1xuXG5kZXNjcmliZSgnaGVsbG8nLCAoKSA9PiB7XG4gIGNvbnN0IG9yaWdpbmFsID0gcmVxdWlyZS5yZXF1aXJlQWN0dWFsKCcuL2hlbGxvJykuZGVmYXVsdDtcbiAgaXQoJ3Nob3VsZCBoYXZlIGJlZW4gbW9ja2VkJywgKCkgPT4ge1xuICAgIGNvbnN0IG1zZyA9IGhlbGxvKCk7XG4gICAgZXhwZWN0KGhlbGxvKS5ub3QudG9CZShvcmlnaW5hbCk7XG4gICAgZXhwZWN0KG1zZykudG9CZVVuZGVmaW5lZCgpO1xuICAgIGV4cGVjdChoZWxsbykudG9IYXZlUHJvcGVydHkoJ21vY2snKTtcbiAgICBleHBlY3QocmVxdWlyZSgnZm9vJykpLnRvQmUoJ2JhcicpO1xuICAgIGplc3QubW9jaygnZm9vJywgKCkgPT4gJ2JhcicsIHsgdmlydHVhbDogdHJ1ZSB9KTtcbiAgfSk7XG59KTtcbiJdLCJ2ZXJzaW9uIjozfQ== ===[ INLINE SOURCE MAPS ]======================================================= mappings: >- - ;;AAQA,KAAK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AO,QAAQ,KAAR,CAAP,EAAuB,IAAvB,CAA4B,KAA5B;AAED,KAPD;AAQD,CAVD names: [] sourceRoot: / sources: @@ -164,18 +158,11 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b "use strict"; jest.mock('./hello'); - - var __importDefault = this && this.__importDefault || function (mod) { - return mod && mod.__esModule ? mod : { - "default": mod - }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - var hello_1 = __importDefault(require("./hello")); + var hello_1 = require("./hello"); afterAll(function () { jest.unmock('./hello'); // this should go after @@ -198,10 +185,10 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7QUFRQSxJQUFJLENBQUMsSUFBTCxDQUFVLFNBQVY7Ozs7Ozs7Ozs7OztBQVJBLElBQUEsT0FBQSxHQUFBLGVBQUEsQ0FBQSxPQUFBLENBQUEsU0FBQSxDQUFBLENBQUE7O0FBRUEsUUFBUSxDQUFDLFlBQUE7QUFHUCxFQUFBLElBQUksQ0FBQyxNQUFMLENBQVksU0FBWixFQUhPLENBQ1A7O0FBQ0EsTUFBTSxFQUFFLEdBQUcsRUFBWDtBQUVELENBSk8sQ0FBUjtBQVFBLFFBQVEsQ0FBQyxPQUFELEVBQVUsWUFBQTtBQUNoQixNQUFNLFFBQVEsR0FBRyxPQUFPLENBQUMsYUFBUixDQUFzQixTQUF0QixFQUFpQyxPQUFsRDs7QUFDQSxFQUFBLEVBQUUsQ0FBQyx5QkFBRCxFQUE0QixZQUFBO0FBTTVCLElBQUEsSUFBSSxDQUFDLElBQUwsQ0FBVSxLQUFWLEVBQWlCLFlBQUE7QUFBTSxhQUFBLEtBQUE7QUFBSyxLQUE1QixFQUE4QjtBQUFFLE1BQUEsT0FBTyxFQUFFO0FBQVgsS0FBOUI7QUFMQSxRQUFNLEdBQUcsR0FBRyxPQUFBLENBQUEsT0FBQSxF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CxDQUE2QixNQUE3QjtBQUNBLElBQUEsTUFBTSxDQUFDLE9BQU8sQ0FBQyxLQUFELENBQVIsQ0FBTixDQUF1QixJQUF2QixDQUE0QixLQUE1QjtBQUVELEdBUEMsQ0FBRjtBQVFELENBVk8sQ0FBUiIsIm5hbWVzIjpbXSwic291cmNlUm9vdCI6Ijxjd2Q+LyIsInNvdXJjZXMiOlsiaGVsbG8uc3BlYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgaGVsbG8gZnJvbSAnLi9oZWxsbyc7XG5cbmFmdGVyQWxsKCgpID0+IHtcbiAgLy8gdGhpcyBzaG91bGQgZ28gYWZ0ZXJcbiAgY29uc3QgenogPSAyMDtcbiAgamVzdC51bm1vY2soJy4vaGVsbG8nKTtcbn0pXG5cbmplc3QubW9jaygnLi9oZWxsbycpO1xuXG5kZXNjcmliZSgnaGVsbG8nLCAoKSA9PiB7XG4gIGNvbnN0IG9yaWdpbmFsID0gcmVxdWlyZS5yZXF1aXJlQWN0dWFsKCcuL2hlbGxvJykuZGVmYXVsdDtcbiAgaXQoJ3Nob3VsZCBoYXZlIGJlZW4gbW9ja2VkJywgKCkgPT4ge1xuICAgIGNvbnN0IG1zZyA9IGhlbGxvKCk7XG4gICAgZXhwZWN0KGhlbGxvKS5ub3QudG9CZShvcmlnaW5hbCk7XG4gICAgZXhwZWN0KG1zZykudG9CZVVuZGVmaW5lZCgpO1xuICAgIGV4cGVjdChoZWxsbykudG9IYXZlUHJvcGVydHkoJ21vY2snKTtcbiAgICBleHBlY3QocmVxdWlyZSgnZm9vJykpLnRvQmUoJ2JhcicpO1xuICAgIGplc3QubW9jaygnZm9vJywgKCkgPT4gJ2JhcicsIHsgdmlydHVhbDogdHJ1ZSB9KTtcbiAgfSk7XG59KTtcbiJdLCJ2ZXJzaW9uIjozfQ== ===[ INLINE SOURCE MAPS ]======================================================= mappings: >- - ;;AAQA,IAAI,CAAC,IAAL,CAAU,SAAV;;;;;;;;;;;;AARA,I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,IAAI,CAAC,IAAL,CAAU,KAAV,EAAiB,YAAA;AAAM,aAAA,KAAA;AAAK,KAA5B,EAA8B;AAAE,MAAA,OAAO,EAAE;AAAX,KAA9B;AALA,QAAM,GAAG,GAAG,OAAA,CAAA,OAAA,EAAZ;AACA,IAAA,MAAM,CAAC,OAAA,CAAA,OAAD,CAAN,CAAc,GAAd,CAAkB,IAAlB,CAAuB,QAAvB;AACA,IAAA,MAAM,CAAC,GAAD,CAAN,CAAY,aAAZ;AACA,IAAA,MAAM,CAAC,OAAA,CAAA,OAAD,CAAN,CAAc,cAAd,CAA6B,MAA7B;AACA,IAAA,MAAM,CAAC,OAAO,CAAC,KAAD,CAAR,CAAN,CAAuB,IAAvB,CAA4B,KAA5B;AAED,GAPC,CAAF;AAQD,CAVO,CAAR names: [] sourceRoot: / sources: @@ -254,12 +241,9 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-jest-22": io 1`] = ` ===[ FILE: hello.spec.ts ]====================================================== "use strict"; - var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); jest.mock('./hello'); - var hello_1 = __importDefault(require("./hello")); + var hello_1 = require("./hello"); afterAll(function () { jest.unmock('./hello'); // this should go after @@ -276,11 +260,11 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-j expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiaGVsbG8uc3BlYy50cyIsIm1hcHBpbmdzIjoiOzs7OztBQVFBLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7QUFSckIsa0RBQTRCO0FBRTVCLFFBQVEsQ0FBQztJQUdQLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUM7SUFGdkIsdUJBQXVCO0lBQ3ZCLElBQU0sRUFB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AAI,CAAC,SAAS,CAAC,CAAC;AARrB,iCAA4B;AAE5B,QAAQ,CAAC;IAGP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAEpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC names: [] sourceRoot: / sources: @@ -333,12 +317,9 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-j exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-typescript-2-7": io 1`] = ` ===[ FILE: hello.spec.ts ]====================================================== "use strict"; - var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - } Object.defineProperty(exports, "__esModule", { value: true }); jest.mock('./hello'); - var hello_1 = __importDefault(require("./hello")); + var hello_1 = require("./hello"); afterAll(function () { jest.unmock('./hello'); // this should go after @@ -355,11 +336,11 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-t expect(require('foo')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plc3QubW9jaygnLi9oZWxsbycpO1xuXG5kZXNjcmliZSgnaGVsbG8nLCAoKSA9PiB7XG4gIGNvbnN0IG9yaWdpbmFsID0gcmVxdWlyZS5yZXF1aXJlQWN0dWFsKCcuL2hlbGxvJykuZGVmYXVsdDtcbiAgaXQoJ3Nob3VsZCBoYXZlIGJlZW4gbW9ja2VkJywgKCkgPT4ge1xuICAgIGNvbnN0IG1zZyA9IGhlbGxvKCk7XG4gICAgZXhwZWN0KGhlbGxvKS5ub3QudG9CZShvcmlnaW5hbCk7XG4gICAgZXhwZWN0KG1zZykudG9CZVVuZGVmaW5lZCgpO1xuICAgIGV4cGVjdChoZWxsbykudG9IYXZlUHJvcGVydHkoJ21vY2snKTtcbiAgICBleHBlY3QocmVxdWlyZSgnZm9vJykpLnRvQmUoJ2JhcicpO1xuICAgIGplc3QubW9jaygnZm9vJywgKCkgPT4gJ2JhcicsIHsgdmlydHVhbDogdHJ1ZSB9KTtcbiAgfSk7XG59KTtcbiJdLCJ2ZXJzaW9uIjozfQ== ===[ INLINE SOURCE MAPS ]======================================================= file: hello.spec.ts mappings: >- - ;;;;;AAQA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AARrB,kDAA4B;AAE5B,QAAQ,CAAC;IAGP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,C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config/config-set.spec.ts +++ b/src/config/config-set.spec.ts @@ -4,7 +4,7 @@ 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 { logTargetMock, mocked } from '../__helpers__/mocks' import { TsJestGlobalOptions } from '../types' import * as _backports from '../util/backports' import { normalizeSlashes } from '../util/normalize-slashes' @@ -222,6 +222,35 @@ describe('tsJest', () => { }) // compiler }) // tsJest +describe('makeDiagnostic', () => { + const cs = createConfigSet() + it('should create diagnostic with defaults', () => { + expect(cs.makeDiagnostic(1234, 'foo is not bar')).toMatchInlineSnapshot(` +Object { + "category": 0, + "code": 1234, + "file": undefined, + "length": undefined, + "messageText": "foo is not bar", + "start": undefined, +} +`) + }) + it('should set category', () => { + expect(cs.makeDiagnostic(4321, 'foo might be bar', { category: ts.DiagnosticCategory.Error })) + .toMatchInlineSnapshot(` +Object { + "category": 1, + "code": 4321, + "file": undefined, + "length": undefined, + "messageText": "foo might be bar", + "start": undefined, +} +`) + }) +}) // makeDiagnostic + describe('typescript', () => { const get = (tsJest?: TsJestGlobalOptions, parentConfig?: TsJestGlobalOptions) => createConfigSet({ tsJestConfig: tsJest, parentConfig }).typescript @@ -258,6 +287,28 @@ describe('typescript', () => { skipLibCheck: true, }) }) + + it('should warn about possibly wrong module config and set synth. default imports', () => { + const target = logTargetMock() + target.clear() + const cs = createConfigSet({ + tsJestConfig: { + tsConfig: { module: 'ES6', esModuleInterop: false, allowSyntheticDefaultImports: false } as any, + diagnostics: { warnOnly: true, pretty: false }, + }, + resolve: null, + }) + expect(cs.typescript.options).toMatchObject({ + module: ModuleKind.CommonJS, + allowSyntheticDefaultImports: true, + esModuleInterop: false, + }) + expect(target.lines.warn.join()).toMatchInlineSnapshot(` +"[level:40] TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option): +warning TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information. +" +`) + }) }) // typescript describe('resolvePath', () => { @@ -269,6 +320,22 @@ describe('resolvePath', () => { expect(doResolve('bar.js')).toBe(resolve('/root/bar.js')) expect(doResolve('/bar.js')).toBe(resolve('/root//bar.js')) }) + it('should resolve node paths', () => { + const cs = createConfigSet({ jestConfig: { rootDir: '/root', cwd: '/cwd' } as any, resolve: null }) + const doResolve = (path: string) => cs.resolvePath(path, { throwIfMissing: false, nodeResolve: true }) + expect(doResolve('json5')).toBe(resolve(__dirname, '../../node_modules/json5', require('json5/package.json').main)) + expect(doResolve('./bar.js')).toBe(resolve('/cwd/bar.js')) + expect(doResolve('bar.js')).toBe(resolve('/root/bar.js')) + expect(doResolve('/bar.js')).toBe(resolve('/root//bar.js')) + }) + it('should throw for invalid paths', () => { + const cs = createConfigSet({ jestConfig: { rootDir: __dirname, cwd: __dirname } as any, resolve: null }) + const doResolve = (path: string) => cs.resolvePath(path) + expect(() => doResolve('bar.js')).toThrow() + expect(() => doResolve('./bar.js')).toThrow() + expect(() => doResolve('bar.js')).toThrow() + expect(() => doResolve('/bar.js')).toThrow() + }) }) // resolvePath describe('readTsConfig', () => { @@ -364,7 +431,7 @@ describe('shouldReportDiagnostic', () => { }) // shouldReportDiagnostic describe('tsCompiler', () => { - it('should a compiler object', () => { + it('should be a compiler object', () => { const cs = createConfigSet({ tsJestConfig: { tsConfig: false } as any }) const compiler = cs.tsCompiler expect(compiler.cwd).toBe(cs.cwd) diff --git a/src/config/config-set.ts b/src/config/config-set.ts index c8774d8f23..5d1541e37f 100644 --- a/src/config/config-set.ts +++ b/src/config/config-set.ts @@ -13,7 +13,15 @@ import { existsSync, readFileSync } from 'fs' import json5 from 'json5' import { dirname, isAbsolute, join, resolve } from 'path' import semver from 'semver' -import { CustomTransformers, Diagnostic, FormatDiagnosticsHost, ParsedCommandLine } from 'typescript' +import { + CompilerOptions, + CustomTransformers, + Diagnostic, + DiagnosticCategory, + FormatDiagnosticsHost, + ParsedCommandLine, + SourceFile, +} from 'typescript' import { version as myVersion } from '..' import { createCompiler } from '../compiler' @@ -57,32 +65,11 @@ export const IGNORE_DIAGNOSTIC_CODES = [ 18003, // "No inputs were found in config file." ] -const DEFAULT_COMPILER_OPTIONS = { - inlineSourceMap: true, - inlineSources: true, -} -const FORCE_COMPILER_OPTIONS = { - // we handle sourcemaps this way and not another - sourceMap: true, - inlineSourceMap: false, - inlineSources: true, - // we don't want to create declaration files - declaration: false, - noEmit: false, - outDir: '$$ts-jest$$', - // commonjs + module interop should be compatible with every other setup - module: 'commonjs', - esModuleInterop: true, - // else istanbul related will be dropped - removeComments: false, - // to clear out else it's buggy - out: undefined, - outFile: undefined, - composite: undefined, - declarationDir: undefined, - declarationMap: undefined, - emitDeclarationOnly: undefined, - sourceRoot: undefined, +// WARNING: DO NOT CHANGE THE ORDER OF CODE NAMES! +// ONLY APPEND IF YOU NEED TO ADD SOME +export enum DiagnosticCodes { + TsJest = 151000, + ConfigModuleOption, } const normalizeRegex = (pattern: string | RegExp | undefined): string | undefined => { @@ -448,6 +435,32 @@ export class ConfigSet { return res } + @Memoize() + get overriddenCompilerOptions(): Partial { + return { + // we handle sourcemaps this way and not another + sourceMap: true, + inlineSourceMap: false, + inlineSources: true, + // we don't want to create declaration files + declaration: false, + noEmit: false, + outDir: '$$ts-jest$$', + // commonjs is required for jest + module: this.compilerModule.ModuleKind.CommonJS, + // else istanbul related will be dropped + removeComments: false, + // to clear out else it's buggy + out: undefined, + outFile: undefined, + composite: undefined, + declarationDir: undefined, + declarationMap: undefined, + emitDeclarationOnly: undefined, + sourceRoot: undefined, + } + } + get rootDir(): string { return this.jest.rootDir || this.cwd } @@ -460,6 +473,22 @@ export class ConfigSet { return !!process.env.TS_JEST_DOCTOR } + makeDiagnostic( + code: number, + messageText: string, + options: { category?: DiagnosticCategory; file?: SourceFile; start?: number; length?: number } = {}, + ): Diagnostic { + const { category = this.compilerModule.DiagnosticCategory.Warning, file, start, length } = options + return { + code, + messageText, + category, + file, + start, + length, + } + } + readTsConfig( compilerOptions?: object, resolvedConfigFile?: string | null, @@ -504,23 +533,41 @@ export class ConfigSet { // Override default configuration options `ts-jest` requires. config.compilerOptions = { - ...DEFAULT_COMPILER_OPTIONS, ...config.compilerOptions, ...compilerOptions, - ...FORCE_COMPILER_OPTIONS, } + // parse json, merge config extending others, ... const result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName) + const { overriddenCompilerOptions: forcedOptions } = this + const finalOptions = result.options + // Target ES5 output by default (instead of ES3). - if (result.options.target === undefined) { - result.options.target = ts.ScriptTarget.ES5 + if (finalOptions.target === undefined) { + finalOptions.target = ts.ScriptTarget.ES5 + } + + // check the module interoperability + const target = finalOptions.target! + // compute the default if not set + const defaultModule = [ts.ScriptTarget.ES3, ts.ScriptTarget.ES5].includes(target) + ? ts.ModuleKind.CommonJS + : ts.ModuleKind.ESNext + const moduleValue = finalOptions.module == null ? defaultModule : finalOptions.module + if (moduleValue !== forcedOptions.module && !finalOptions.esModuleInterop) { + result.errors.push(this.makeDiagnostic(DiagnosticCodes.ConfigModuleOption, Errors.ConfigNoModuleInterop)) + // at least enable synthetic default imports + finalOptions.allowSyntheticDefaultImports = true } - // ensure undefined in FORCE_COMPILER_OPTIONS are removed - for (const key in FORCE_COMPILER_OPTIONS) { - if ((FORCE_COMPILER_OPTIONS as any)[key] === undefined) { - delete result.options[key] + // ensure undefined are removed and other values are overridden + for (const key of Object.keys(forcedOptions)) { + const val = forcedOptions[key] + if (val === undefined) { + delete finalOptions[key] + } else { + finalOptions[key] = val } } diff --git a/src/util/messages.ts b/src/util/messages.ts index b59d62eb09..53e183e9c4 100644 --- a/src/util/messages.ts +++ b/src/util/messages.ts @@ -15,6 +15,7 @@ export enum Errors { GotJsFileButAllowJsFalse = 'Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore', GotUnknownFileTypeWithoutBabel = 'Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.', GotUnknownFileTypeWithBabel = 'Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files.', + ConfigNoModuleInterop = 'If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.', } export enum Helps { From 0141098d2560cd7ab637c867f172470890041394 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 18:36:32 +0200 Subject: [PATCH 2/7] test(e2e): deep paths and coverage --- e2e/__cases__/deep/package.json | 5 + e2e/__cases__/deep/src/Button/click.ts | 5 + e2e/__cases__/deep/src/Button/mod.d.ts | 3 + e2e/__cases__/deep/src/Button/mod.js | 3 + .../deep/src/Tests/Button/click.test.ts | 5 + e2e/__cases__/deep/src/Tests/jest.config.js | 24 ++ e2e/__cases__/deep/src/Tests/tsconfig.json | 5 + e2e/__cases__/deep/src/tsconfig.base.json | 10 + .../deep/src/tsconfig.base.node.json | 10 + e2e/__cases__/deep/tsconfig.json | 5 + .../__snapshots__/deep-path.test.ts.snap | 271 ++++++++++++++++++ e2e/__tests__/deep-path.test.ts | 20 ++ 12 files changed, 366 insertions(+) create mode 100644 e2e/__cases__/deep/package.json create mode 100644 e2e/__cases__/deep/src/Button/click.ts create mode 100644 e2e/__cases__/deep/src/Button/mod.d.ts create mode 100644 e2e/__cases__/deep/src/Button/mod.js create mode 100644 e2e/__cases__/deep/src/Tests/Button/click.test.ts create mode 100755 e2e/__cases__/deep/src/Tests/jest.config.js create mode 100755 e2e/__cases__/deep/src/Tests/tsconfig.json create mode 100755 e2e/__cases__/deep/src/tsconfig.base.json create mode 100755 e2e/__cases__/deep/src/tsconfig.base.node.json create mode 100644 e2e/__cases__/deep/tsconfig.json create mode 100644 e2e/__tests__/__snapshots__/deep-path.test.ts.snap create mode 100644 e2e/__tests__/deep-path.test.ts diff --git a/e2e/__cases__/deep/package.json b/e2e/__cases__/deep/package.json new file mode 100644 index 0000000000..511064b15a --- /dev/null +++ b/e2e/__cases__/deep/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "test": "cd src/Tests && jest" + } +} diff --git a/e2e/__cases__/deep/src/Button/click.ts b/e2e/__cases__/deep/src/Button/click.ts new file mode 100644 index 0000000000..e6ac69b45f --- /dev/null +++ b/e2e/__cases__/deep/src/Button/click.ts @@ -0,0 +1,5 @@ +import * as mod from './mod' + +export function click(foo: string) { + return `clicked ${mod(foo)}` +} diff --git a/e2e/__cases__/deep/src/Button/mod.d.ts b/e2e/__cases__/deep/src/Button/mod.d.ts new file mode 100644 index 0000000000..af187fb420 --- /dev/null +++ b/e2e/__cases__/deep/src/Button/mod.d.ts @@ -0,0 +1,3 @@ +type ModExport = (str: string) => string +declare const _export: ModExport +export = _export diff --git a/e2e/__cases__/deep/src/Button/mod.js b/e2e/__cases__/deep/src/Button/mod.js new file mode 100644 index 0000000000..e6b53c197a --- /dev/null +++ b/e2e/__cases__/deep/src/Button/mod.js @@ -0,0 +1,3 @@ +module.exports = function(str) { + return str.toUpperCase() +} diff --git a/e2e/__cases__/deep/src/Tests/Button/click.test.ts b/e2e/__cases__/deep/src/Tests/Button/click.test.ts new file mode 100644 index 0000000000..a99d0e5599 --- /dev/null +++ b/e2e/__cases__/deep/src/Tests/Button/click.test.ts @@ -0,0 +1,5 @@ +import { click } from '../../Button/click' + +test('button should click!', () => { + expect(click('bar')).toBe('clicked BAR') +}) diff --git a/e2e/__cases__/deep/src/Tests/jest.config.js b/e2e/__cases__/deep/src/Tests/jest.config.js new file mode 100755 index 0000000000..3ad00da01c --- /dev/null +++ b/e2e/__cases__/deep/src/Tests/jest.config.js @@ -0,0 +1,24 @@ +const cfg = {} + +if (require('jest/package.json').version.split('.').shift() === '22') { + Object.assign(cfg, require('ts-jest').jestPreset) +} else { + cfg.preset = 'ts-jest' +} + +module.exports = Object.assign({}, cfg, { + collectCoverage: true, + collectCoverageFrom: ["**/*.ts", "!**/*.d.ts", "!**/build/**", "!/FrontEnd/**"], + forceCoverageMatch: ["**/*.test.ts"], + coverageDirectory: "Tests/coverage", + coverageReporters: ["lcov"], + rootDir: "..", + testMatch: ["**/*.test.ts"], + testEnvironment: "node", + globals: { + "ts-jest": { + tsConfig: "./tsconfig.json", + }, + }, + // testResultsProcessor: "jest-teamcity-reporter", +}) diff --git a/e2e/__cases__/deep/src/Tests/tsconfig.json b/e2e/__cases__/deep/src/Tests/tsconfig.json new file mode 100755 index 0000000000..d9567ce808 --- /dev/null +++ b/e2e/__cases__/deep/src/Tests/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../tsconfig.base.node.json", + "compilerOptions": { + } +} diff --git a/e2e/__cases__/deep/src/tsconfig.base.json b/e2e/__cases__/deep/src/tsconfig.base.json new file mode 100755 index 0000000000..41e9c8ac0e --- /dev/null +++ b/e2e/__cases__/deep/src/tsconfig.base.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "skipLibCheck": true, + "moduleResolution": "node", + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "strict": true + } +} diff --git a/e2e/__cases__/deep/src/tsconfig.base.node.json b/e2e/__cases__/deep/src/tsconfig.base.node.json new file mode 100755 index 0000000000..cfd6795637 --- /dev/null +++ b/e2e/__cases__/deep/src/tsconfig.base.node.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "target": "es2017", + "lib": [ + "es2017" + ] + } +} diff --git a/e2e/__cases__/deep/tsconfig.json b/e2e/__cases__/deep/tsconfig.json new file mode 100644 index 0000000000..2f98042715 --- /dev/null +++ b/e2e/__cases__/deep/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "esModuleInterop": true + } +} diff --git a/e2e/__tests__/__snapshots__/deep-path.test.ts.snap b/e2e/__tests__/__snapshots__/deep-path.test.ts.snap new file mode 100644 index 0000000000..aacd130d33 --- /dev/null +++ b/e2e/__tests__/__snapshots__/deep-path.test.ts.snap @@ -0,0 +1,271 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Deep paths test should pass using template "default": lcov 1`] = ` +"TN: +SF:/src/Button/click.ts +FN:3,click +FNF:1 +FNH:1 +FNDA:1,click +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/src/Tests/Button/click.test.ts +FN:3,(anonymous_0) +FNF:1 +FNH:1 +FNDA:1,(anonymous_0) +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +" +`; + +exports[`Deep paths test should pass using template "default": output 1`] = ` + √ npm -s run test + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + =============================== Coverage summary =============================== + Statements : 100% ( 6/6 ) + Branches : 100% ( 0/0 ) + Functions : 100% ( 2/2 ) + Lines : 100% ( 6/6 ) + ================================================================================ + ===[ STDERR ]=================================================================== + PASS Button/click.test.ts + √ button should click! + + Test Suites: 1 passed, 1 total + Tests: 1 passed, 1 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Deep paths test should pass using template "with-babel-6": lcov 1`] = ` +"TN: +SF:/src/Button/click.ts +FN:3,click +FNF:1 +FNH:1 +FNDA:1,click +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/src/Tests/Button/click.test.ts +FN:3,(anonymous_0) +FNF:1 +FNH:1 +FNDA:1,(anonymous_0) +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +" +`; + +exports[`Deep paths test should pass using template "with-babel-6": output 1`] = ` + √ npm -s run test + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + =============================== Coverage summary =============================== + Statements : 100% ( 6/6 ) + Branches : 100% ( 0/0 ) + Functions : 100% ( 2/2 ) + Lines : 100% ( 6/6 ) + ================================================================================ + ===[ STDERR ]=================================================================== + PASS Button/click.test.ts + √ button should click! + + Test Suites: 1 passed, 1 total + Tests: 1 passed, 1 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Deep paths test should pass using template "with-babel-7": lcov 1`] = ` +"TN: +SF:/src/Button/click.ts +FN:3,click +FNF:1 +FNH:1 +FNDA:1,click +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/src/Tests/Button/click.test.ts +FN:3,(anonymous_0) +FNF:1 +FNH:1 +FNDA:1,(anonymous_0) +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +" +`; + +exports[`Deep paths test should pass using template "with-babel-7": output 1`] = ` + √ npm -s run test + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + =============================== Coverage summary =============================== + Statements : 100% ( 6/6 ) + Branches : 100% ( 0/0 ) + Functions : 100% ( 2/2 ) + Lines : 100% ( 6/6 ) + ================================================================================ + ===[ STDERR ]=================================================================== + PASS Button/click.test.ts + √ button should click! + + Test Suites: 1 passed, 1 total + Tests: 1 passed, 1 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Deep paths test should pass using template "with-jest-22": lcov 1`] = ` +"TN: +SF:/src/Button/click.ts +FN:3,click +FNF:1 +FNH:1 +FNDA:1,click +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/src/Tests/Button/click.test.ts +FN:3,(anonymous_0) +FNF:1 +FNH:1 +FNDA:1,(anonymous_0) +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +" +`; + +exports[`Deep paths test should pass using template "with-jest-22": output 1`] = ` + √ npm -s run test + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + =============================== Coverage summary =============================== + Statements : 100% ( 6/6 ) + Branches : 100% ( 0/0 ) + Functions : 100% ( 2/2 ) + Lines : 100% ( 6/6 ) + ================================================================================ + ===[ STDERR ]=================================================================== + PASS Button/click.test.ts + √ button should click! + + Test Suites: 1 passed, 1 total + Tests: 1 passed, 1 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Deep paths test should pass using template "with-typescript-2-7": lcov 1`] = ` +"TN: +SF:/src/Button/click.ts +FN:3,click +FNF:1 +FNH:1 +FNDA:1,click +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/src/Tests/Button/click.test.ts +FN:3,(anonymous_0) +FNF:1 +FNH:1 +FNDA:1,(anonymous_0) +DA:1,1 +DA:3,1 +DA:4,1 +LF:3 +LH:3 +BRF:0 +BRH:0 +end_of_record +" +`; + +exports[`Deep paths test should pass using template "with-typescript-2-7": output 1`] = ` + √ npm -s run test + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + =============================== Coverage summary =============================== + Statements : 100% ( 6/6 ) + Branches : 100% ( 0/0 ) + Functions : 100% ( 2/2 ) + Lines : 100% ( 6/6 ) + ================================================================================ + ===[ STDERR ]=================================================================== + PASS Button/click.test.ts + √ button should click! + + Test Suites: 1 passed, 1 total + Tests: 1 passed, 1 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; diff --git a/e2e/__tests__/deep-path.test.ts b/e2e/__tests__/deep-path.test.ts new file mode 100644 index 0000000000..a13856ee1e --- /dev/null +++ b/e2e/__tests__/deep-path.test.ts @@ -0,0 +1,20 @@ +import { readFileSync } from 'fs' +import { join } from 'path' + +import { allValidPackageSets } from '../__helpers__/templates' +import { configureTestCase } from '../__helpers__/test-case' + +describe('Deep paths test', () => { + const testCase = configureTestCase('deep') + + testCase.runWithTemplates(allValidPackageSets, 0, (runTest, { testLabel }) => { + it(testLabel, () => { + const result = runTest() + expect(result.status).toBe(0) + expect(result).toMatchSnapshot('output') + let content: string = readFileSync(join(result.cwd, 'src', 'Tests', 'coverage', 'lcov.info'), 'utf8') + content = result.normalize(content) + expect(content).toMatchSnapshot('lcov') + }) + }) +}) From c12dfff8caa8943dd989a19945e1e04b2fba8a8d Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 18:52:29 +0200 Subject: [PATCH 3/7] fix(windows): normalize paths --- e2e/__helpers__/test-case/run-result.ts | 2 +- .../__snapshots__/hoisting.test.ts.snap | 31 ++++++++----------- .../__snapshots__/source-map.test.ts.snap | 31 ++++++++----------- e2e/__tests__/source-map.test.ts | 6 ++-- src/compiler.spec.ts | 19 ++++++------ src/compiler.ts | 13 +++++--- src/config/config-set.ts | 8 +++-- src/ts-jest-transformer.spec.ts | 7 +++-- 8 files changed, 57 insertions(+), 60 deletions(-) diff --git a/e2e/__helpers__/test-case/run-result.ts b/e2e/__helpers__/test-case/run-result.ts index f9ef239706..f37ec02a08 100644 --- a/e2e/__helpers__/test-case/run-result.ts +++ b/e2e/__helpers__/test-case/run-result.ts @@ -57,7 +57,7 @@ export default class RunResult { } get cmdLine() { return [this.context.cmd, ...this.context.args] - .filter(a => !['-u', '--updateSnapshot', '--runInBand'].includes(a)) + .filter(a => !['-u', '--updateSnapshot', '--runInBand', '--'].includes(a)) .join(' ') } diff --git a/e2e/__tests__/__snapshots__/hoisting.test.ts.snap b/e2e/__tests__/__snapshots__/hoisting.test.ts.snap index f7b393bac8..7c4099282b 100644 --- a/e2e/__tests__/__snapshots__/hoisting.test.ts.snap +++ b/e2e/__tests__/__snapshots__/hoisting.test.ts.snap @@ -22,15 +22,14 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "defaul expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiaGVsbG8uc3BlYy50cyIsIm1hcHBpbmdzIjoiOztBQVFBLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7QUFSckIsaUNBQTRCO0FBRTVCLFFBQVEsQ0FBQztJQUdQLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUM7SUFGdkIsdUJBQXVCO0lBQ3ZCLElBQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQztDQUVmLENBQUMsQ0FBQTtBQUlGLFFBQVEsQ0FBQyxPQUFPLEVBQUU7SUFDaEIsSUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDLGFBQWEsQ0FBQyxTQUFTLENBQUMsQ0FBQyxPQUFPLENBQUM7SUFDMUQsRUFBRSxDQUFDLHlCQUF5QixFQUFFO1FBTTVCLElBQUksQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLGNBQU0sT0FBQSxLQUFLLEVBQUwsQ0FBSyxFQUFFLEVBQUUsT0FBTyxFQUFFLElBQUksRUFBRSxDQUFDLENBQUM7UUFMakQsSUFBTSxHQUFHLEdBQUcsZUFBSyxFQUFFLENBQUM7UUFDcEIsTUFBTSxDQUFDLGVBQUssQ0FBQyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDakMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFDLGFBQWEsRUFBRSxDQUFDO1FBQzVCLE1BQU0sQ0FBQyxlQUFLLENBQUMsQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDckMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENB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yB0aGlzIHNob3VsZCBnbyBhZnRlclxuICBjb25zdCB6eiA9IDIwO1xuICBqZXN0LnVubW9jaygnLi9oZWxsbycpO1xufSlcblxuamVzdC5tb2NrKCcuL2hlbGxvJyk7XG5cbmRlc2NyaWJlKCdoZWxsbycsICgpID0+IHtcbiAgY29uc3Qgb3JpZ2luYWwgPSByZXF1aXJlLnJlcXVpcmVBY3R1YWwoJy4vaGVsbG8nKS5kZWZhdWx0O1xuICBpdCgnc2hvdWxkIGhhdmUgYmVlbiBtb2NrZWQnLCAoKSA9PiB7XG4gICAgY29uc3QgbXNnID0gaGVsbG8oKTtcbiAgICBleHBlY3QoaGVsbG8pLm5vdC50b0JlKG9yaWdpbmFsKTtcbiAgICBleHBlY3QobXNnKS50b0JlVW5kZWZpbmVkKCk7XG4gICAgZXhwZWN0KGhlbGxvKS50b0hhdmVQcm9wZXJ0eSgnbW9jaycpO1xuICAgIGV4cGVjdChyZXF1aXJlKCdmb28nKSkudG9CZSgnYmFyJyk7XG4gICAgamVzdC5tb2NrKCdmb28nLCAoKSA9PiAnYmFyJywgeyB2aXJ0dWFsOiB0cnVlIH0pO1xuICB9KTtcbn0pO1xuIl0sInZlcnNpb24iOjN9 ===[ INLINE SOURCE MAPS ]======================================================= - file: hello.spec.ts + file: /hello.spec.ts mappings: >- ;;AAQA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AARrB,iCAA4B;AAE5B,QAAQ,CAAC;IAGP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAEpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC names: [] - sourceRoot: / sources: - - hello.spec.ts + - /hello.spec.ts sourcesContent: - | import hello from './hello'; @@ -100,14 +99,13 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7QUFRQSxLQUFLLElBQUwsQ0FBVSxTQUFWOzhEQVJBLElBQUEsVUFBQSxRQUFBLFNBQUEsQ0FBQTtBQUVBLFNBQVMsWUFBQTtBQUdQLFNBQUssTUFBTCxDQUFZLFNBQVo7QUFGQTtBQUNBLFFBQU0sS0FBSyxFQUFYO0FBRUQsQ0FKRDtBQVFBLFNBQVMsT0FBVCxFQUFrQixZQUFBO0FBQ2hCLFFBQU0sV0FBVyxRQUFRLGFBQVIsQ0FBc0IsU0FBdEIsRUFBaUMsT0FBbEQ7QUFDQSxPQUFHLHlCQUFILEVBQThCLFlBQUE7QUFNNUIsYUFBSyxJQUFMLENBQVUsS0FBVixFQUFpQixZQUFBO0FBQU0sbUJBQUEsS0FBQTtBQUFLLFNBQTVCLEVBQThCLEVBQUUsU0FBUyxJQUFYLEVBQTlCO0FBTEEsWUFBTSxNQUFNLFFBQUEsT0FBQSxFQUFaO0FBQ0EsZUFBTyxRQUFBLE9BQVAsRUFBY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O,QAAQ,KAAR,CAAP,EAAuB,IAAvB,CAA4B,KAA5B;AAED,KAPD;AAQD,CAVD names: [] - sourceRoot: / sources: - - hello.spec.ts + - /hello.spec.ts sourcesContent: - | import hello from './hello'; @@ -185,14 +183,13 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-b expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7QUFRQSxJQUFJLENBQUMsSUFBTCxDQUFVLFNBQVY7Ozs7O0FBUkEsSUFBQSxPQUFBLEdBQUEsT0FBQSxDQUFBLFNBQUEsQ0FBQTs7QUFFQSxRQUFRLENBQUMsWUFBQTtBQUdQLEVBQUEsSUFBSSxDQUFDLE1BQUwsQ0FBWSxTQUFaLEVBSE8sQ0FDUDs7QUFDQSxNQUFNLEVBQUUsR0FBRyxFQUFYO0FBRUQsQ0FKTyxDQUFSO0FBUUEsUUFBUSxDQUFDLE9BQUQsRUFBVSxZQUFBO0FBQ2hCLE1BQU0sUUFBUSxHQUFHLE9BQU8sQ0FBQyxhQUFSLENBQXNCLFNBQXRCLEVBQWlDLE9BQWxEOztBQUNBLEVBQUEsRUFBRSxDQUFDLHlCQUFELEVBQTRCLFlBQUE7QUFNNUIsSUFBQSxJQUFJLENBQUMsSUFBTCxDQUFVLEtBQVYsRUFBaUIsWUFBQTtBQUFNLGFBQUEsS0FBQTtBQUFLLEtBQTVCLEVBQThCO0FBQUUsTUFBQSxPQUFPLEVBQUU7QUFBWCxLQUE5QjtBQUxBLFFBQU0sR0FBRyxHQUFHLE9BQUEsQ0FBQSxPQUFBLEVBQVo7QUFDQSxJQUFBLE1BQU0sQ0FBQyxPQUFBLENBQUEsT0FBRCxDQUFOLENBQWMsR0FBZCxDQUFrQixJQUFsQixDQUF1QixRQUF2QjtBQUNBLElBQUEsTUFBTSxDQUFDLEdBQUQsQ0FBTixDQUFZLGFBQVo7QUFDQSxJQUFBLE1BQU0sQ0FBQyxPQ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zIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBoZWxsbyBmcm9tICcuL2hlbGxvJztcblxuYWZ0ZXJBbGwoKCkgPT4ge1xuICAvLyB0aGlzIHNob3VsZCBnbyBhZnRlclxuICBjb25zdCB6eiA9IDIwO1xuICBqZXN0LnVubW9jaygnLi9oZWxsbycpO1xufSlcblxuamVzdC5tb2NrKCcuL2hlbGxvJyk7XG5cbmRlc2NyaWJlKCdoZWxsbycsICgpID0+IHtcbiAgY29uc3Qgb3JpZ2luYWwgPSByZXF1aXJlLnJlcXVpcmVBY3R1YWwoJy4vaGVsbG8nKS5kZWZhdWx0O1xuICBpdCgnc2hvdWxkIGhhdmUgYmVlbiBtb2NrZWQnLCAoKSA9PiB7XG4gICAgY29uc3QgbXNnID0gaGVsbG8oKTtcbiAgICBleHBlY3QoaGVsbG8pLm5vdC50b0JlKG9yaWdpbmFsKTtcbiAgICBleHBlY3QobXNnKS50b0JlVW5kZWZpbmVkKCk7XG4gICAgZXhwZWN0KGhlbGxvKS50b0hhdmVQcm9wZXJ0eSgnbW9jaycpO1xuICAgIGV4cGVjdChyZXF1aXJlKCdmb28nKSkudG9CZSgnYmFyJyk7XG4gICAgamVzdC5tb2NrKCdmb28nLCAoKSA9PiAnYmFyJywgeyB2aXJ0dWFsOiB0cnVlIH0pO1xuICB9KTtcbn0pO1xuIl0sInZlcnNpb24iOjN9 ===[ INLINE SOURCE MAPS ]======================================================= mappings: >- ;;AAQA,IAAI,CAAC,IAAL,CAAU,SAAV;;;;;AARA,IAAA,OAAA,GAAA,OAAA,CAAA,SAAA,CAAA;;AAEA,QAAQ,CAAC,YAAA;AAGP,EAAA,IAAI,CAAC,MAAL,CAAY,SAAZ,EAHO,CACP;;AACA,MAAM,EAAE,GAAG,EAAX;AAED,CAJO,CAAR;AAQA,QAAQ,CAAC,OAAD,EAAU,YAAA;AAChB,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAR,CAAsB,SAAtB,EAAiC,OAAlD;;AACA,EAAA,EAAE,CAAC,yBAAD,EAA4B,YAAA;AAM5B,IAAA,IAAI,CAAC,IAAL,CAAU,KAAV,EAAiB,YAAA;AAAM,aAAA,KAAA;AAAK,KAA5B,EAA8B;AAAE,MAAA,OAAO,EAAE;AAAX,KAA9B;AALA,QAAM,GAAG,GAAG,OAAA,CAAA,OAAA,EAAZ;AACA,IAAA,MAAM,CAAC,OAAA,CAAA,OAAD,CAAN,CAAc,GAAd,CAAkB,IAAlB,CAAuB,QAAvB;AACA,IAAA,MAAM,CAAC,GAAD,CAAN,CAAY,aAAZ;AACA,IAAA,MAAM,CAAC,OAAA,CAAA,OAAD,CAAN,CAAc,cAAd,CAA6B,MAA7B;AACA,IAAA,MAAM,CAAC,OAAO,CAAC,KAAD,CAAR,CAAN,CAAuB,IAAvB,CAA4B,KAA5B;AAED,GAPC,CAAF;AAQD,CAVO,CAAR names: [] - sourceRoot: / sources: - - hello.spec.ts + - /hello.spec.ts sourcesContent: - | import hello from './hello'; @@ -260,15 +257,14 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-j expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiaGVsbG8uc3BlYy50cyIsIm1hcHBpbmdzIjoiOztBQVFBLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7QUFSckIsaUNBQTRCO0FBRTVCLFFBQVEsQ0FBQztJQUdQLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUM7SUFGdkIsdUJBQXVCO0lBQ3ZCLElBQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQztDQUVmLENBQUMsQ0FBQTtBQUlGLFFBQVEsQ0FBQyxPQUFPLEVBQUU7SUFDaEIsSUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDLGFBQWEsQ0FBQyxTQUFTLENBQUMsQ0FBQyxPQUFPLENBQUM7SUFDMUQsRUFBRSxDQUFDLHlCQUF5Q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0cnVlIH0pO1xuICB9KTtcbn0pO1xuIl0sInZlcnNpb24iOjN9 ===[ INLINE SOURCE MAPS ]======================================================= - file: hello.spec.ts + file: /hello.spec.ts mappings: >- ;;AAQA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AARrB,iCAA4B;AAE5B,QAAQ,CAAC;IAGP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAEpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC names: [] - sourceRoot: / sources: - - hello.spec.ts + - /hello.spec.ts sourcesContent: - | import hello from './hello'; @@ -336,15 +332,14 @@ exports[`Hoisting jest.mock() & jest.unmock() should pass using template "with-t expect(require('foo')).toBe('bar'); }); }); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiaGVsbG8uc3BlYy50cyIsIm1hcHBpbmdzIjoiOztBQVFBLElBQUksQ0FBQyxJQUFJL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0O1xuICBpdCgnc2hvdWxkIGhhdmUgYmVlbiBtb2NrZWQnLCAoKSA9PiB7XG4gICAgY29uc3QgbXNnID0gaGVsbG8oKTtcbiAgICBleHBlY3QoaGVsbG8pLm5vdC50b0JlKG9yaWdpbmFsKTtcbiAgICBleHBlY3QobXNnKS50b0JlVW5kZWZpbmVkKCk7XG4gICAgZXhwZWN0KGhlbGxvKS50b0hhdmVQcm9wZXJ0eSgnbW9jaycpO1xuICAgIGV4cGVjdChyZXF1aXJlKCdmb28nKSkudG9CZSgnYmFyJyk7XG4gICAgamVzdC5tb2NrKCdmb28nLCAoKSA9PiAnYmFyJywgeyB2aXJ0dWFsOiB0cnVlIH0pO1xuICB9KTtcbn0pO1xuIl0sInZlcnNpb24iOjN9 ===[ INLINE SOURCE MAPS ]======================================================= - file: hello.spec.ts + file: /hello.spec.ts mappings: >- ;;AAQA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AARrB,iCAA4B;AAE5B,QAAQ,CAAC;IAGP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAFvB,uBAAuB;IACvB,IAAM,EAAE,GAAG,EAAE,CAAC;CAEf,CAAC,CAAA;AAIF,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAC1D,EAAE,CAAC,yBAAyB,EAAE;QAM5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QALjD,IAAM,GAAG,GAAG,eAAK,EAAE,CAAC;QACpB,MAAM,CAAC,eAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAEpC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC names: [] - sourceRoot: / sources: - - hello.spec.ts + - /hello.spec.ts sourcesContent: - | import hello from './hello'; diff --git a/e2e/__tests__/__snapshots__/source-map.test.ts.snap b/e2e/__tests__/__snapshots__/source-map.test.ts.snap index 756be98a6f..d599ee72ce 100644 --- a/e2e/__tests__/__snapshots__/source-map.test.ts.snap +++ b/e2e/__tests__/__snapshots__/source-map.test.ts.snap @@ -12,15 +12,14 @@ exports[`using template "default" should have the source maps comment 1`] = ` throw new Error('WITHIN SOURCE'); } exports.throwError = throwError; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoibWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBLFNBQWdCLFVBQVU7SUFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRCxTQUFnQixVQUFVO0lBQ3hCLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiPGN3ZD4vIiwic291cmNlcyI6WyJtYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBjb25zb2xlTG9nKCkge1xuICBjb25zb2xlLmxvZygnV0lUSElOIFNPVVJDRScpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0aHJvd0Vycm9yKCkge1xuICB0aHJvdyBuZXcgRXJyb3IoJ1dJVEhJTiBTT1VSQ0UnKVxufVxuIl0sInZlcnNpb24iOjN9 + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiPGN3ZD4vbWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBLFNBQWdCLFVBQVU7SUFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRCxTQUFnQixVQUFVO0lBQ3hCLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIjxjd2Q+L21haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNvbnNvbGVMb2coKSB7XG4gIGNvbnNvbGUubG9nKCdXSVRISU4gU09VUkNFJylcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHRocm93RXJyb3IoKSB7XG4gIHRocm93IG5ldyBFcnJvcignV0lUSElOIFNPVVJDRScpXG59XG4iXSwidmVyc2lvbiI6M30= ===[ INLINE SOURCE MAPS ]======================================================= - file: main.ts + file: /main.ts mappings: >- ;;AAAA,SAAgB,UAAU;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9B,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU;IACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC names: [] - sourceRoot: / sources: - - main.ts + - /main.ts sourcesContent: - | export function consoleLog() { @@ -101,14 +100,13 @@ exports[`using template "with-babel-6" should have the source maps comment 1`] = throw new Error('WITHIN SOURCE'); } exports.throwError = throwError; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7O0FBQUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsWUFBUSxHQUFSLENBQVksZUFBWjtBQUNEO0FBRkQsUUFBQSxVQUFBLEdBQUEsVUFBQTtBQUlBLFNBQWdCLFVBQWhCLEdBQTBCO0FBQ3hCLFVBQU0sSUFBSSxLQUFKLENBQVUsZUFBVixDQUFOO0FBQ0Q7QUFGRCxRQUFBLFVBQUEsR0FBQSxVQUFBIiwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiPGN3ZD4vIiwic291cmNlcyI6WyJtYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBjb25zb2xlTG9nKCkge1xuICBjb25zb2xlLmxvZygnV0lUSElOIFNPVVJDRScpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0aHJvd0Vycm9yKCkge1xuICB0aHJvdyBuZXcgRXJyb3IoJ1dJVEhJTiBTT1VSQ0UnKVxufVxuIl0sInZlcnNpb24iOjN9 + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7O0FBQUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsWUFBUSxHQUFSLENBQVksZUFBWjtBQUNEO0FBRkQsUUFBQSxVQUFBLEdBQUEsVUFBQTtBQUlBLFNBQWdCLFVBQWhCLEdBQTBCO0FBQ3hCLFVBQU0sSUFBSSxLQUFKLENBQVUsZUFBVixDQUFOO0FBQ0Q7QUFGRCxRQUFBLFVBQUEsR0FBQSxVQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIjxjd2Q+L21haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNvbnNvbGVMb2coKSB7XG4gIGNvbnNvbGUubG9nKCdXSVRISU4gU09VUkNFJylcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHRocm93RXJyb3IoKSB7XG4gIHRocm93IG5ldyBFcnJvcignV0lUSElOIFNPVVJDRScpXG59XG4iXSwidmVyc2lvbiI6M30= ===[ INLINE SOURCE MAPS ]======================================================= mappings: >- ;;;AAAA,SAAgB,UAAhB,GAA0B;AACxB,YAAQ,GAAR,CAAY,eAAZ;AACD;AAFD,QAAA,UAAA,GAAA,UAAA;AAIA,SAAgB,UAAhB,GAA0B;AACxB,UAAM,IAAI,KAAJ,CAAU,eAAV,CAAN;AACD;AAFD,QAAA,UAAA,GAAA,UAAA names: [] - sourceRoot: / sources: - - main.ts + - /main.ts sourcesContent: - | export function consoleLog() { @@ -195,14 +193,13 @@ exports[`using template "with-babel-7" should have the source maps comment 1`] = } exports.throwError = throwError; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsRUFBQSxPQUFPLENBQUMsR0FBUixDQUFZLGVBQVo7QUFDRDs7QUFGRCxPQUFBLENBQUEsVUFBQSxHQUFBLFVBQUE7O0FBSUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsUUFBTSxJQUFJLEtBQUosQ0FBVSxlQUFWLENBQU47QUFDRDs7QUFGRCxPQUFBLENBQUEsVUFBQSxHQUFBLFVBQUEiLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiI8Y3dkPi8iLCJzb3VyY2VzIjpbIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNvbnNvbGVMb2coKSB7XG4gIGNvbnNvbGUubG9nKCdXSVRISU4gU09VUkNFJylcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHRocm93RXJyb3IoKSB7XG4gIHRocm93IG5ldyBFcnJvcignV0lUSElOIFNPVVJDRScpXG59XG4iXSwidmVyc2lvbiI6M30= + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsRUFBQSxPQUFPLENBQUMsR0FBUixDQUFZLGVBQVo7QUFDRDs7QUFGRCxPQUFBLENBQUEsVUFBQSxHQUFBLFVBQUE7O0FBSUEsU0FBZ0IsVUFBaEIsR0FBMEI7QUFDeEIsUUFBTSxJQUFJLEtBQUosQ0FBVSxlQUFWLENBQU47QUFDRDs7QUFGRCxPQUFBLENBQUEsVUFBQSxHQUFBLFVBQUEiLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiPGN3ZD4vbWFpbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gY29uc29sZUxvZygpIHtcbiAgY29uc29sZS5sb2coJ1dJVEhJTiBTT1VSQ0UnKVxufVxuXG5leHBvcnQgZnVuY3Rpb24gdGhyb3dFcnJvcigpIHtcbiAgdGhyb3cgbmV3IEVycm9yKCdXSVRISU4gU09VUkNFJylcbn1cbiJdLCJ2ZXJzaW9uIjozfQ== ===[ INLINE SOURCE MAPS ]======================================================= mappings: >- ;;;;;;AAAA,SAAgB,UAAhB,GAA0B;AACxB,EAAA,OAAO,CAAC,GAAR,CAAY,eAAZ;AACD;;AAFD,OAAA,CAAA,UAAA,GAAA,UAAA;;AAIA,SAAgB,UAAhB,GAA0B;AACxB,QAAM,IAAI,KAAJ,CAAU,eAAV,CAAN;AACD;;AAFD,OAAA,CAAA,UAAA,GAAA,UAAA names: [] - sourceRoot: / sources: - - main.ts + - /main.ts sourcesContent: - | export function consoleLog() { @@ -282,15 +279,14 @@ exports[`using template "with-jest-22" should have the source maps comment 1`] = throw new Error('WITHIN SOURCE'); } exports.throwError = throwError; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoibWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBLFNBQWdCLFVBQVU7SUFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRCxTQUFnQixVQUFVO0lBQ3hCLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiPGN3ZD4vIiwic291cmNlcyI6WyJtYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBjb25zb2xlTG9nKCkge1xuICBjb25zb2xlLmxvZygnV0lUSElOIFNPVVJDRScpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0aHJvd0Vycm9yKCkge1xuICB0aHJvdyBuZXcgRXJyb3IoJ1dJVEhJTiBTT1VSQ0UnKVxufVxuIl0sInZlcnNpb24iOjN9 + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiPGN3ZD4vbWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBLFNBQWdCLFVBQVU7SUFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRCxTQUFnQixVQUFVO0lBQ3hCLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIjxjd2Q+L21haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNvbnNvbGVMb2coKSB7XG4gIGNvbnNvbGUubG9nKCdXSVRISU4gU09VUkNFJylcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHRocm93RXJyb3IoKSB7XG4gIHRocm93IG5ldyBFcnJvcignV0lUSElOIFNPVVJDRScpXG59XG4iXSwidmVyc2lvbiI6M30= ===[ INLINE SOURCE MAPS ]======================================================= - file: main.ts + file: /main.ts mappings: >- ;;AAAA,SAAgB,UAAU;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9B,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU;IACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC names: [] - sourceRoot: / sources: - - main.ts + - /main.ts sourcesContent: - | export function consoleLog() { @@ -368,15 +364,14 @@ exports[`using template "with-typescript-2-7" should have the source maps commen throw new Error('WITHIN SOURCE'); } exports.throwError = throwError; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoibWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBO0lBQ0UsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRDtJQUNFLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiPGN3ZD4vIiwic291cmNlcyI6WyJtYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBjb25zb2xlTG9nKCkge1xuICBjb25zb2xlLmxvZygnV0lUSElOIFNPVVJDRScpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0aHJvd0Vycm9yKCkge1xuICB0aHJvdyBuZXcgRXJyb3IoJ1dJVEhJTiBTT1VSQ0UnKVxufVxuIl0sInZlcnNpb24iOjN9 + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiPGN3ZD4vbWFpbi50cyIsIm1hcHBpbmdzIjoiOztBQUFBO0lBQ0UsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUM5QixDQUFDO0FBRkQsZ0NBRUM7QUFFRDtJQUNFLE1BQU0sSUFBSSxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQztBQUZELGdDQUVDIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIjxjd2Q+L21haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNvbnNvbGVMb2coKSB7XG4gIGNvbnNvbGUubG9nKCdXSVRISU4gU09VUkNFJylcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHRocm93RXJyb3IoKSB7XG4gIHRocm93IG5ldyBFcnJvcignV0lUSElOIFNPVVJDRScpXG59XG4iXSwidmVyc2lvbiI6M30= ===[ INLINE SOURCE MAPS ]======================================================= - file: main.ts + file: /main.ts mappings: >- ;;AAAA;IACE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9B,CAAC;AAFD,gCAEC;AAED;IACE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC names: [] - sourceRoot: / sources: - - main.ts + - /main.ts sourcesContent: - | export function consoleLog() { diff --git a/e2e/__tests__/source-map.test.ts b/e2e/__tests__/source-map.test.ts index a56e71d939..9b5ec1fc4b 100644 --- a/e2e/__tests__/source-map.test.ts +++ b/e2e/__tests__/source-map.test.ts @@ -1,3 +1,5 @@ +import { join } from 'path' + import { allValidPackageSets } from '../__helpers__/templates' import { configureTestCase } from '../__helpers__/test-case' @@ -20,12 +22,12 @@ testCase.runWithTemplates(allValidPackageSets, 1, (runTest, { templateName }) => // and the debugger cannot find the line where to go it(`should have the source maps comment`, () => { const io = result.ioFor('main.ts') + const filePath = join(result.cwd, 'main.ts') expect(io).toMatchSnapshot() // we could keep only the snapshot testing, but this ensure fixed stuff are the same over versions expect(io.outputSourceMaps).toMatchObject({ names: [], - sourceRoot: result.cwd, - sources: ['main.ts'], + sources: [filePath], sourcesContent: [io.inputCode], version: 3, }) diff --git a/src/compiler.spec.ts b/src/compiler.spec.ts index 7eef54a0bb..6603bcb703 100644 --- a/src/compiler.spec.ts +++ b/src/compiler.spec.ts @@ -3,7 +3,7 @@ import { LogLevels } from 'bs-logger' import * as fakers from './__helpers__/fakers' import { logTargetMock } from './__helpers__/mocks' -import { relativeToRoot, tempDir } from './__helpers__/path' +import { tempDir } from './__helpers__/path' import ProcessedSource from './__helpers__/processed-source' import { createCompiler } from './compiler' import { ConfigSet } from './config/config-set' @@ -60,7 +60,8 @@ describe('source-maps', () => { const source = 'const f = (v: number) => v\nconst t: number = f(5)' const compiled = compiler.compile(source, __filename) const processed = new ProcessedSource(compiled, __filename) - const expectedFileName = relativeToRoot(__filename) + // const expectedFileName = relativeToRoot(__filename) + const expectedFileName = __filename expect(processed.outputSourceMaps).toMatchObject({ file: expectedFileName, sources: [expectedFileName], @@ -108,14 +109,13 @@ Array [ ===[ FILE: src/compiler.spec.ts ]=============================================== "use strict"; console.log("hello"); - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoic3JjL2NvbXBpbGVyLnNwZWMudHMiLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiI8Y3dkPi8iLCJzb3VyY2VzIjpbInNyYy9jb21waWxlci5zcGVjLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImNvbnNvbGUubG9nKFwiaGVsbG9cIikiXSwidmVyc2lvbiI6M30= + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiPGN3ZD4vc3JjL2NvbXBpbGVyLnNwZWMudHMiLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiPGN3ZD4vc3JjL2NvbXBpbGVyLnNwZWMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiY29uc29sZS5sb2coXCJoZWxsb1wiKSJdLCJ2ZXJzaW9uIjozfQ== ===[ INLINE SOURCE MAPS ]======================================================= - file: src/compiler.spec.ts + file: /src/compiler.spec.ts mappings: ';AAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA' names: [] - sourceRoot: / sources: - - src/compiler.spec.ts + - /src/compiler.spec.ts sourcesContent: - console.log("hello") version: 3 @@ -138,14 +138,13 @@ describe('isolatedModules', () => { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = 42; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoic3JjL2NvbXBpbGVyLnNwZWMudHMiLCJtYXBwaW5ncyI6Ijs7QUFBQSxrQkFBZSxFQUFFLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiI8Y3dkPi8iLCJzb3VyY2VzIjpbInNyYy9jb21waWxlci5zcGVjLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IDQyIl0sInZlcnNpb24iOjN9 + //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiPGN3ZD4vc3JjL2NvbXBpbGVyLnNwZWMudHMiLCJtYXBwaW5ncyI6Ijs7QUFBQSxrQkFBZSxFQUFFLENBQUEiLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiPGN3ZD4vc3JjL2NvbXBpbGVyLnNwZWMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgNDIiXSwidmVyc2lvbiI6M30= ===[ INLINE SOURCE MAPS ]======================================================= - file: src/compiler.spec.ts + file: /src/compiler.spec.ts mappings: ';;AAAA,kBAAe,EAAE,CAAA' names: [] - sourceRoot: / sources: - - src/compiler.spec.ts + - /src/compiler.spec.ts sourcesContent: - export default 42 version: 3 diff --git a/src/compiler.ts b/src/compiler.ts index 15f8ac668b..b623292779 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -300,12 +300,15 @@ function updateOutput( /** * Update the source map contents for improved output. */ -function updateSourceMap(sourceMapText: string, fileName: string, sourceRoot: string) { +function updateSourceMap(sourceMapText: string, fileName: string, _sourceRoot: string) { const sourceMap = JSON.parse(sourceMapText) - const relativeFilePath = relative(sourceRoot, fileName) - sourceMap.file = relativeFilePath - sourceMap.sources = [relativeFilePath] - sourceMap.sourceRoot = sourceRoot + // const relativeFilePath = posix.normalize(relative(sourceRoot, fileName)) + // sourceMap.file = relativeFilePath + // sourceMap.sources = [relativeFilePath] + // sourceMap.sourceRoot = normalize(sourceRoot) + sourceMap.file = fileName + sourceMap.sources = [fileName] + delete sourceMap.sourceRoot return stableStringify(sourceMap) } diff --git a/src/config/config-set.ts b/src/config/config-set.ts index 5d1541e37f..dbbad96797 100644 --- a/src/config/config-set.ts +++ b/src/config/config-set.ts @@ -11,7 +11,7 @@ import { LogContexts, Logger } from 'bs-logger' import { existsSync, readFileSync } from 'fs' import json5 from 'json5' -import { dirname, isAbsolute, join, resolve } from 'path' +import { dirname, isAbsolute, join, normalize, resolve } from 'path' import semver from 'semver' import { CompilerOptions, @@ -461,12 +461,14 @@ export class ConfigSet { } } + @Memoize() get rootDir(): string { - return this.jest.rootDir || this.cwd + return normalize(this.jest.rootDir || this.cwd) } + @Memoize() get cwd(): string { - return this.jest.cwd || process.cwd() + return normalize(this.jest.cwd || process.cwd()) } get isDoctoring() { diff --git a/src/ts-jest-transformer.spec.ts b/src/ts-jest-transformer.spec.ts index e9244ad935..ff8a335992 100644 --- a/src/ts-jest-transformer.spec.ts +++ b/src/ts-jest-transformer.spec.ts @@ -1,4 +1,5 @@ import stringify from 'fast-json-stable-stringify' +import { sep } from 'path' import { ParsedCommandLine } from 'typescript' import { logTargetMock } from './__helpers__/mocks' @@ -6,14 +7,14 @@ import { TsJestTransformer } from './ts-jest-transformer' describe('configFor', () => { it('should return the same config-set for same values', () => { - const obj1 = { cwd: '/foo', rootDir: '/bar', globals: {} } + const obj1 = { cwd: '/foo/.', rootDir: '/bar//dummy/..', globals: {} } const obj2 = { ...obj1 } const str = stringify(obj1) const cs1 = new TsJestTransformer().configsFor(obj1 as any) const cs2 = new TsJestTransformer().configsFor(obj2 as any) const cs3 = new TsJestTransformer().configsFor(str) - expect(cs1.cwd).toBe('/foo') - expect(cs1.rootDir).toBe('/bar') + expect(cs1.cwd).toBe(`${sep}foo`) + expect(cs1.rootDir).toBe(`${sep}bar`) expect(cs2).toBe(cs1) expect(cs3).toBe(cs1) }) From 70fd9afc10594fd3c789530c64cbce1828f2da55 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 19:57:11 +0200 Subject: [PATCH 4/7] ci(cache): removes some paths from the caching [clean ci-cache] cache cleanup --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5025042b76..adc381521a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,9 +28,7 @@ install: - npm run clean -- --when-ci-commit-message cache: - - 'node_modules -> package.json' - '%APPDATA%\npm-cache' - - '%APPDATA%\npm' - '%APPDATA%\ts-jest-e2e\__templates__' # Post-install test scripts. From 374dca126f8748882370f0207dbd8346492e3ab5 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 20:42:22 +0200 Subject: [PATCH 5/7] fix(compile): js files were never transpiled thru TS Closes #740 --- src/ts-jest-transformer.spec.ts | 59 +++++++++++++++++++++++++++++++-- src/ts-jest-transformer.ts | 2 +- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/ts-jest-transformer.spec.ts b/src/ts-jest-transformer.spec.ts index e9244ad935..2d8ea19c92 100644 --- a/src/ts-jest-transformer.spec.ts +++ b/src/ts-jest-transformer.spec.ts @@ -64,7 +64,7 @@ describe('process', () => { typescript = { options: {} } as any }) - it('should process input without babel', () => { + it('should process ts input without babel', () => { expect(process()).toBe(`ts:${INPUT}`) expect(config.shouldStringifyContent.mock.calls).toMatchInlineSnapshot(` Array [ @@ -83,7 +83,28 @@ Array [ `) }) - it('should process input with babel', () => { + it('should process js input without babel', () => { + typescript.options.allowJs = true + args[1] = '/foo/bar.js' + expect(process()).toBe(`ts:${INPUT}`) + expect(config.shouldStringifyContent.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + "/foo/bar.js", + ], +] +`) + expect(config.tsCompiler.compile.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + "export default \\"foo\\"", + "/foo/bar.js", + ], +] +`) + }) + + it('should process ts input with babel', () => { babel = { process: jest.fn(s => `babel:${s}`) } expect(process()).toBe(`babel:ts:${INPUT}`) expect(config.shouldStringifyContent.mock.calls).toMatchInlineSnapshot(` @@ -115,6 +136,40 @@ Array [ `) }) + it('should process js input with babel', () => { + typescript.options.allowJs = true + babel = { process: jest.fn(s => `babel:${s}`) } + args[1] = '/foo/bar.js' + expect(process()).toBe(`babel:ts:${INPUT}`) + expect(config.shouldStringifyContent.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + "/foo/bar.js", + ], +] +`) + expect(config.babelJestTransformer.process.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + "ts:export default \\"foo\\"", + "/foo/bar.js", + Object {}, + Object { + "instrument": false, + }, + ], +] +`) + expect(config.tsCompiler.compile.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + "export default \\"foo\\"", + "/foo/bar.js", + ], +] +`) + }) + it('should return stringified version of file', () => { config.shouldStringifyContent.mockImplementation(() => true) expect(process()).toMatchInlineSnapshot(`"module.exports=\\"export default \\\\\\"foo\\\\\\"\\""`) diff --git a/src/ts-jest-transformer.ts b/src/ts-jest-transformer.ts index fa443a6d78..bcbeafa47e 100644 --- a/src/ts-jest-transformer.ts +++ b/src/ts-jest-transformer.ts @@ -111,7 +111,7 @@ export class TsJestTransformer implements jest.Transformer { // we've got a '.js' but the compiler option `allowJs` is not set or set to false this.logger.warn({ fileName: filePath }, interpolate(Errors.GotJsFileButAllowJsFalse, { path: filePath })) result = source - } else if (isTsFile) { + } else if (isJsFile || isTsFile) { // transpile TS code (source maps are included) result = configs.tsCompiler.compile(source, filePath) } else { From 9e7d6a0cb11f9c77e4c77e67c4ef05a74caa8082 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 21:02:47 +0200 Subject: [PATCH 6/7] test(config): adds test related to allowJs --- e2e/__cases__/allow-js/bar.spec.ts | 10 +++ e2e/__cases__/allow-js/bar.ts | 1 + e2e/__cases__/allow-js/foo.js | 1 + e2e/__cases__/allow-js/foo.spec.js | 10 +++ e2e/__cases__/allow-js/tsconfig.json | 6 ++ .../__snapshots__/allow-js.test.ts.snap | 86 +++++++++++++++++++ e2e/__tests__/allow-js.test.ts | 14 +++ 7 files changed, 128 insertions(+) create mode 100644 e2e/__cases__/allow-js/bar.spec.ts create mode 100644 e2e/__cases__/allow-js/bar.ts create mode 100644 e2e/__cases__/allow-js/foo.js create mode 100644 e2e/__cases__/allow-js/foo.spec.js create mode 100644 e2e/__cases__/allow-js/tsconfig.json create mode 100644 e2e/__tests__/__snapshots__/allow-js.test.ts.snap create mode 100644 e2e/__tests__/allow-js.test.ts diff --git a/e2e/__cases__/allow-js/bar.spec.ts b/e2e/__cases__/allow-js/bar.spec.ts new file mode 100644 index 0000000000..b2be7ec5e8 --- /dev/null +++ b/e2e/__cases__/allow-js/bar.spec.ts @@ -0,0 +1,10 @@ +import * as foo from './foo' +import bar = require('./bar') + +test('foo', () => { + expect(foo).toBe('FOO!') +}) + +test('bar', () => { + expect(bar).toBe('BAR!') +}) diff --git a/e2e/__cases__/allow-js/bar.ts b/e2e/__cases__/allow-js/bar.ts new file mode 100644 index 0000000000..03df82b30b --- /dev/null +++ b/e2e/__cases__/allow-js/bar.ts @@ -0,0 +1 @@ +export = 'BAR!' diff --git a/e2e/__cases__/allow-js/foo.js b/e2e/__cases__/allow-js/foo.js new file mode 100644 index 0000000000..73cfb2112e --- /dev/null +++ b/e2e/__cases__/allow-js/foo.js @@ -0,0 +1 @@ +module.exports = 'FOO!' diff --git a/e2e/__cases__/allow-js/foo.spec.js b/e2e/__cases__/allow-js/foo.spec.js new file mode 100644 index 0000000000..d6eb95ee1a --- /dev/null +++ b/e2e/__cases__/allow-js/foo.spec.js @@ -0,0 +1,10 @@ +const foo = require('./foo') +const bar = require('./bar') + +test('foo', () => { + expect(foo).toBe('FOO!') +}) + +test('bar', () => { + expect(bar).toBe('BAR!') +}) diff --git a/e2e/__cases__/allow-js/tsconfig.json b/e2e/__cases__/allow-js/tsconfig.json new file mode 100644 index 0000000000..26f31aa261 --- /dev/null +++ b/e2e/__cases__/allow-js/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "target": "es5", + "allowJs": true + } +} diff --git a/e2e/__tests__/__snapshots__/allow-js.test.ts.snap b/e2e/__tests__/__snapshots__/allow-js.test.ts.snap new file mode 100644 index 0000000000..33e8f288c0 --- /dev/null +++ b/e2e/__tests__/__snapshots__/allow-js.test.ts.snap @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Allow JS test should pass using template "default" 1`] = ` + √ jest + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + + ===[ STDERR ]=================================================================== + PASS ./bar.spec.ts + PASS ./foo.spec.js + + Test Suites: 2 passed, 2 total + Tests: 4 passed, 4 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Allow JS test should pass using template "with-babel-6" 1`] = ` + √ jest + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + + ===[ STDERR ]=================================================================== + PASS ./bar.spec.ts + PASS ./foo.spec.js + + Test Suites: 2 passed, 2 total + Tests: 4 passed, 4 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Allow JS test should pass using template "with-babel-7" 1`] = ` + √ jest + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + + ===[ STDERR ]=================================================================== + PASS ./bar.spec.ts + PASS ./foo.spec.js + + Test Suites: 2 passed, 2 total + Tests: 4 passed, 4 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Allow JS test should pass using template "with-jest-22" 1`] = ` + √ jest + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + + ===[ STDERR ]=================================================================== + PASS ./bar.spec.ts + PASS ./foo.spec.js + + Test Suites: 2 passed, 2 total + Tests: 4 passed, 4 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; + +exports[`Allow JS test should pass using template "with-typescript-2-7" 1`] = ` + √ jest + ↳ exit code: 0 + ===[ STDOUT ]=================================================================== + + ===[ STDERR ]=================================================================== + PASS ./bar.spec.ts + PASS ./foo.spec.js + + Test Suites: 2 passed, 2 total + Tests: 4 passed, 4 total + Snapshots: 0 total + Time: XXs + Ran all test suites. + ================================================================================ +`; diff --git a/e2e/__tests__/allow-js.test.ts b/e2e/__tests__/allow-js.test.ts new file mode 100644 index 0000000000..b3a121b1a8 --- /dev/null +++ b/e2e/__tests__/allow-js.test.ts @@ -0,0 +1,14 @@ +import { allValidPackageSets } from '../__helpers__/templates' +import { configureTestCase } from '../__helpers__/test-case' + +describe('Allow JS test', () => { + const testCase = configureTestCase('allow-js') + + testCase.runWithTemplates(allValidPackageSets, 0, (runTest, { testLabel }) => { + it(testLabel, () => { + const result = runTest() + expect(result.status).toBe(0) + expect(result).toMatchSnapshot() + }) + }) +}) From e4a3a091a6532936d04653e4cd19df341d25f683 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Thu, 20 Sep 2018 21:45:56 +0200 Subject: [PATCH 7/7] chore(release): 23.10.1 --- CHANGELOG.md | 12 ++++++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f48559ea..b5c2113304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ + +## [23.10.1](https://github.com/kulshekhar/ts-jest/compare/v23.10.0...v23.10.1) (2018-09-20) + + +### Bug Fixes + +* **compile:** js files were never transpiled thru TS ([374dca1](https://github.com/kulshekhar/ts-jest/commit/374dca1)), closes [#740](https://github.com/kulshekhar/ts-jest/issues/740) +* **config:** warn instead of forcing ESM interoperability ([a2a4be2](https://github.com/kulshekhar/ts-jest/commit/a2a4be2)) +* **windows:** normalize paths ([c12dfff](https://github.com/kulshekhar/ts-jest/commit/c12dfff)) + + + # [23.10.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.6...v23.10.0) (2018-09-19) diff --git a/package-lock.json b/package-lock.json index 7fff297c05..4c30efa54c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ts-jest", - "version": "23.10.0", + "version": "23.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 25ca7df28e..f6db519180 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-jest", - "version": "23.10.0", + "version": "23.10.1", "main": "dist/index.js", "types": "dist/index.d.ts", "bin": "cli.js",