title: SyntaxError: Unexpected identifier - GraphQLService
body: <p>I'm just stuck on this one particular issue and hoping someone might be able to help, my ide is complaining about a syntax error Unexpected identifier, Im assuming I have a typo somewhere, but am at a loss to find it.</p>
  <p>Error message:</p>
  <pre><code>
    ● Test suite failed to run
  
      /Users/jake/learning/pact-testing-project/consumer/pact.spec.js:1
      ({&quot;Object.&lt;anonymous&gt;&quot;:function(module,exports,require,__dirname,__filename,global,jest){import GraphQLService from &quot;./api.service.graphql&quot;;
                                                                                                      ^^^^^^^^^^^^^^
  
      SyntaxError: Unexpected identifier
  
        at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
  </code></pre>
  <p>and here is the code:
  organisation.js</p>
  <pre><code>class Organisation {
      constructor(name, id) {
          this.id = id;
          this.name = name;
      }
  
      static validateName(organisation) {
          if (typeof organisation.name !== 'string') {
              throw new Error(`organisation name must be a string! Invalid value: ${organisation.name}`)
          }
      }
  
      static validateId(organisation) {
          if (typeof organisation.id !== 'number') {
              throw new Error(`organisation id must be a number! Invalid value: ${organisation.id}`)
          }
      }
  }
  
  export default Organisation
  </code></pre>
  <p>api.service.graphql.js</p>
  <pre><code>import Organisation from &quot;./organisation&quot;;
  import {ApolloClient} from &quot;apollo-client&quot;;
  import {InMemoryCache} from &quot;apollo-cache-inmemory&quot;;
  import {HttpLink} from &quot;apollo-link-http&quot;;
  import gql from &quot;graphql-tag&quot;;
  
  class GraphQLService {
  
      constructor(baseUrl, port, fetch) {
          this.client = new ApolloClient({
              link: new HttpLink({
                  uri: `${baseUrl}:${port}/graphql`,
                  fetch: fetch
              }),
              cache: new InMemoryCache()
          });
      }
  
      getOrganisation(organisationId) {
          if (organisationId == null) {
              throw new Error(&quot;organisation id must not be null&quot;);
          }
          return this.client.query({
              query: gql`
              query GetOrganisation($organisationid: Int!) {
              organisation(id: $organisationid) {
                  name
                  }
              }
              `,
              variables: {
                  organisationId: organisationId
              }
          }).then((response) =&gt; {
              return new Promise((resolve, reject) =&gt; {
                  try {
                      const organisation = new Organisation(response.data.organisation.name, organisationId);
                      Organisation.validateName(organisation);
                      resolve(organisation);
                  } catch (error) {
                      reject(error);
                  }
              });
          });
      };
  }
  export default GraphQLService;
  </code></pre>
  <p>pact.spec.js (which houses the test that I'm trying to run)</p>
  <pre><code>import GraphQLService from &quot;./api.service.graphql&quot;;
  import Pact from &quot;@pact-foundation/pact&quot;;
  import fetch from &quot;node-fetch&quot;;
  import Organisation from &quot;./organisation&quot;;
  
  describe(&quot;OrganisationService GraphQL API&quot;, () =&gt; {
  
      const OrganisationService = new GraphQLService('http://localhost', global.port, fetch);
  
      // a matcher for the content type &quot;application/json&quot; in UTF8 charset
      // that ignores the spaces between the &quot;;2 and &quot;charset&quot;
      const contentTypeJsonMatcher = Pact.Matchers.term({
          matcher: &quot;application\\/json; *charset=utf-8&quot;,
          generate: &quot;application/json; charset=utf-8&quot;
      });
  
      describe('getOrganisation()', () =&gt; {
  
          beforeEach((done) =&gt; {
  
              global.provider.addInteraction(new Pact.GraphQLInteraction()
                  .uponReceiving('a GetOrganisation Query')
                  .withRequest({
                      path: '/graphql',
                      method: 'POST',
                  })
                  .withOperation(&quot;getOrganisation&quot;)
                  .withQuery(`
                      query GetOrganisation($organisationid: Int!) {
                        organisation(id: $organisationid) {
                            name
                        }
                      }`)
                  .withVariables({
                      organisationId: 1
                  })
                  .willRespondWith({
                      status: 200,
                      headers: {
                          'Content-Type': contentTypeJsonMatcher
                      },
                      body: {
                          data: {
                              hero: {
                                  name: Pact.Matchers.somethingLike('example')
                              }
                          }
                      }
                  })).then(() =&gt; done());
          });
  
          it('sends a request according to contract', (done) =&gt; {
              OrganisationService.getOrganisation(1)
                  .then(organisation =&gt; {
                      expect(organisation.name).toEqual('example');
                  })
                  .then(() =&gt; {
                      global.provider.verify()
                          .then(() =&gt; done(), error =&gt; {
                              done.fail(error)
                          })
                  });
          });
  
      });
  
  });
  </code></pre>