This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
chore(tests): fail tests on console output #453
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9daf19c
fail tests on console output
kuzhelov-ms f6ade19
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov-ms 8b48825
add strict flag for tests on circle CI
kuzhelov-ms eb134d5
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov 13b22dd
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov f17555a
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov c14500f
remove `listRef` prop from List
kuzhelov-ms 2969397
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov 24698f3
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov 03b4db9
Merge branch 'master' into chore/fail-tests-on-console-output
kuzhelov bbfc19b
fix Input's logic - do not blindly pass 'styles' prop
kuzhelov-ms e68a925
update changelog
kuzhelov-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const commonConfig = require('./test/jest.config.common') | ||
|
||
module.exports = commonConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
coverageDirectory: "./coverage/", | ||
coverageReporters: [ | ||
'json', | ||
'lcov' | ||
], | ||
testRegex: '/test/.*-test\\.tsx?$', | ||
moduleFileExtensions: [ | ||
'ts', | ||
'tsx', | ||
'js', | ||
'json' | ||
], | ||
setupTestFrameworkScriptFile: `${__dirname}/setup.common.ts`, | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest' | ||
}, | ||
moduleNameMapper: { | ||
'docs/(.*)$': `${__dirname}/../docs/$1`, | ||
'src/(.*)$': `${__dirname}/../src/$1`, | ||
'test/(.*)$': `${__dirname}/../test/$1` | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const commonConfig = require('./jest.config.common') | ||
|
||
module.exports = Object.assign({}, | ||
commonConfig, | ||
{ setupTestFrameworkScriptFile: `${__dirname}/setup.strict.ts` } | ||
) |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Setup (Strict) | ||
* This is the bootstrap code that is run before any tests, utils, mocks in 'strict' mode. | ||
*/ | ||
require('./setup.common') | ||
|
||
jest.spyOn(console, 'log') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 very nicely done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to confess that those changes are mine, but this is not the case :) actually, the approach of using spies for console methods was already introduced before and just have been removed from sources for a while |
||
jest.spyOn(console, 'info') | ||
jest.spyOn(console, 'warn') | ||
jest.spyOn(console, 'error') | ||
|
||
afterAll(() => { | ||
expect(console.log).not.toHaveBeenCalled() | ||
expect(console.info).not.toHaveBeenCalled() | ||
expect(console.warn).not.toHaveBeenCalled() | ||
expect(console.error).not.toHaveBeenCalled() | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuzhelov not sure how much these things are related, but is this the place where we specify how the files in
test
directory are compiled?ts-jest
vstypescript
compiler? more details in #445There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, you are partially right, but let me provide full story behind that.
Currently
ts-jest
tool is responsible for transpiling jest tests before they will run - and this fact is stated by value oftransform
option of Jest config file. Thus, to run the tests we don't need to do any transpilation ourselves for test files as long as this tool is used for making necessary transform. Another thing to note is thatts-jest
doesn't produce any (visible) transpilation artifacts - in contrast to the process that is used to compile sources.For source files, in contrast,
tsconfig.json
file is in charge of defining how and which files should be transpiled.Answering on your question - while, yes,
transform
option serves to suggest Jest thatts-jest
should be used for making transform, there is no was to specify directly there that 'raw' TS compiler (without being wrapped as a plugin) should be used. If we would like to use raw TS compiler, we would need to make test process consisting of two steps:To my mind this move would definitely complicate things, but let me first take a look on the issue to obtain more details on why this move might be necessary