You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
karl@karl-Dell-Precision-M3800:~/dev/MOP$ npx tsc --project tsconfig.test.json
node_modules/@types/mocha/index.d.ts:17:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Mocha, before, suiteSetup, after, suiteTeardown, beforeEach, setup, afterEach, teardown, mocha, MochaDone, ReporterConstructor
17 declare class Mocha {
~~~~~~~
node_modules/cypress/types/mocha/index.d.ts:6:1
6 interface MochaSetupOptions {
~~~~~~~~~
Conflicts are in this file.
node_modules/@types/mocha/index.d.ts:22:33 - error TS2694: Namespace 'Mocha' has no exported member 'MochaOptions'.
22 constructor(options?: Mocha.MochaOptions);
~~~~~~~~~~~~
node_modules/@types/mocha/index.d.ts:24:18 - error TS2694: Namespace 'Mocha' has no exported member 'Suite'.
24 suite: Mocha.Suite;
~~~~~
/// <reference types="cypress" />describe('example client e2e test',function(){it('should just pass',asyncfunction(){assert(true);});});
Mocha test file:
import*asassertfrom'assert';suite('example server integration test',function(): void{test('should just pass',asyncfunction(): Promise<void>{assert(true);});});
It is very possible that this has nothing to do with it "BUT" I did have something similar pop up when using the /// directives at the top of the page. I had to remove them from all the cypress tests and then configure the tsconfig to properly include the cypress types. I think I had to nest tsconfigs and extend a base one due to how my project is setup (monorepo).
Attempting to transpile TypeScript Cypress and Mocha test files at the same time.
Type files are at:
Errors:
Cypress test file:
Mocha test file:
Versions:
Temporary solution is to transpile them separately with their own types. Any idea of how one can make these play nice with each other?
If you are wondering what I am doing here, I am using Cypress for e2e and Mocha + JSDom for unit and integration tests.
The text was updated successfully, but these errors were encountered: