Skip to content

Commit

Permalink
Shayan/ FEQ-286/ fixed jest errors and refactored updated sample test (
Browse files Browse the repository at this point in the history
…binary-com#4969)

* fix: fixed jest errors and refactored example test file

* feat: updated jest config and test for checbox

* build: rebuild package-lock file with node16 to fix vercel issue

* feat: added utility function to check support for sw

* chore: removed unrelated changes

* chore: empty commit
  • Loading branch information
shayan-deriv authored Aug 9, 2023
1 parent 2565059 commit 7a455da
Show file tree
Hide file tree
Showing 7 changed files with 42,743 additions and 9,597 deletions.
18 changes: 8 additions & 10 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// eslint-disable-next-line no-unused-vars
const { defaults } = require('jest-config')
module.exports = {
// A set of global variables that need to be available in all test environments
globals: {},

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
testURL: 'http://localhost:8000',
testEnvironmentOptions: {
url: 'http://localhost:8000'
},

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: false,
Expand All @@ -20,7 +20,7 @@ module.exports = {
coverageDirectory: './coverage/',

// The glob patterns Jest uses to detect test files
testMatch: ['<rootDir>/src/**/__tests__/**/?(*.)+(spec).[jt]s?(x)'],
testMatch: ['<rootDir>/src/features/**/__tests__/**/?(*.)+(spec).[jt]s?(x)'],

// The test environment that will be used for testing
testEnvironment: 'jsdom',
Expand All @@ -32,29 +32,27 @@ module.exports = {
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [`node_modules/(?!(gatsby|gatsby-script)/)`],
transformIgnorePatterns: [`node_modules/(?!(gatsby|gatsby-script|gbimage-bridge|p-min-delay|uuid)/)`],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`,
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`,
'^common/(.*)$': '<rootDir>/src/common/$1',
'^components/(.*)$': '<rootDir>/src/components/$1',
'^features/(.*)$': '<rootDir>/src/features/$1',
'^images/(.*)$': '<rootDir>/src/images/$1',
'^lotties/(.*)$': '<rootDir>/src/lotties/$1',
'^pages/(.*)$': '<rootDir>/src/pages/$1',
'^store': '<rootDir>/src/store/$1',
'^store/(.*)$': '<rootDir>/src/store/$1',
'^templates': '<rootDir>/src/templates/$1',
'^themes/(.*)$': '<rootDir>/src/themes/$1',
'^translations/(.*)$': '<rootDir>/src/translations/$1',
'^types/(.*)$': '<rootDir>/src/types/$1',
'^gatsby-page-utils/(.*)$': `gatsby-page-utils/dist/$1`,
'^gatsby-core-utils/(.*)$': `gatsby-core-utils/dist/$1`,
'^gatsby-plugin-utils/(.*)$': [`gatsby-plugin-utils/dist/$1`, `gatsby-plugin-utils/$1`],
},

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`, `<rootDir>/src/features/pages` ],

// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: ['node_modules'],
Expand Down
Loading

0 comments on commit 7a455da

Please sign in to comment.