You need to change the character on commands.ts file from ' to `
So, the code would be like this:
Cypress.Commands.add("getByData", (selector) => { return cy.get([data-test=${selector}]) })
[data-test=${selector}]
save and it should work