-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(next): Simplify test setup (#112)
* Fix * Update jest.config.js * Update babel.config.js * chore: add default node version --------- Co-authored-by: David Dragovacz <[email protected]>
- Loading branch information
1 parent
42b2b13
commit 858df6a
Showing
13 changed files
with
276 additions
and
553 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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.