Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GeorgeXCV opened this issue Sep 16, 2022 · 12 comments
Open

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

GeorgeXCV opened this issue Sep 16, 2022 · 12 comments
Labels
question Further information is requested

Comments

@GeorgeXCV
Copy link

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.
@annaet
Copy link
Contributor

annaet commented Sep 20, 2022

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 annaet added the question Further information is requested label Sep 20, 2022
@GeorgeXCV
Copy link
Author

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'
  },
});
`

@annaet
Copy link
Contributor

annaet commented Sep 20, 2022

Hi @GeorgeXCV

Can you try reinstalling the plugin?

@GeorgeXCV
Copy link
Author

Hi @GeorgeXCV

Can you try reinstalling the plugin?

Tried that already along with npm install.

@annaet
Copy link
Contributor

annaet commented Sep 20, 2022

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?

@GeorgeXCV
Copy link
Author

GeorgeXCV commented Sep 20, 2022

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

@annaet
Copy link
Contributor

annaet commented Sep 20, 2022

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
Copy link
Contributor

annaet commented Sep 21, 2022

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.

@GeorgeXCV
Copy link
Author

@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?

@sciborski
Copy link

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

@ruihua-zhao1
Copy link

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",

@billy-reify
Copy link

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") }); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants