Open Zearin opened 3 months ago
What should I do to get the tests running normally? Using main
(39e7e9dac7ee1a794b789230f6e0608fd0fc7e0d), I see these errors with npm test:
✖ SCENARIO: Global Data (0.5592ms)
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:405:5)
at validateString (node:internal/validators:162:11)
at Object.resolve (node:path:167:9)
at SuiteContext.<anonymous> (file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-data-access.js:19:41)
at Suite.runInAsyncScope (node:async_hooks:203:9)
at new Suite (node:internal/test_runner/test:773:24)
at Test.createSubtest (node:internal/test_runner/test:386:18)
at run (node:internal/test_runner/harness:208:28)
at test (node:internal/test_runner/harness:215:39)
at file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-data-access.js:18:1 {
code: 'ERR_INVALID_ARG_TYPE'
}
✖ SCENARIO: Global Data Function (0.5525ms)
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:405:5)
at validateString (node:internal/validators:162:11)
at Object.resolve (node:path:167:9)
at SuiteContext.<anonymous> (file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-data-functions.js:19:41)
at Suite.runInAsyncScope (node:async_hooks:203:9)
at new Suite (node:internal/test_runner/test:773:24)
at Test.createSubtest (node:internal/test_runner/test:386:18)
at run (node:internal/test_runner/harness:208:28)
at test.<computed> [as only] (node:internal/test_runner/harness:218:7)
at file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-data-functions.js:18:10 {
code: 'ERR_INVALID_ARG_TYPE'
}
✖ GIVEN a minimal project and config (0.0357ms)
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:405:5)
at validateString (node:internal/validators:162:11)
at Object.resolve (node:path:167:9)
at SuiteContext.<anonymous> (file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-minimal-setup.js:43:37)
at Suite.runInAsyncScope (node:async_hooks:203:9)
at new Suite (node:internal/test_runner/test:773:24)
at Suite.createSubtest (node:internal/test_runner/test:386:18)
at run (node:internal/test_runner/harness:208:28)
at test (node:internal/test_runner/harness:215:39)
at SuiteContext.<anonymous> (file:///C:/Media/src/eleventy-plugin-pug/test/test-plugin-minimal-setup.js:42:2) {
code: 'ERR_INVALID_ARG_TYPE'
}
Yeah, I’m still learning how to write tests from scratch. I’m much more used to tweaking existing test suites.
I left some more feedback on your PR.
Thank you!
I added a new test case (
test/test-plugin-data-functions.js
) to see whether the global data files would allow an exported function to be used by Pug at compile-time.Nope!
Although the key (
daFunc
) was present in the cascade data passed to the anonymous inner async function, its value wasNaN
for reasons I can’t figure.