forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (43 loc) · 1.41 KB
/
index.js
File metadata and controls
55 lines (43 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import deprecated from 'react-prop-types/lib/deprecated';
import { _resetWarned } from '../src/utils/deprecationWarning';
beforeEach(() => {
/* eslint-disable no-console */
sinon.stub(console, 'error', msg => {
let expected = false;
console.error.expected.forEach(about => {
if (msg.indexOf(about) !== -1) {
console.error.warned[about] = true;
expected = true;
}
});
if (expected) {
return;
}
console.error.threw = true;
throw new Error(msg);
});
console.error.expected = [];
console.error.warned = Object.create(null);
console.error.threw = false;
/* eslint-enable no-console */
});
afterEach(() => {
/* eslint-disable no-console */
if (!console.error.threw && console.error.expected.length) {
expect(console.error.warned).to.have.keys(console.error.expected);
}
console.error.restore();
/* eslint-enable no-console */
_resetWarned();
deprecated._resetWarned();
});
describe('Process environment for tests', () => {
it('should not be production for React console warnings', () => {
expect(process.env.NODE_ENV).to.not.equal('production');
});
});
// Ensure all files in src folder are loaded for proper code coverage analysis.
const srcContext = require.context('../src', true, /.*\.js$/);
srcContext.keys().forEach(srcContext);
const testsContext = require.context('.', true, /Spec$/);
testsContext.keys().forEach(testsContext);