diff --git a/gulpfile.mjs b/gulpfile.mjs index 211d4ae95a7a7..9385a4e8eaccb 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -41,7 +41,6 @@ import relative from "metalsmith-html-relative"; import rename from "gulp-rename"; import replace from "gulp-replace"; import stream from "stream"; -import streamqueue from "streamqueue"; import TerserPlugin from "terser-webpack-plugin"; import Vinyl from "vinyl"; import webpack2 from "webpack"; @@ -663,9 +662,8 @@ function getTempFile(prefix, suffix) { return filePath; } -function createTestSource(testsName, { bot = false, xfaOnly = false } = {}) { - const source = stream.Readable({ objectMode: true }); - source._read = function () { +function runTests(testsName, { bot = false, xfaOnly = false } = {}) { + return new Promise((resolve, reject) => { console.log(); console.log("### Running " + testsName + " tests"); @@ -699,8 +697,8 @@ function createTestSource(testsName, { bot = false, xfaOnly = false } = {}) { args.push("--integration"); break; default: - this.emit("error", new Error("Unknown name: " + testsName)); - return null; + reject(new Error(`Unknown tests name '${testsName}'`)); + return; } if (bot) { args.push("--strictVerify"); @@ -715,13 +713,11 @@ function createTestSource(testsName, { bot = false, xfaOnly = false } = {}) { const testProcess = startNode(args, { cwd: TEST_DIR, stdio: "inherit" }); testProcess.on("close", function (code) { if (code !== 0) { - throw new Error(`Running ${testsName} tests failed.`); + reject(new Error(`Running ${testsName} tests failed.`)); } - source.push(null); + resolve(); }); - return undefined; - }; - return source; + }); } function makeRef(done, bot) { @@ -1705,57 +1701,55 @@ function setTestEnv(done) { gulp.task( "test", - gulp.series(setTestEnv, "generic", "components", function runTest() { - return streamqueue( - { objectMode: true }, - createTestSource("unit"), - createTestSource("browser"), - createTestSource("integration") - ); + gulp.series(setTestEnv, "generic", "components", async function runTest() { + await runTests("unit"); + await runTests("browser"); + await runTests("integration"); }) ); gulp.task( "bottest", - gulp.series(setTestEnv, "generic", "components", function runBotTest() { - return streamqueue( - { objectMode: true }, - createTestSource("unit", { bot: true }), - createTestSource("browser", { bot: true }), - createTestSource("integration") - ); + gulp.series(setTestEnv, "generic", "components", async function runBotTest() { + await runTests("unit", { bot: true }); + await runTests("browser", { bot: true }); + await runTests("integration"); }) ); gulp.task( "xfatest", - gulp.series(setTestEnv, "generic", "components", function runXfaTest() { - return streamqueue( - { objectMode: true }, - createTestSource("unit"), - createTestSource("browser", { xfaOnly: true }), - createTestSource("integration") - ); + gulp.series(setTestEnv, "generic", "components", async function runXfaTest() { + await runTests("unit"); + await runTests("browser", { xfaOnly: true }); + await runTests("integration"); }) ); gulp.task( "botxfatest", - gulp.series(setTestEnv, "generic", "components", function runBotXfaTest() { - return streamqueue( - { objectMode: true }, - createTestSource("unit", { bot: true }), - createTestSource("browser", { bot: true, xfaOnly: true }), - createTestSource("integration") - ); - }) + gulp.series( + setTestEnv, + "generic", + "components", + async function runBotXfaTest() { + await runTests("unit", { bot: true }); + await runTests("browser", { bot: true, xfaOnly: true }); + await runTests("integration"); + } + ) ); gulp.task( "browsertest", - gulp.series(setTestEnv, "generic", "components", function runBrowserTest() { - return createTestSource("browser"); - }) + gulp.series( + setTestEnv, + "generic", + "components", + async function runBrowserTest() { + await runTests("browser"); + } + ) ); gulp.task( @@ -1764,33 +1758,30 @@ gulp.task( setTestEnv, "generic", "components", - function runBotBrowserTest() { - return streamqueue( - { objectMode: true }, - createTestSource("browser", { bot: true }) - ); + async function runBotBrowserTest() { + await runTests("browser", { bot: true }); } ) ); gulp.task( "unittest", - gulp.series(setTestEnv, "generic", function runUnitTest() { - return createTestSource("unit"); + gulp.series(setTestEnv, "generic", async function runUnitTest() { + await runTests("unit"); }) ); gulp.task( "integrationtest", - gulp.series(setTestEnv, "generic", function runIntegrationTest() { - return createTestSource("integration"); + gulp.series(setTestEnv, "generic", async function runIntegrationTest() { + await runTests("integration"); }) ); gulp.task( "fonttest", - gulp.series(setTestEnv, function runFontTest() { - return createTestSource("font"); + gulp.series(setTestEnv, async function runFontTest() { + await runTests("font"); }) ); diff --git a/package-lock.json b/package-lock.json index 60019134a03ce..c945dbf04bbca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,7 +57,6 @@ "postcss-nesting": "^12.1.5", "prettier": "^3.3.3", "puppeteer": "^22.13.0", - "streamqueue": "^1.1.2", "stylelint": "^16.7.0", "stylelint-prettier": "^5.0.0", "terser-webpack-plugin": "^5.3.10", @@ -8553,12 +8552,6 @@ "node": ">=0.10.0" } }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -12403,19 +12396,6 @@ "dev": true, "license": "MIT" }, - "node_modules/streamqueue": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/streamqueue/-/streamqueue-1.1.2.tgz", - "integrity": "sha512-CHUpqa+1BM99z7clQz9W6L9ZW4eXRRQCR0H+utVAGGvNo2ePlJAFjhdK0IjunaBbY/gWKJawk5kpJeyz0EXxRA==", - "dev": true, - "dependencies": { - "isstream": "^0.1.2", - "readable-stream": "^2.3.3" - }, - "engines": { - "node": ">=6.9.5" - } - }, "node_modules/streamx": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.18.0.tgz", diff --git a/package.json b/package.json index ee056e60c2071..a6b5572db235f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "postcss-nesting": "^12.1.5", "prettier": "^3.3.3", "puppeteer": "^22.13.0", - "streamqueue": "^1.1.2", "stylelint": "^16.7.0", "stylelint-prettier": "^5.0.0", "terser-webpack-plugin": "^5.3.10",