Skip to content

Commit

Permalink
Add test to check for the presence of expected output files
Browse files Browse the repository at this point in the history
  • Loading branch information
ty2k committed Aug 19, 2024
1 parent 12c5f8f commit 8e58de3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/design-tokens/build-output.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { exec } from "child_process";
import { existsSync } from "fs";
import { test } from "node:test";
import assert from "node:assert";
import { join } from "path";

test("build-output.js should complete without errors", async () => {
try {
Expand All @@ -25,3 +27,23 @@ test("build-output.js should complete without errors", async () => {
assert.fail(error.message);
}
});

test("output files should exist after running build-output.js", async () => {
const outputFiles = [
"build/css/variables.css",
"build/css-prefixed/variables.css",
"build/js/index.js",
"build/js/index.d.ts",
"build/js-prefixed/index.js",
"build/js-prefixed/index.d.ts",
"build/cjs/index.js",
"build/cjs/index.d.ts",
"build/cjs-prefixed/index.js",
"build/cjs-prefixed/index.d.ts",
];

for (const file of outputFiles) {
const filePath = join(process.cwd(), file);
assert.ok(existsSync(filePath), `Expected file ${file} to exist`);
}
});

0 comments on commit 8e58de3

Please sign in to comment.