Skip to content

Commit

Permalink
Fix browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 6, 2021
1 parent 67c6cf3 commit b0d076c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,6 @@ const createInstance = defaults => {
return ky;
};

export default createInstance();
const ky = createInstance();

export default ky;
4 changes: 2 additions & 2 deletions test/browser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import util from 'util';
import fs from 'fs';
import body from 'body';
import ava from 'ava'; // eslint-disable-line ava/use-test
import createTestServer from 'create-test-server';
Expand All @@ -11,7 +12,7 @@ const pBody = util.promisify(body);
const kyScript = {
type: 'module',
content: `
import ky from './index.js';
${fs.readFileSync(new URL('../index.js', import.meta.url), 'utf8')}
window.ky = ky;
`
};
Expand Down Expand Up @@ -324,7 +325,6 @@ test('headers are preserved when input is a Request and there are searchParams i
response.end();
});

await page.setBypassCSP(true);
await page.goto(server.url);
await page.addScriptTag(kyScript);

Expand Down

0 comments on commit b0d076c

Please sign in to comment.