title: How to share a global variable between test files from a test in TestCafe?
body: <p>I'm manually setting auth cookies for my login purpose and I would like to share the Auth token across my tests. The very first time I have to perform a login in a test and then I have to save the auth token in a variable and share it across the test files.</p>
  
  <p>Here is the code snippet to explain what and how I'm trying to do:</p>
  
  <p><strong>loginTest.js :</strong></p>
  
  <pre><code>let authToken = null;
  
  fixture`Login test`
    .page(inputData.url)
    .beforeEach(async (t) =&gt; {
      const nextMonth = new Date();
      nextMonth.setMonth(nextMonth.getMonth() + 1);
      await t.navigateTo(inputData.url).then(await setCookie('AUTH_COOKIE_ID', authToken, nextMonth));
    });
  
  test
    .before(async () =&gt; {
      await loginPage.login(inputData.firstUserEmailId, inputData.firstUserPassword);
      authToken = await getCookie('AUTH_COOKIE_ID');
    })('Verify login test', async (t) =&gt; {
      await loginPage.goToPeople(personName);
      await t
        .expect(loginPage.personName.exists)
        .ok();
    });
  </code></pre>
  
  <p>Now, after the test, I have the actual <code>authToken</code> (not null) and if I have to share the <strong><code>authToken</code></strong> variable across all my tests in all my files then how do I do? with this coding design I can share <code>authToken</code> in the same file (test suite). for example:</p>
  
  <p>I have a file <strong>peopleTest.js</strong> :</p>
  
  <pre><code>fixture`People test`
    .page(inputData.url)
    .beforeEach(async (t) =&gt; {
      const nextMonth = new Date();
      nextMonth.setMonth(nextMonth.getMonth() + 1);
      await t.navigateTo(inputData.url).then(await setCookie('AUTH_COOKIE_ID', loginTest.authToken, nextMonth));
    });
  
  test('Verify people test', async (t) =&gt; {
      await loginPage.goToPeople(personName);
      await t
        .expect(loginPage.personName.exists)
        .ok();
    });
  </code></pre>
  
  <p>In the above test, if I can do <strong><code>loginTest.authToken</code></strong> that would be great. </p>
  
  <p>PS: In case, people are wondering why I'm doing setting cookie instead of using <code>useRole</code>. Just to let you know that the <code>useRole</code> didn't work in my setup as the application sets the cookie manually in my local env so I have to manually set the cookie as a login workaround.</p>