Skip to content

Commit 9aac646

Browse files
committed
Fix tests
1 parent 83c4dbd commit 9aac646

7 files changed

Lines changed: 16 additions & 20 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest]
15-
node-version: [lts/*, '23']
15+
node-version: [lts/*, latest]
1616

1717
steps:
1818
- uses: actions/checkout@v6
@@ -34,7 +34,7 @@ jobs:
3434
uses: coverallsapp/github-action@v2
3535
with:
3636
github-token: ${{ secrets.GITHUB_TOKEN }}
37-
files: coverage/lcov.info
37+
files: lcov.info
3838
parallel: true
3939

4040
coverage:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sandbox.js
55
package-lock.json
66
public
77
coverage
8+
lcov.info
89
.tap
910
.tmp-*
1011

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import { basename, dirname, relative, resolve } from 'node:path'
1818
// @ts-expect-error
1919
import makeArray from 'make-array'
2020
import ignore from 'ignore'
21-
// @ts-expect-error
22-
import cpx from 'cpx2'
21+
import { watch as cpxWatch } from 'cpx2'
2322
import { inspect } from 'util'
2423
import browserSync from 'browser-sync'
2524
import { find } from '@11ty/dependency-tree-typescript'
@@ -250,8 +249,8 @@ export class DomStack {
250249
const copyDirs = getCopyDirs(this.opts.copy)
251250

252251
this.#cpxWatchers = [
253-
cpx.watch(getCopyGlob(this.#src), this.#dest, { ignore: this.opts.ignore }),
254-
...copyDirs.map(copyDir => cpx.watch(copyDir, this.#dest))
252+
cpxWatch(getCopyGlob(this.#src), this.#dest, { ignore: this.opts.ignore }),
253+
...copyDirs.map(copyDir => cpxWatch(copyDir, this.#dest))
255254
]
256255
if (serve) {
257256
const bs = browserSync.create()

lib/build-copy/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
* @import { BuildStepResult, BuildStep } from '../builder.js'
33
*/
44

5-
// @ts-expect-error
6-
import cpx from 'cpx2'
5+
import { copy } from 'cpx2'
76
import { join } from 'node:path'
8-
const copy = cpx.copy
97

108
/**
119
* @typedef {BuildStepResult<'static', CopyBuilderReport>} CopyBuildStepResult
@@ -51,7 +49,7 @@ export async function buildCopy (_src, dest, _siteData, opts) {
5149
const buildError = new Error('Error copying copy folders', { cause: result.reason })
5250
results.errors.push(buildError)
5351
} else {
54-
results.report[copyDir] = result.value
52+
/** @type {Record<string, object>} */ (results.report)[copyDir] = result.value
5553
}
5654
}
5755
return results

lib/build-static/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
* @import { BuildStepResult } from '../builder.js'
33
* @import { BuildStep } from '../builder.js'
44
*/
5-
// @ts-ignore
6-
import cpx from 'cpx2'
7-
const copy = cpx.copy
5+
import { copy } from 'cpx2'
86

97
/**
108
* @typedef {Awaited<ReturnType<typeof copy>>} StaticBuilderReport
@@ -42,7 +40,7 @@ export async function buildStatic (src, dest, _siteData, opts) {
4240
}
4341

4442
try {
45-
const report = await copy(getCopyGlob(src), dest, { ignore: opts?.ignore })
43+
const report = await copy(getCopyGlob(src), dest, ...(opts?.ignore ? [{ ignore: opts.ignore }] : []))
4644
results.report = report
4745
} catch (err) {
4846
const buildError = new Error('Error copying static files', { cause: err })

lib/helpers/generate-tree-data.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ export function generateTreeData (cwd, src, dest, results) {
128128
if (layoutInfo.layoutClient) targetNode.leaf[layoutInfo.layoutClient.basename] = join(layoutInfo.parentName, layoutInfo.layoutClient.outputName ?? layoutInfo.layoutClient.basename)
129129
}
130130

131-
if (results?.staticResults?.report?.copied) {
132-
for (const file of results?.staticResults?.report?.copied) {
131+
const staticReport = /** @type {{ copied?: Array<{ source: string, output: string }> }} */ (results?.staticResults?.report ?? {})
132+
if (staticReport?.copied) {
133+
for (const file of staticReport.copied) {
133134
const srcFile = relative(srcDir, file.source)
134135
const destFile = relative(destDir, file.output)
135136
const segments = srcFile.split(sep)

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/bcomnes/domstack/issues"
1515
},
1616
"engines": {
17-
"node": ">=22.0.0"
17+
"node": "^22.0.0 || >=24.0.0"
1818
},
1919
"dependencies": {
2020
"@11ty/dependency-tree-typescript": "^1.0.0",
@@ -57,15 +57,14 @@
5757
"write-package": "^7.0.1"
5858
},
5959
"devDependencies": {
60-
"c8": "^11.0.0",
61-
"cheerio": "^1.0.0-rc.10",
6260
"@types/browser-sync": "^2.29.0",
6361
"@types/js-yaml": "^4.0.9",
6462
"@types/markdown-it": "^14.1.1",
6563
"@types/markdown-it-footnote": "^3.0.4",
6664
"@types/node": "^25.3.0",
6765
"@voxpelli/tsconfig": "^16.0.0",
6866
"auto-changelog": "^2.4.0",
67+
"cheerio": "^1.0.0-rc.10",
6968
"gh-release": "^7.0.2",
7069
"installed-check": "^10.0.1",
7170
"jsonfeed-to-atom": "^1.2.5",
@@ -89,7 +88,7 @@
8988
"test": "npm run clean && run-s test:*",
9089
"test:installed-check": "installed-check --ignore-dev",
9190
"test:neostandard": "eslint . --ignore-pattern 'test-cases/build-errors/src/**/*.js' --ignore-pattern 'test-cases/page-build-errors/src/**/*.js'",
92-
"test:node-test": "c8 --reporter=lcov --reporter=text node --test --test-reporter spec",
91+
"test:node-test": "node --test --experimental-test-coverage --test-reporter=spec",
9392
"test:tsc": "tsc",
9493
"build-examples": "run-p example:*",
9594
"clean": "run-p clean:*",

0 commit comments

Comments
 (0)