Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From 6b55e45d58eb98bb353fbf2087a5c0494e0110e4 Mon Sep 17 00:00:00 2001
From: cpojer <christoph.pojer@gmail.com>
Date: Fri, 23 Oct 2015 14:24:52 -0700
Subject: [PATCH] Fix tests.
---
package.json | 11 ++++++++---
src/components/Header/__tests__/Header-test.js | 2 --
src/mocks/css-stub.js | 7 +++++++
3 files changed, 15 insertions(+), 5 deletions(-)
create mode 100644 src/mocks/css-stub.js
diff --git a/package.json b/package.json
index f28d747..5130215 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"gaze": "^0.5.2",
"git-repository": "^0.1.1",
"glob": "^5.0.15",
- "jest-cli": "^0.5.10",
+ "jest-cli": "^0.6.0",
"jscs": "^2.3.5",
"lodash.merge": "^3.3.2",
"mkdirp": "^0.5.1",
@@ -66,9 +66,14 @@
"jest": {
"rootDir": "./src",
"scriptPreprocessor": "../preprocessor.js",
+ "moduleNameMapper": {
+ "[A-z]+\\.css$": "css-stub"
+ },
"unmockedModulePathPatterns": [
- "fbjs",
- "react"
+ "react",
+ "react-dom",
+ "react-addons-test-utils",
+ "fbjs"
]
},
"scripts": {
diff --git a/src/components/Header/__tests__/Header-test.js b/src/components/Header/__tests__/Header-test.js
index c2ca832..4b1a08c 100644
--- a/src/components/Header/__tests__/Header-test.js
+++ b/src/components/Header/__tests__/Header-test.js
@@ -1,7 +1,5 @@
jest.dontMock('../Header');
jest.dontMock('../../../decorators/withStyles.js');
-jest.setMock('../Header.css', {use: function noop() {}, unuse: function noop() {}});
-
import React from 'react';
import TestUtils from 'react-addons-test-utils';
diff --git a/src/mocks/css-stub.js b/src/mocks/css-stub.js
new file mode 100644
index 0000000..537da2e
--- /dev/null
+++ b/src/mocks/css-stub.js
@@ -0,0 +1,7 @@
+/**
+ * @providesModule css-stub
+ */
+
+console.log('hey ho, let\'s go!');
+
+module.exports = {use: function noop() {}, unuse: function noop() {}};
--
2.6.2+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.