cypress-tags icon indicating copy to clipboard operation
cypress-tags copied to clipboard

Suite argument "title" must be a string. Received type "object"

Open GeorgeXCV opened this issue 2 years ago • 12 comments

I'm following the same format as ReadMe yet I keep getting an error, why?

Example:

/// <reference types='cypress-tags' />
describe(['@smoke'], 'User Privileges - Standard User', () => {

Error:

The following error originated from your test code, not from Cypress.

  > Suite argument "title" must be a string. Received type "object"

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

GeorgeXCV avatar Sep 16 '22 04:09 GeorgeXCV

Hi @GeorgeXCV

It sounds like the preprocessor isn't set up correctly.

Can you show what you've got in your cypress.config.ts file please?

annaet avatar Sep 20 '22 08:09 annaet

Hi @GeorgeXCV

It sounds like the preprocessor isn't set up correctly.

Can you show what you've got in your cypress.config.ts file please?

I lost my changes and now I can't get the package to work at all: Cannot find module 'cypress-tags' or its corresponding type declarations.ts(2307)

This was config file:

import { defineConfig } from "cypress";
import { checkGmail, CheckGmailParam } from "../core-cypress/cypress/plugins/checkGmail";
import * as path from "path";
import * as fs from "fs"
import admin from 'firebase-admin';
import { plugin as cypressFirebasePlugin } from 'cypress-firebase';
import * as serviceAccountDev from './cypress/support/serviceAccountKeyDev.json'
import { tagify } from 'cypress-tags';

export default defineConfig({
  e2e: {
    async setupNodeEvents(on, config) {
      const version = config.env.version || 'development'
      const configFile = await import(path.join(
        config.projectRoot,
        'cypress/config',
        `${version}.json`
      ));
      if (version == 'development') {
        cypressFirebasePlugin(on, config, admin, {
          credential: admin.credential.cert(serviceAccountDev as admin.ServiceAccount)
        });
      config.projectId = ""
      config.baseUrl = configFile.baseUrl
      config.env = configFile.env
      config.defaultCommandTimeout = 10000
      config.chromeWebSecurity = false
      config.videoCompression = 15 // Speed up video compression
      on("task", {
        async checkGmail(args: CheckGmailParam) {
          return await checkGmail(args);
        },
      });
      on('after:spec', (_spec, results) => {
        if (results && results.stats.failures === 0 && results.video) {
          fs.unlink(results.video, (err) => {
            if (err) console.log(`Failed to delete video with error: ${err}`)
            return
          })
        }
      })
      on('file:preprocessor', tagify(config));
      return config
    },
    reporter: 'mochawesome'
  },
});
`

GeorgeXCV avatar Sep 20 '22 12:09 GeorgeXCV

Hi @GeorgeXCV

Can you try reinstalling the plugin?

annaet avatar Sep 20 '22 12:09 annaet

Hi @GeorgeXCV

Can you try reinstalling the plugin?

Tried that already along with npm install.

GeorgeXCV avatar Sep 20 '22 12:09 GeorgeXCV

Can you give me the version of cypress-tags and Cypress that you're using?

And can you confirm Cypress is working as expected when you remove the cypress-tags plugin?

annaet avatar Sep 20 '22 12:09 annaet

Can you give me the version of cypress-tags and Cypress that you're using?

"cypress": "^10.1.0",
"cypress-tags": "^1.1.1",

And can you confirm Cypress is working as expected when you remove the cypress-tags plugin?

Yes

GeorgeXCV avatar Sep 20 '22 13:09 GeorgeXCV

And you can see cypress-tags is installed when you run npm ls cypress-tags?

I'm not sure why node wouldn't be able to find the package if it's all installed.

annaet avatar Sep 20 '22 13:09 annaet

Hi @GeorgeXCV

This appeared to be an issue with 1.1.1, a new version 1.1.2 has now be released that should fix the issue.

annaet avatar Sep 21 '22 11:09 annaet

@annaet Thanks, seems to work now! Although I have one last issue, I get this error when running tests:

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'.

It is caused by this line: on('file:preprocessor', tagify(config));.

Is it some project configuration required that is not included in ReadMe?

GeorgeXCV avatar Sep 23 '22 10:09 GeorgeXCV

Although I have one last issue, I get this error when running tests:

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'.

It is caused by this line: on('file:preprocessor', tagify(config));.

Is it some project configuration required that is not included in ReadMe?

Having the same issue

sciborski avatar Nov 09 '22 09:11 sciborski

I follow the readme but I got the error "Suite argument "title" must be a string. Received type "object". Could anyone help me? "cypress": "^12.8.1", "cypress-tags": "^1.1.2",

ruihua-zhao1 avatar Mar 16 '23 09:03 ruihua-zhao1

Seeing same error as above when I attempt to execute any test: "Suite argument "title" must be a string. Received type "object". "cypress": "^11.2.0" "cypress-tags": "^1.1.2"

describe(["DESC_TEST"],"Desc_Title", () => { it(["it_tag"],"It_title", ()=> { cy.log("hello world") }); });

billy-reify avatar Mar 17 '23 10:03 billy-reify