fix: non-forked packages breaking web build (#225)

pull/196/head
Adam Pash 5 years ago committed by GitHub
parent f3f6e21fd8
commit 0e22947e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,9 +94,9 @@
"watchify": "^3.11.0" "watchify": "^3.11.0"
}, },
"dependencies": { "dependencies": {
"browser-request": "^0.3.3", "browser-request": "postlight/browser-request#feat-add-headers-to-response",
"cheerio": "^0.22.0", "cheerio": "^0.22.0",
"difflib": "^0.2.4", "difflib": "postlight/difflib.js",
"ellipsize": "0.1.0", "ellipsize": "0.1.0",
"iconv-lite": "0.4.24", "iconv-lite": "0.4.24",
"jquery": "^3.3.1", "jquery": "^3.3.1",

@ -16,7 +16,15 @@ let urls = [
]; ];
// don't run this on CI b/c we want to avoid network requests // don't run this on CI b/c we want to avoid network requests
if (process.env.CI) { if (
process.env.CI ||
(typeof __karma__ !== 'undefined' && __karma__.config.args[0] === '--CI')
) {
if (cheerio.browser) {
require('../dist/mercury.web');
}
// eslint-disable-next-line no-unused-expressions
typeof Mercury === 'undefined' && require('../dist/mercury');
describe('Tests', () => { describe('Tests', () => {
it('do not run because this is CI and we do not want network requests', () => { it('do not run because this is CI and we do not want network requests', () => {
assert.equal(true, true); assert.equal(true, true);

@ -64,5 +64,9 @@ module.exports = function(config) {
// Concurrency level // Concurrency level
// how many browser should be started simultaneous // how many browser should be started simultaneous
concurrency: Infinity, concurrency: Infinity,
client: {
args: config.CI ? ['--CI'] : [],
},
}); });
}; };

@ -31,11 +31,10 @@ const stop = () => {
server && server.close(); server && server.close();
}; };
if (!process.env.CI) { start();
start(); require('child_process').execSync(
require('child_process').execSync( 'node ./node_modules/karma/bin/karma start ./scripts/karma.conf.js' +
'node ./node_modules/karma/bin/karma start ./scripts/karma.conf.js', (process.env.CI ? ' --CI' : ''),
{ stdio: [0, 1, 2] } { stdio: [0, 1, 2] }
); );
stop(); stop();
}

@ -102,8 +102,12 @@ export default async function fetchResource(url, parsedUrl) {
gzip: true, gzip: true,
// Follow any non-GET redirects // Follow any non-GET redirects
followAllRedirects: true, followAllRedirects: true,
// Follow GET redirects ...(typeof window !== 'undefined'
followRedirect: true, ? {}
: {
// Follow GET redirects; this option is for Node only
followRedirect: true,
}),
}; };
const { response, body } = await get(options); const { response, body } = await get(options);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save