Skip to content

Commit c676b7d

Browse files
committed
Cleanup test output
Don’t let tests print console.error
1 parent e6be1ea commit c676b7d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/shared/services/grassUtils.test.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
20+
/* global beforeEach, afterEach */
2121
import { parseGrass, objToCss } from 'services/grassUtils'
2222

2323
describe('parseGrass', () => {
@@ -50,6 +50,13 @@ describe('parseGrass', () => {
5050
})
5151

5252
describe('objToCss', () => {
53+
const origConsoleError = console.error
54+
beforeEach(() => {
55+
console.error = () => {}
56+
})
57+
afterEach(() => {
58+
console.error = origConsoleError
59+
})
5360
it('should create CSS from obj', () => {
5461
const obj = {
5562
body: {
@@ -72,8 +79,11 @@ h1 {
7279
const css = objToCss(obj)
7380

7481
expect(css).toEqual(expected)
82+
console.error = origConsoleError
7583
})
7684
it('should create GraSS from obj', () => {
85+
const origConsoleError = console.error
86+
console.error = () => {}
7787
const obj = {
7888
node: {
7989
color: 'red',
@@ -107,6 +117,7 @@ relationship {
107117
const grass = objToCss(obj)
108118

109119
expect(grass).toEqual(expected)
120+
console.error = origConsoleError
110121
})
111122
it('does not break on null', () => {
112123
const obj = null

0 commit comments

Comments
 (0)