Skip to content

Commit

Permalink
Merge pull request #10 from rebeccaalpert/tests
Browse files Browse the repository at this point in the history
Make it so we can write tests again
  • Loading branch information
rebeccaalpert authored Oct 25, 2024
2 parents ea5cbc0 + c2c34b0 commit ad55394
Show file tree
Hide file tree
Showing 8 changed files with 1,943 additions and 451 deletions.
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-typescript',
],
};
26 changes: 17 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,35 @@ module.exports = {
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: false,
collectCoverage: true,

collectCoverageFrom: ['<rootDir>/src/app/**/*.tsx'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',

// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: [
"node_modules",
"<rootDir>/src"
],
moduleDirectories: ['node_modules', '<rootDir>/src'],

// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"@app/(.*)": '<rootDir>/src/app/$1'
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'@app/(.*)': '<rootDir>/src/app/$1',
},

// A preset that is used as a base for Jest's configuration
preset: "ts-jest/presets/js-with-ts",
preset: 'ts-jest/presets/js-with-ts',

// The test environment that will be used for testing.
testEnvironment: "jsdom",
testEnvironment: 'jsdom',

transformIgnorePatterns: [
'node_modules/(?!@patternfly|react-syntax-highlighter|remark-gfm|react-markdown|remark-parse|devlop|hast-util-to-jsx-runtime|comma-separated-tokens|estree-util-is-identifier-name|hast-util-whitespace|property-information|space-separated-tokens|unist-util-position|vfile-message|unist-util-stringify-position|html-url-attributes|mdast-util-from-markdown|mdast-util-to-string|micromark|decode-named-character-reference|remark-rehype|mdast-util-to-hast|trim-lines|unist-util-visit|unist-util-is|unified|bail|is-plain-obj|trough|vfile|mdast-util-gfm|ccount|mdast-util-find-and-replace|escape-string-regexp|markdown-table|mdast-util-to-markdown|zwitch|longest-streak|mdast-util-phrasing)',
],

transform: {
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
},
};
Loading

0 comments on commit ad55394

Please sign in to comment.