-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add theforeman github actions for JS tests
* Adapt jest.config.js for JS test suite * Fix webpack/lib katello tests * Upgrade @testing-library/react to 14.2.2 * Add preliminary test for StatusPropertiesLabel
- Loading branch information
1 parent
ad430ce
commit 483d16d
Showing
8 changed files
with
320 additions
and
157 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
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,35 +1,30 @@ | ||
const { foremanLocation, foremanRelativePath } = require('@theforeman/find-foreman') | ||
const tfmConfig = require('@theforeman/test/src/pluginConfig'); | ||
const { | ||
foremanRelativePath, | ||
foremanLocation, | ||
} = require('@theforeman/find-foreman'); | ||
|
||
const foremanReactRelative = 'webpack/assets/javascripts/react_app'; | ||
const foremanFull = foremanLocation(); | ||
const foremanReactFull = foremanRelativePath(foremanReactRelative); | ||
|
||
// Jest configuration | ||
module.exports = { | ||
testURL: 'http://localhost/', | ||
setupFiles: [ | ||
'./webpack/test_setup.js', | ||
], | ||
setupFilesAfterEnv: [ | ||
'./webpack/global_test_setup.js', | ||
'@testing-library/jest-dom' | ||
], | ||
testPathIgnorePatterns: [ | ||
'/node_modules/', | ||
'<rootDir>/foreman/', | ||
'<rootDir>/.+fixtures.+', | ||
'<rootDir>/engines', | ||
], | ||
moduleDirectories: [ | ||
`${foremanFull}/node_modules`, | ||
`${foremanFull}/node_modules/@theforeman/vendor-core/node_modules`, | ||
'node_modules', | ||
'webpack/test-utils', | ||
], | ||
modulePathIgnorePatterns: [ | ||
'<rootDir>/foreman/', | ||
], | ||
moduleNameMapper: { | ||
'^.+\\.(css|scss)$': 'identity-obj-proxy', | ||
'^foremanReact(.*)$': `${foremanReactFull}/$1`, | ||
}, | ||
}; | ||
// Find correct path to foremanReact so we do not have to mock it in tests | ||
tfmConfig.moduleNameMapper['^foremanReact(.*)$'] = `${foremanReactFull}/$1`; | ||
|
||
tfmConfig.setupFiles = ['./webpack/test_setup.js']; | ||
tfmConfig.setupFilesAfterEnv = [ | ||
'./webpack/global_test_setup.js', | ||
'@testing-library/jest-dom', | ||
]; | ||
|
||
// Do not use default resolver | ||
tfmConfig.resolver = null; | ||
// Specify module dirs instead | ||
tfmConfig.moduleDirectories = [ | ||
`${foremanFull}/node_modules`, | ||
`${foremanFull}/node_modules/@theforeman/vendor-core/node_modules`, | ||
'node_modules', | ||
'webpack/test-utils', | ||
]; | ||
|
||
module.exports = tfmConfig; |
Oops, something went wrong.