Skip to content

Commit e317e3b

Browse files
committed
Merge branch 'fix-module-warning' into testMatch-and-testRegex
2 parents 31ad0aa + 9e7d2f0 commit e317e3b

35 files changed

Lines changed: 1415 additions & 103 deletions

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22

33
env:
4-
- TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir
4+
- TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1
55

66
cache:
77
npm: true

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ install:
2424
# - set CI=true
2525
# Our E2E work dir
2626
- set TS_JEST_E2E_WORKDIR=%APPDATA%\ts-jest-e2e
27+
- set TS_JEST_E2E_OPTIMIZATIONS=1
2728
- npm ci --ignore-scripts
2829
- npm run clean -- --when-ci-commit-message
2930

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import lib from './lib'
2+
3+
test('import default', () => {
4+
expect(typeof lib).toBe('function')
5+
expect(lib()).toBe('foo')
6+
expect(lib.bar).toBe('bar')
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import lib = require('./lib')
2+
3+
test('import default', () => {
4+
expect(typeof lib).toBe('function')
5+
expect(lib()).toBe('foo')
6+
expect(lib.bar).toBe('bar')
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as lib from './lib'
2+
3+
test('import default', () => {
4+
expect(typeof lib).toBe('function')
5+
expect(lib()).toBe('foo')
6+
expect(lib.bar).toBe('bar')
7+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare function lib ()
2+
declare namespace lib {
3+
export const bar: string
4+
}
5+
export = lib

e2e/__cases__/module-kinds/lib.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function lib() { return 'foo' }
2+
3+
lib.bar = 'bar'
4+
5+
module.exports = lib
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"allowJs": true,
5+
"rootDir": ".",
6+
"outDir": "dist"
7+
}
8+
}

e2e/__helpers__/test-case/__hooks-source__.js.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
const fs = require('fs')
44
const path = require('path')
55
const root = __dirname
6-
const writeProcessIoTo = {{writeProcessIoTo}}
6+
const writeProcessIoTo = path.resolve(root, {{writeProcessIoTo}})
77

88
exports.afterProcess = function (args, result) {
99
// const source = args[0]
1010
const filePath = args[1]
1111
const relPath = path.relative(root, filePath)
12-
if (writeProcessIoTo && filePath.startsWith(`${root}${path.sep}`)) {
12+
if (filePath.startsWith(`${root}${path.sep}`)) {
1313
const dest = `${path.join(writeProcessIoTo, relPath)}.json`
1414
const segments = relPath.split(path.sep)
1515
segments.pop()

e2e/__helpers__/test-case/run-descriptor.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ export default class RunDescriptor {
2626
}
2727

2828
get sourcePackageJson() {
29-
return this._sourcePackageJson || (this._sourcePackageJson = require(join(this.sourceDir, 'package.json')))
29+
try {
30+
return this._sourcePackageJson || (this._sourcePackageJson = require(join(this.sourceDir, 'package.json')))
31+
} catch (err) {}
32+
return {}
3033
}
3134

3235
get templateName(): string {
@@ -45,8 +48,18 @@ export default class RunDescriptor {
4548
if (logUnlessStatus != null && logUnlessStatus !== result.status) {
4649
// tslint:disable-next-line:no-console
4750
console.log(
48-
`Output of test run in "${this.name}" using template "${this.templateName}" (exit code: ${result.status}):\n\n`,
51+
'='.repeat(70),
52+
'\n',
53+
`Test exited with unexpected status in "${this.name}" using template "${this.templateName}" (exit code: ${
54+
result.status
55+
}):\n`,
56+
result.context.cmd,
57+
result.context.args.join(' '),
58+
'\n\n',
4959
result.output.trim(),
60+
'\n',
61+
'='.repeat(70),
62+
'\n',
5063
)
5164
}
5265
return result

0 commit comments

Comments
 (0)