Skip to content

Commit a4d000b

Browse files
committed
test: adds a failing test for #636
1 parent 68f8cb3 commit a4d000b

8 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import runJest from '../__helpers__/runJest';
2+
3+
describe('Use jest config from config dir', () => {
4+
it('Should run all tests resolving tsconfig extends', () => {
5+
const result = runJest('../rel-config-paths', [
6+
'--no-cache',
7+
'--config=./config/jest.config.js',
8+
]);
9+
10+
expect(result.status).toBe(0);
11+
});
12+
13+
it('Should fail resolving tsconfig with wrong relative path', () => {
14+
const result = runJest('../rel-config-paths', [
15+
'--no-cache',
16+
'--config=./config/jest.config.invalid.js',
17+
]);
18+
19+
expect(result.status).toBe(1);
20+
expect(result.stderr).toContain(
21+
'Unable to find tsconfig file given "./tsconfig.test.json"',
22+
);
23+
});
24+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
errorOnDeprecated: true,
3+
globals: {
4+
'ts-jest': {
5+
tsConfigFile: './tsconfig.test.json',
6+
},
7+
},
8+
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
9+
rootDir: '../',
10+
testMatch: ['<rootDir>/custom-test-dir/**/*.ts'],
11+
transform: {
12+
'^.+\\.tsx?$': 'ts-jest',
13+
},
14+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
errorOnDeprecated: true,
3+
globals: {
4+
'ts-jest': {
5+
tsConfigFile: '<rootDir>/config/tsconfig.test.json',
6+
},
7+
},
8+
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
9+
rootDir: '../',
10+
testMatch: ['<rootDir>/custom-test-dir/**/*.ts'],
11+
transform: {
12+
'^.+\\.tsx?$': 'ts-jest',
13+
},
14+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "../",
4+
"outDir": "../dist"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"include": [
4+
"../custom-test-dir"
5+
]
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
declare var jest, describe, it, expect;
2+
3+
import { hi } from '../src';
4+
5+
describe('hi', () => {
6+
it('should say hi', () => {
7+
expect(hi()).toBe('HI!');
8+
});
9+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function hi() {
2+
return 'HI!';
3+
}

0 commit comments

Comments
 (0)