Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the streamqueue dependency #18483

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 45 additions & 54 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");
Expand All @@ -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) {
Expand Down Expand Up @@ -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(
Expand All @@ -1764,33 +1758,30 @@ gulp.task(
setTestEnv,
"generic",
"components",
function runBotBrowserTest() {
return streamqueue(
Snuffleupagus marked this conversation as resolved.
Show resolved Hide resolved
{ 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");
})
);

Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down