Skip to content

Commit

Permalink
Merge branch 'master' into fix-740-no-js-compilation-with-allow-js
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Sep 20, 2018
2 parents 9e7d6a0 + 18dced1 commit a844fd4
Show file tree
Hide file tree
Showing 21 changed files with 423 additions and 62 deletions.
2 changes: 0 additions & 2 deletions appveyor.yml
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions e2e/__cases__/deep/package.json
@@ -0,0 +1,5 @@
{
"scripts": {
"test": "cd src/Tests && jest"
}
}
5 changes: 5 additions & 0 deletions 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)}`
}
3 changes: 3 additions & 0 deletions e2e/__cases__/deep/src/Button/mod.d.ts
@@ -0,0 +1,3 @@
type ModExport = (str: string) => string
declare const _export: ModExport
export = _export
3 changes: 3 additions & 0 deletions e2e/__cases__/deep/src/Button/mod.js
@@ -0,0 +1,3 @@
module.exports = function(str) {
return str.toUpperCase()
}
5 changes: 5 additions & 0 deletions 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')
})
24 changes: 24 additions & 0 deletions 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",
})
5 changes: 5 additions & 0 deletions e2e/__cases__/deep/src/Tests/tsconfig.json
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.node.json",
"compilerOptions": {
}
}
10 changes: 10 additions & 0 deletions e2e/__cases__/deep/src/tsconfig.base.json
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"skipLibCheck": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strict": true
}
}
10 changes: 10 additions & 0 deletions e2e/__cases__/deep/src/tsconfig.base.node.json
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": [
"es2017"
]
}
}
5 changes: 5 additions & 0 deletions e2e/__cases__/deep/tsconfig.json
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion e2e/__helpers__/test-case/run-result.ts
Expand Up @@ -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(' ')
}

Expand Down
271 changes: 271 additions & 0 deletions 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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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:<cwd>/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.
================================================================================
`;

0 comments on commit a844fd4

Please sign in to comment.