From 504a2b7631112f9863bbc8ec7dea1b0e0c191de3 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Sun, 10 Dec 2023 22:56:26 +0000 Subject: [PATCH] Use CommonJS for test files, matching package --- .prettierignore | 1 - test/lib/filters/{date.mjs => date.js} | 6 +++--- .../{items-from-collection.mjs => items-from-collection.js} | 6 +++--- .../{items-from-navigation.mjs => items-from-navigation.js} | 6 +++--- test/lib/filters/{markdown.mjs => markdown.js} | 6 +++--- test/lib/filters/{no-orphans.mjs => no-orphans.js} | 6 +++--- test/lib/filters/{pretty.mjs => pretty.js} | 6 +++--- test/lib/filters/{smart.mjs => smart.js} | 6 +++--- test/lib/filters/{tokenize.mjs => tokenize.js} | 6 +++--- test/lib/{markdown-it.mjs => markdown-it.js} | 6 +++--- test/lib/{utils.mjs => utils.js} | 6 +++--- 11 files changed, 30 insertions(+), 31 deletions(-) rename test/lib/filters/{date.mjs => date.js} (79%) rename test/lib/filters/{items-from-collection.mjs => items-from-collection.js} (71%) rename test/lib/filters/{items-from-navigation.mjs => items-from-navigation.js} (96%) rename test/lib/filters/{markdown.mjs => markdown.js} (75%) rename test/lib/filters/{no-orphans.mjs => no-orphans.js} (72%) rename test/lib/filters/{pretty.mjs => pretty.js} (68%) rename test/lib/filters/{smart.mjs => smart.js} (85%) rename test/lib/filters/{tokenize.mjs => tokenize.js} (64%) rename test/lib/{markdown-it.mjs => markdown-it.js} (92%) rename test/lib/{utils.mjs => utils.js} (88%) diff --git a/.prettierignore b/.prettierignore index bd15fa53..f6c492e8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,2 @@ # JavaScript (formatted with Standard) **/*.js -**/*.mjs diff --git a/test/lib/filters/date.mjs b/test/lib/filters/date.js similarity index 79% rename from test/lib/filters/date.mjs rename to test/lib/filters/date.js index 7dce63ce..e11d24c5 100644 --- a/test/lib/filters/date.mjs +++ b/test/lib/filters/date.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import date from '../../../lib/filters/date.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const date = require('../../../lib/filters/date.js') describe('Date filter', () => { it('Formats a date using tokens', () => { diff --git a/test/lib/filters/items-from-collection.mjs b/test/lib/filters/items-from-collection.js similarity index 71% rename from test/lib/filters/items-from-collection.mjs rename to test/lib/filters/items-from-collection.js index 2e9f2818..0f069b2c 100644 --- a/test/lib/filters/items-from-collection.mjs +++ b/test/lib/filters/items-from-collection.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import itemsFromCollection from '../../../lib/filters/items-from-collection.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const itemsFromCollection = require('../../../lib/filters/items-from-collection.js') const collectionData = [{ data: { diff --git a/test/lib/filters/items-from-navigation.mjs b/test/lib/filters/items-from-navigation.js similarity index 96% rename from test/lib/filters/items-from-navigation.mjs rename to test/lib/filters/items-from-navigation.js index 6e52a838..f421b7d5 100644 --- a/test/lib/filters/items-from-navigation.mjs +++ b/test/lib/filters/items-from-navigation.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import itemsFromNavigation from '../../../lib/filters/items-from-navigation.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const itemsFromNavigation = require('../../../lib/filters/items-from-navigation.js') const eleventyNavigationBreadcrumb = [{ key: 'Home', diff --git a/test/lib/filters/markdown.mjs b/test/lib/filters/markdown.js similarity index 75% rename from test/lib/filters/markdown.mjs rename to test/lib/filters/markdown.js index bb1874d7..2ce0ee14 100644 --- a/test/lib/filters/markdown.mjs +++ b/test/lib/filters/markdown.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import markdown from '../../../lib/filters/markdown.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const markdown = require('../../../lib/filters/markdown.js') describe('markdown filter', () => { it('Converts Markdown string to HTML', t => { diff --git a/test/lib/filters/no-orphans.mjs b/test/lib/filters/no-orphans.js similarity index 72% rename from test/lib/filters/no-orphans.mjs rename to test/lib/filters/no-orphans.js index 2a3ec3a1..820c5c8f 100644 --- a/test/lib/filters/no-orphans.mjs +++ b/test/lib/filters/no-orphans.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import noOrphans from '../../../lib/filters/no-orphans.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const noOrphans = require('../../../lib/filters/no-orphans.js') describe('noOrphans filter', () => { it('Inserts non-breaking space between last two words of a string', () => { diff --git a/test/lib/filters/pretty.mjs b/test/lib/filters/pretty.js similarity index 68% rename from test/lib/filters/pretty.mjs rename to test/lib/filters/pretty.js index 92a26b77..55560814 100644 --- a/test/lib/filters/pretty.mjs +++ b/test/lib/filters/pretty.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import pretty from '../../../lib/filters/pretty.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const pretty = require('../../../lib/filters/pretty.js') describe('pretty filter', () => { it('Removes index.html from a string', () => { diff --git a/test/lib/filters/smart.mjs b/test/lib/filters/smart.js similarity index 85% rename from test/lib/filters/smart.mjs rename to test/lib/filters/smart.js index a71014a2..fbb62afa 100644 --- a/test/lib/filters/smart.mjs +++ b/test/lib/filters/smart.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import smart from '../../../lib/filters/smart.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const smart = require('../../../lib/filters/smart.js') describe('smart filter', () => { it('Converts plain ASCII quotes into ‘smart’ typographic quotes', t => { diff --git a/test/lib/filters/tokenize.mjs b/test/lib/filters/tokenize.js similarity index 64% rename from test/lib/filters/tokenize.mjs rename to test/lib/filters/tokenize.js index 682621fa..cbf55e8f 100644 --- a/test/lib/filters/tokenize.mjs +++ b/test/lib/filters/tokenize.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import tokenize from '../../../lib/filters/tokenize.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const tokenize = require('../../../lib/filters/tokenize.js') describe('tokenize filter', () => { it('Reduces size of a string by removing duplicate and common words', () => { diff --git a/test/lib/markdown-it.mjs b/test/lib/markdown-it.js similarity index 92% rename from test/lib/markdown-it.mjs rename to test/lib/markdown-it.js index 35346887..325a9191 100644 --- a/test/lib/markdown-it.mjs +++ b/test/lib/markdown-it.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import md from '../../lib/markdown-it.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const md = require('../../lib/markdown-it.js') describe('markdown-it', () => { it('Returns configured markdown-it parser', () => { diff --git a/test/lib/utils.mjs b/test/lib/utils.js similarity index 88% rename from test/lib/utils.mjs rename to test/lib/utils.js index 1a48f8bd..234c0acf 100644 --- a/test/lib/utils.mjs +++ b/test/lib/utils.js @@ -1,6 +1,6 @@ -import { strict as assert } from 'node:assert' -import { describe, it } from 'node:test' -import { ensureSlash, normalise } from '../../lib/utils.js' +const assert = require('assert/strict') +const { describe, it } = require('node:test') +const { ensureSlash, normalise } = require('../../lib/utils.js') describe('Utility', () => { it('Ensures string ends with a slash', () => {