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 8caec2b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 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;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"node": ">=12"
},
"scripts": {
"test": "xo && nyc ava && tsd"
"test": "xo && ava && tsd"
},
"files": [
"index.js",
Expand Down
7 changes: 3 additions & 4 deletions test/browser.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import util from 'util';
import fs from 'fs';
import body from 'body';
import ava from 'ava'; // eslint-disable-line ava/use-test
import test from 'ava';
import createTestServer from 'create-test-server';
import Busboy from 'busboy';
import withPage from './helpers/with-page.js';

const test = ava.serial;
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 +324,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 8caec2b

Please sign in to comment.