Skip to content

Commit

Permalink
Merge pull request #637 from spotify/rugvip/testyles
Browse files Browse the repository at this point in the history
packages/cli: default to mocking style imports in tests
  • Loading branch information
Rugvip committed Apr 23, 2020
2 parents cb4b357 + 1020a93 commit 723eaa7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/cli/config/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ if (fs.existsSync('jest.config.js')) {
} else {
const extraOptions = {
modulePaths: ['<rootDir>'],
moduleNameMapper: {
'\\.(css|less|scss|sss|styl)$': require.resolve('jest-css-modules'),
},
};

// Use src/setupTests.ts as the default location for configuring test env
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"html-webpack-plugin": "^3.2.0",
"inquirer": "^7.0.4",
"jest": "^25.1.0",
"jest-css-modules": "^2.1.0",
"ora": "^4.0.3",
"react": "^16.0.0",
"react-dev-utils": "^10.2.0",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11535,6 +11535,13 @@ jest-config@^25.1.0:
pretty-format "^25.1.0"
realpath-native "^1.1.0"

jest-css-modules@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/jest-css-modules/-/jest-css-modules-2.1.0.tgz#9c25ebe9d0214d8f55861a442268fdd4b01b4781"
integrity sha512-my3Scnt6l2tOll/eGwNZeh1KLAFkNzdl4MyZRdpl46GO6/93JcKKdTjNqK6Nokg8A8rT84MFLOpY1pzqKBEqMw==
dependencies:
identity-obj-proxy "3.0.0"

jest-diff@^24.0.0, jest-diff@^24.3.0, jest-diff@^24.9.0:
version "24.9.0"
resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da"
Expand Down

0 comments on commit 723eaa7

Please sign in to comment.