0

As per the conversation https://medium.com/p/b06559b35459/info,

When I tried to

import `{describe, it} from '@types/mocha'

I see

Error:-
/node_modules/@types/mocha/index.d.ts' is not a module

As per the example in serenity-js project :- serenity-js/examples/todomvc-protractor-mocha

serenity: {
    dialect: 'mocha',
    crew: [
        crew.serenityBDDReporter(),
        crew.consoleReporter(),
        crew.Photographer.who(_ => _
            .takesPhotosOf(_.Tasks_and_Interactions)
            .takesPhotosWhen(_.Activity_Finishes)
        )
    ]
},

When added in the master branch protractor.conf.js, It does not pick up the feature file. https://github.com/serenity-js/tutorial-from-scripts-to-serenity.git

Can you please let know how do i use mocha in the project?

Jan Molak
  • 4,426
  • 2
  • 36
  • 32
divya
  • 1
  • 1

1 Answers1

0

Mocha's describe and it functions are defined in the global scope and @types/mocha definitions reflect that. This means that you don't need to import them explicitly, as simply having the @types/mocha dependency installed makes those definitions available to the TypeScript compiler:

By default all visible “@types” packages are included in your compilation. Packages in node_modules/@types of any enclosing folder are considered visible; specifically, that means packages within ./node_modules/@types/, ../node_modules/@types/, ../../node_modules/@types/, and so on.

-- TypeScript manual.


Please note that using Serenity/JS with Mocha is described in the Serenity/JS Handbook.

You might also find the example project useful.

Jan Molak
  • 4,426
  • 2
  • 36
  • 32