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

Wallaby TypeScript Integration vs tsc #1050

Closed
KnisterPeter opened this issue Feb 28, 2017 · 2 comments
Closed

Wallaby TypeScript Integration vs tsc #1050

KnisterPeter opened this issue Feb 28, 2017 · 2 comments

Comments

@KnisterPeter
Copy link

Hi there,

I have an issue configuring wallaby for my project (https://github.com/KnisterPeter/react-to-typescript-definitions/tree/wallaby).
In the referenced branch there is a wallaby.conf.js file which defines the setup and it looks fine. But when executing the tests 10 of them are failing.
When inspecting the instrumented wallaby code I noticed a difference from the tsc output when just running npm test.

The difference is the handling of enum values (like in #160) but the const enum in my dependency is exported so it should work.

Any hint on what to change?

@ArtemGovorov
Copy link
Member

Hi,

First of all you'll need to update to the latest core as there was a bug with loading definition files that we have fixed recently.

Once updated, you'll just need to add a couple of files to your wallaby config:

  • node_modules/dts-dom/package.json
  • node_modules/dts-dom/bin/index.d.ts.

You need to do this, because one of the enums in the package is defined as export const enum, unlike others that are defined as export enum.

If the enum was defined like others in the module, it would end up being defined in the generated module code, and this wouldn't be required. But because wallaby runs the TS complier on its own file cache, it needs to know about these couple of files (the definition file and the package.json that points the TS compiler to the definition file), because the mentioned enum is not defined in the node_modules/dts-dom/bin/index.js file like others, but only in the node_modules/dts-dom/bin/index.d.ts file.

So here's the config that should work for you:

module.exports = function(wallaby) {
  process.env.WALLABY = 'true';
  return {
    files: [
      'src/**/*.ts',
      {pattern: 'tests/**/*.js*', instrument: false},
      {pattern: 'tests/**/*.d.ts', instrument: false},
      {pattern: 'node_modules/dts-dom/package.json', instrument: false},
      {pattern: 'node_modules/dts-dom/bin/index.d.ts', instrument: false}
    ],
    tests: [
      'tests/**/*-test.ts'
    ],
    env: {
      type: 'node'
    },
    testFramework: 'ava',
    debug: false
  };
}

(I have also expanded your tests/**/*.js* to include .js files because of your test requires a .js file from the folder, not just .jsx)

@KnisterPeter
Copy link
Author

Thanks 🚀

KnisterPeter added a commit to KnisterPeter/dts-dom that referenced this issue Mar 1, 2017
To have the enums in the typings and as well in the transpiled code they
must not be declared as const.
This way we could work around a problem with wallaby:
wallabyjs/public#1050 (comment)
nanizaloog added a commit to nanizaloog/dts-dom that referenced this issue Aug 26, 2024
To have the enums in the typings and as well in the transpiled code they
must not be declared as const.
This way we could work around a problem with wallaby:
wallabyjs/public#1050 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants