-
Notifications
You must be signed in to change notification settings - Fork 13
build(next): Simplify test setup #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: 'current', | ||
}, | ||
}, | ||
], | ||
['@babel/preset-env', { | ||
targets: { node: 'current' }, | ||
}], | ||
], | ||
plugins: [ | ||
[ | ||
'module-resolver', | ||
{ | ||
root: ['./src'], | ||
alias: { | ||
'@': './src', | ||
}, | ||
}, | ||
], | ||
['module-resolver', { | ||
root: ['./src'], | ||
alias: { '@': './src' }, | ||
}], | ||
], | ||
}; |
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 @@ | ||
22.13.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
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,14 @@ | ||
/** | ||
* @type {import('@babel/core').TransformOptions} | ||
*/ | ||
const options = { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: 'current' } }], | ||
// Type checking is already done in our build, | ||
// so we can use a lightweight preset. | ||
// - https://jestjs.io/docs/getting-started#using-typescript | ||
'@babel/preset-typescript', | ||
], | ||
} | ||
|
||
export default options |
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
/** | ||
* This next version of JSON Schema Form ("V2") | ||
* must be tested against 2 sets ("root") of tests. | ||
* Note that "rootDir" is the path to this next version. | ||
* | ||
* @type {import('jest').Config['roots']} | ||
*/ | ||
const roots = [ | ||
// 1. The existing tests from the previous version ("V1") | ||
'<rootDir>/../src/tests', | ||
// 2. The new tests for this version | ||
'<rootDir>/test', | ||
] | ||
|
||
/** | ||
* Module aliases to use the same test with different source versions. | ||
* To learn more, see "roots" above. | ||
* | ||
* This is only needed to use V1 tests for V2 source. | ||
* as V2 tests are used to test V2 source only. | ||
* | ||
* @type {import('jest').Config['moduleNameMapper']} | ||
*/ | ||
const moduleNameMapper = { | ||
// We use kebab-case in V2 | ||
'^@/createHeadlessForm$': '<rootDir>/src/form', | ||
'^@/utils$': '<rootDir>/src/utils', | ||
// Avoid catch all aliases such as "^@/(.*)$". | ||
// Aliases should be added as needed. | ||
// If there are many, we will have a compat barrel file. | ||
} | ||
|
||
/** | ||
* Some tests are invalid for V2 testing. | ||
* For example: | ||
* - Buggy behaviours in V1 that are already fixed (and tested) in V2 | ||
* - Deprecated or removed APIs | ||
* | ||
* @type {import('jest').Config['testPathIgnorePatterns']} | ||
*/ | ||
const testPathIgnorePatterns = [ | ||
// Nothing yet | ||
] | ||
|
||
/** @type {import('jest').Config} */ | ||
const config = { | ||
roots, | ||
moduleNameMapper, | ||
testPathIgnorePatterns, | ||
} | ||
|
||
export default config |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Do you want to keep this @dragidavid ? It's a really long story, but usually I'd suggest to just have one reference, to reduce the risk of out-of-sync in the future 🤔
Not big enough to be a change request though. Could be convenient for folks with NVM, which at the moment is Remote's default setup.