Closed cemremengu closed 5 years ago
Looks like it is not windows something in my local. Here is my stack trace that fails:
test/composite.test.js Error: anonymous function
at checkName (C:\Users\cemre.mengu\Desktop\fastify-plugin\index.js:45:11)
at plugin (C:\Users\cemre.mengu\Desktop\fastify-plugin\index.js:26:20)
at Test.t (C:\Users\cemre.mengu\Desktop\fastify-plugin\test\composite.test.js:10:14)
at bound (domain.js:396:14)
at Test.runBound (domain.js:409:12)
at ret (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:278:21)
at Test.main (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:282:7)
at writeSubComment (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:371:13)
at TAP.writeSubComment (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:403:5)
at Test.runBeforeEach (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:370:14)
at loop (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\function-loop\index.js:35:15)
at TAP.runBeforeEach (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:683:7)
at TAP.processSubtest (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:369:12)
at TAP.process (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:306:14)
at TAP.sub (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:185:10)
at TAP.test (C:\Users\cemre.mengu\Desktop\fastify-plugin\node_modules\tap\lib\test.js:209:17)
test/composite.test.js ................................ 0/2
anonymous function should be named composite.test
not ok should be equal
+++ found
--- wanted
-composite.test
+cemre
compare: ===
at:
line: 14
column: 5
file: test/composite.test.js
type: Test
function: t
stack: |
Test.t (test/composite.test.js:14:5)
loop (node_modules/function-loop/index.js:35:15)
Object.<anonymous> (test/composite.test.js:7:1)
source: |
t.is(fn[Symbol.for('plugin-meta')].name, 'composite.test')
It is because I have .
in my username (cemre.mengu). Working on the patch
If you register an anonymous plugin inside fastify this part leads to confusing plugin names.
For example
will return
cemre
as the name of the plugin for me instead of the file name which was very confusing since it is my first name 😄I think this is due to windows (the regex fails there) since all tests fail for me as well.