From 7860d98e7a6c291e45dabd13d9939ad17aae432d Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 2 Jan 2024 17:16:30 -0500 Subject: [PATCH] Favor ESM tests, ensure CJS still works. --- package.json | 2 +- test/{node-api.cjs => parse.test.js} | 93 ++-------------------- test/{node-api-esm.mjs => process.test.js} | 41 ++++++++-- test/require.test.cjs | 52 ++++++++++++ 4 files changed, 92 insertions(+), 96 deletions(-) rename test/{node-api.cjs => parse.test.js} (58%) rename test/{node-api-esm.mjs => process.test.js} (64%) create mode 100644 test/require.test.cjs diff --git a/package.json b/package.json index 137b627..e94792a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "scripts": { "build": "./build.sh", "prepack": "./build.sh", - "ci:node": "mocha", + "ci:node": "mocha 'test/*.{js,cjs}'", "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", "lint:package": "publint", "lint:published-types": "attw --pack --ignore-rules false-esm", diff --git a/test/node-api.cjs b/test/parse.test.js similarity index 58% rename from test/node-api.cjs rename to test/parse.test.js index 0b8c013..0e0c716 100644 --- a/test/node-api.cjs +++ b/test/parse.test.js @@ -1,6 +1,6 @@ -const { Preprocessor } = require("content-tag"); -const chai = require("chai"); -const { codeEquality } = require("code-equality-assertions/chai"); +import chai from "chai"; +import { codeEquality } from "code-equality-assertions/chai"; +import { Preprocessor } from "content-tag"; chai.use(codeEquality); @@ -8,7 +8,7 @@ const { expect } = chai; const p = new Preprocessor(); -describe("parse", function () { +describe(`parse`, function () { it("basic example", function () { let output = p.parse(""); @@ -173,91 +173,8 @@ describe("parse", function () { p.process( `const thing = "face";