Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

filter out .gif and more in testHelperMocha.js #194

Merged
merged 1 commit into from
Jun 3, 2016

Conversation

saltycrane
Copy link
Contributor

@saltycrane saltycrane commented Jun 3, 2016

Importing a gif image gave me a "Unexpected character" error when running the tests. (The browser rendered the image served by Gluestick without problem.)

Example code:

/* @flow */
import React, { Component } from "react";

import catImage from "assets/img/cat.gif";

export default class Home extends Component {
  render () {
    return (
      <div>
        Home
        <img src={catImage} />
      </div>
    );
  }
}

Image from here: https://upload.wikimedia.org/wikipedia/commons/9/9f/Odd-eyed_cat_by_ihasb33r-2.gif

Running gluestick test:

$ gluestick test

SyntaxError: /opt/tmp/newapp/assets/img/cat.gif: Unexpected character '�' (1:6)
> 1 | GIF89a�w����������������������������3f���3333f3�3�3�ff3fff�f�f���3�f��������3�f̙������3�f������3333f3�3�3�3333333f33�33�33�3f3f33ff3f�3f�3f�3�3�33�f3��3��3��3�3�33�f3̙3��3��3�3�33�f3��3��3��ff3fff�f�f�f3f33f3ff3�f3�f3�ffff3fffff�ff�ff�f�f�3f�ff��f��f��f�f�3f�ff̙f��f��f�f�3f�ff��f��f����3�f�����3�33�3f�3��3̙3��f�f3�ff�f��f̙f�����3��f�����������3��f���������3��f���������3�f�������3�33�3f�3��3��3��f�f3�ff�f��f��f�3̙f̙�������3��f�����������3��f�����������3�f�������3�33�3f�3��3��3��f�f3�ff�f��f��f�����3��f�������������3��f�����������3��f���������!�,����Hp�A���EM5�.l��"Ċ-j̘��Gj �Y��œ����#E�,:��H�����F�gO�:�Q�F�_5�Du-�R�ƛ9G�����G�L�V�*ukŮ&�V��U)5�G��Mz��4?�P��,�\ftE5c�U_�fFX����F<X�`�Ō��;m�e�j}�r"T�kz�-��mA��u�ת5��JU��m��ͻ�o����t�L�Ƌ�<~� s�3"4(=UuX�_^�؎�]���Y1���5��L�2����S�g�5gT�g�n� ��G������_����W^�MF�d6�`a�uUY(���}&�o���]q��Xޡ��jz��w'#|�!g��8Ʒx/���w��V^S��\p&��l~k�E�]M<:�H=���}[�碋�KRc�����J^���_��%!c��Igcw>6؅�U��Y���d�Y�I���Tj���ڟjj��t�A��Gݦ�iǩu3�
    |       ^
  2 | ]p���s�N�*��n�j�&j�Tc�"9��M�)j�FR���A뫯�ee�R�ݷ�s��]~�L^�RXL�
  3 | ^;��.(Y]�b(��Lv8(�1%'"u�]�%�V�H^��>��5�D�����E���"gLUip���DKi�eQBQ,�e��K��bq�U�TiU�%�2~���ԙC�2�]2�
  4 | ^q6�J�|���cy♘�=����E*����q��%j�f)
    at Parser.pp.raise (/opt/tmp/gluestick/node_modules/babylon/lib/parser/location.js:22:13)
    at Parser.getTokenFromCode (/opt/tmp/gluestick/node_modules/babylon/lib/tokenizer/index.js:561:12)
    at Parser.readToken (/opt/tmp/gluestick/node_modules/babylon/lib/tokenizer/index.js:180:21)
    at Parser.<anonymous> (/opt/tmp/gluestick/node_modules/babylon/lib/plugins/jsx/index.js:51:20)
    at Parser.readToken (/opt/tmp/gluestick/node_modules/babylon/lib/plugins/flow.js:155:22)
    at Parser.nextToken (/opt/tmp/gluestick/node_modules/babylon/lib/tokenizer/index.js:169:21)
    at Parser.next (/opt/tmp/gluestick/node_modules/babylon/lib/tokenizer/index.js:81:12)
    at Parser.pp.parseIdentifier (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:1060:8)
    at Parser.pp.parseExprAtom (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:413:21)
    at Parser.parseExprAtom (/opt/tmp/gluestick/node_modules/babylon/lib/plugins/jsx/index.js:18:22)
    at Parser.pp.parseExprSubscripts (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:272:19)
    at Parser.pp.parseMaybeUnary (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:252:19)
    at Parser.pp.parseExprOps (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:183:19)
    at Parser.pp.parseMaybeConditional (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:165:19)
    at Parser.pp.parseMaybeAssign (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:128:19)
    at Parser.pp.parseExpression (/opt/tmp/gluestick/node_modules/babylon/lib/parser/expression.js:92:19)
    at Parser.pp.parseStatement (/opt/tmp/gluestick/node_modules/babylon/lib/parser/statement.js:163:19)
    at Parser.parseStatement (/opt/tmp/gluestick/node_modules/babylon/lib/plugins/flow.js:30:22)
    at Parser.pp.parseBlockBody (/opt/tmp/gluestick/node_modules/babylon/lib/parser/statement.js:529:21)
    at Parser.pp.parseTopLevel (/opt/tmp/gluestick/node_modules/babylon/lib/parser/statement.js:36:8)
    at Parser.parse (/opt/tmp/gluestick/node_modules/babylon/lib/parser/index.js:129:19)
    at parse (/opt/tmp/gluestick/node_modules/babylon/lib/index.js:47:47)
    at File.parse (/opt/tmp/gluestick/node_modules/babel-core/lib/transformation/file/index.js:540:58)
    at File.parseCode (/opt/tmp/gluestick/node_modules/babel-core/lib/transformation/file/index.js:626:20)
    at /opt/tmp/gluestick/node_modules/babel-core/lib/transformation/pipeline.js:52:12
    at File.wrap (/opt/tmp/gluestick/node_modules/babel-core/lib/transformation/file/index.js:586:16)
    at Pipeline.transform (/opt/tmp/gluestick/node_modules/babel-core/lib/transformation/pipeline.js:50:17)
    at Object.transformFileSync (/opt/tmp/gluestick/node_modules/babel-core/lib/api/node.js:152:10)
    at compile (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:129:20)
    at loader (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:158:14)
    at Object.require.extensions.(anonymous function) [as .js] (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (Home.js:4:1)
    at Module._compile (module.js:541:32)
    at loader (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (Home.test.js:1:1)
    at Module._compile (module.js:541:32)
    at loader (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/opt/tmp/gluestick/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at /opt/tmp/gluestick/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/opt/tmp/gluestick/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/opt/tmp/gluestick/node_modules/mocha/lib/mocha.js:468:10)
    at loadAndRun (/opt/tmp/gluestick/node_modules/mocha/bin/_mocha:359:22)
    at Object.<anonymous> (/opt/tmp/gluestick/node_modules/mocha/bin/_mocha:376:3)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:159:18)
    at node.js:444:3

@christinebrass
Copy link
Contributor

👍

@christinebrass christinebrass merged commit 4ffe2d7 into TrueCar:develop Jun 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants