diff --git a/gulpfile.js b/gulpfile.js index 7534586c9..af384de83 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -28,7 +28,11 @@ const paths = { '!**/dev-prelude.js', ...IGNORED_PACKAGES, ], - packageOther: ['packages/*/*/src/**/dev-prelude.js'], + packageOther: [ + 'packages/*/*/src/**/dev-prelude.js', + // This has to have some glob syntax so that vinyl.base will be right + 'packages/{runtimes,}/js/src/helpers/*.ts', + ], packages: 'packages/', }; diff --git a/packages/core/integration-tests/test/rust.js b/packages/core/integration-tests/test/rust.js index 7ef66455e..79fc99177 100644 --- a/packages/core/integration-tests/test/rust.js +++ b/packages/core/integration-tests/test/rust.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -48,12 +49,14 @@ describe.skip('rust', function () { // not minified assert( + // $FlowFixMe old api, test is skipped (await outputFS.stat(Array.from(b.childBundles)[0].name)).size > 500, ); }); it('should generate a wasm file from a rust file with rustc with --target=node', async function () { this.timeout(500000); + // $FlowFixMe old api, test is skipped let b = await bundle(path.join(__dirname, '/integration/rust/index.js'), { target: 'node', }); @@ -84,6 +87,7 @@ describe.skip('rust', function () { // not minified assert( + // $FlowFixMe old api, test is skipped (await outputFS.stat(Array.from(b.childBundles)[0].name)).size > 500, ); }); @@ -91,6 +95,7 @@ describe.skip('rust', function () { it('should support rust files with dependencies via rustc', async function () { this.timeout(500000); let b = bundler(path.join(__dirname, '/integration/rust-deps/index.js')); + // $FlowFixMe old api, test is skipped let bundle = await b.bundle(); await assertBundleTree(bundle, { diff --git a/packages/core/integration-tests/test/schema-jsonld.js b/packages/core/integration-tests/test/schema-jsonld.js index faaf9641b..cdd9ff867 100644 --- a/packages/core/integration-tests/test/schema-jsonld.js +++ b/packages/core/integration-tests/test/schema-jsonld.js @@ -1,3 +1,4 @@ +// @flow import { assertBundles, bundle, @@ -14,7 +15,9 @@ describe.v2('jsonld', function () { let b = await bundle( path.join(__dirname, '/integration/schema-jsonld/index.html'), { - publicURL: 'https://place.holder/', + defaultTargetOptions: { + publicUrl: 'https://place.holder/', + }, }, ); @@ -47,25 +50,29 @@ describe.v2('jsonld', function () { ); let contentBetweenScriptTag = new RegExp( /<\s*script \s*type="application\/ld\+json"\s*>(.*)<\/\s*script\s*>/gm, - ).exec(file)[1]; + ).exec(file)?.[1]; let jsonldData = assertValidJsonObject(contentBetweenScriptTag); - match(jsonldData.logo.url, /logo\.[a-f0-9]+\.png/); - match(jsonldData.image[0], /image\.[a-f0-9]+\.jpeg/); - match(jsonldData.image[1], /image\.[a-f0-9]+\.jpeg/); + match(jsonldData?.logo.url, /logo\.[a-f0-9]+\.png/); + match(jsonldData?.image[0], /image\.[a-f0-9]+\.jpeg/); + match(jsonldData?.image[1], /image\.[a-f0-9]+\.jpeg/); }); }); -function match(test, pattern) { +function match(test?: string, pattern: RegExp | string) { + if (!test) return assert.fail(); let success = new RegExp(pattern).test(test); if (success) { - assert.ok(`'${test}' matched the given pattern of '${pattern}'`); + assert.ok(`'${test}' matched the given pattern of '${pattern.toString()}'`); return; } - assert.fail(`'${test}' did not match the given pattern of '${pattern}'`); + assert.fail( + `'${test}' did not match the given pattern of '${pattern.toString()}'`, + ); } -function assertValidJsonObject(dataAsString) { +function assertValidJsonObject(dataAsString?: string) { + if (!dataAsString) return assert.fail(); try { let data = JSON.parse(dataAsString); assert.ok('input string is a valid json object'); diff --git a/packages/core/integration-tests/test/svg.js b/packages/core/integration-tests/test/svg.js index 1b51ecd65..a1c2604c5 100644 --- a/packages/core/integration-tests/test/svg.js +++ b/packages/core/integration-tests/test/svg.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import { assertBundles, @@ -52,51 +53,59 @@ describe('svg', function () { }, ]); - let file = await outputFS.readFile( - b.getBundles().find((b) => b.type === 'svg').filePath, - 'utf-8', - ); + let svgBundle = b.getBundles().find((b) => b.type === 'svg'); + if (!svgBundle) return assert.fail(); + + let file = await outputFS.readFile(svgBundle.filePath, 'utf-8'); assert(file.includes('')); assert(file.includes(' b.name.startsWith('square')); + if (!squareBundle) return assert.fail(); + assert( file.includes( - ` b.name.startsWith('gradient')); + if (!gradientBundle) return assert.fail(); + assert( file.includes( - `fill="url('/${path.basename( - b.getBundles().find((b) => b.name.startsWith('gradient')).filePath, - )}#myGradient')"`, + `fill="url('/${path.basename(gradientBundle.filePath)}#myGradient')"`, ), ); + + let scriptBundle = b + .getBundles() + .find((b) => b.type === 'js' && b.env.sourceType === 'script'); + if (!scriptBundle) return assert.fail(); + assert( file.includes( - `