Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Duplicate identifier error #3792

Closed
BorntraegerMarc opened this issue Dec 5, 2016 · 4 comments
Closed

Duplicate identifier error #3792

BorntraegerMarc opened this issue Dec 5, 2016 · 4 comments
Assignees

Comments

@BorntraegerMarc
Copy link

  • Node Version: 6.9.1
  • Protractor Version: 4.0.11
  • Angular Version: 2.1.2
  • Operating System and Version chrome, ubuntu 16 LTS
  • Your protractor configuration file
exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['./protractor/**-spec.js'],

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true
    }
};

Shouldn't https://github.com/angular/protractor/blob/master/package.json#L15 be declared as a dev dependency?
Opened up this bug after submitting: DefinitelyTyped/DefinitelyTyped#13064

I've started a new angular2 project and included the following dev dependency:
"@types/mocha": "2.2.33",

It installs correctly however when I run:
webpack --config webpack.config.dev.js --progress --profile --watch

I get:

[at-loader] node_modules/@types/jasmine/index.d.ts:15:18 
    Duplicate identifier 'xit'. 

[at-loader] node_modules/@types/mocha/index.d.ts:33:13 
    Duplicate identifier 'describe'. 

[at-loader] node_modules/@types/mocha/index.d.ts:34:13 
    Duplicate identifier 'xdescribe'. 

[at-loader] node_modules/@types/mocha/index.d.ts:39:13 
    Duplicate identifier 'it'. 

[at-loader] node_modules/@types/mocha/index.d.ts:40:13 
    Duplicate identifier 'xit'. 

My webpack config file:

var webpack = require('webpack');

module.exports = {
    devtool: 'cheap-module-eval-source-map',

    output: {
        path: './public/js/app',
        publicPath: "/js/app/",
        filename: 'bundle.js',
        chunkFilename: '[id].chunk.js'
    },
    entry: {
        'app': './assets/app/main.polymer.ts'
    },

    resolve: {
        extensions: ['.js', '.ts']
    },

    module: {
        loaders: [
            {
                test: /\.ts$/,
                loaders: [
                    'awesome-typescript-loader',
                    'angular2-template-loader',
                    'angular2-router-loader'
                ]
            },
            {
                test: /\.html$/,
                loader: 'html'
            },
            {
                test: /\.css$/,
                loader: 'raw'
            }
        ]
    },

    plugins: [
        new webpack.ContextReplacementPlugin(
            // The (\\|\/) piece accounts for path separators in *nix and Windows
            /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
            './src' // location of your src
        )
    ]
};

Same thing happens with @types/jasmine:
Just found out that the errors:

[at-loader] node_modules/@types/jasmine/index.d.ts:9:18 
    Duplicate identifier 'describe'. 

[at-loader] node_modules/@types/jasmine/index.d.ts:11:18 
    Duplicate identifier 'xdescribe'. 

[at-loader] node_modules/@types/jasmine/index.d.ts:13:18 
    Duplicate identifier 'it'. 

[at-loader] node_modules/@types/jasmine/index.d.ts:15:18 
    Duplicate identifier 'xit'. 

Apparently this happens when I write my tests with mocha and use protractor for e2e tests.

@cnishina
Copy link
Contributor

cnishina commented Dec 5, 2016

Yup, we'll change this. Thanks for reporting it.

@BorntraegerMarc
Copy link
Author

@cnishina created pull request #3793

cnishina added a commit to cnishina/protractor that referenced this issue Dec 5, 2016
cnishina added a commit to cnishina/protractor that referenced this issue Dec 5, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes angular#3792
cnishina added a commit to cnishina/protractor that referenced this issue Dec 5, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes angular#3792
@cnishina
Copy link
Contributor

cnishina commented Dec 5, 2016

Since this is a potential breaking change to existing jasmine users, I've opened PR #3795 to fix this in the upcoming release for selenium3 in the beta branch. This specific package does not require import {it} from 'jasmine' similarly to how the the mocha typings are written. This is a good idea to move this out.

We still use q types in plugins and I believe that should be included until we eventually remove q. Also, we export some @types/selenium-webdriver under the Protractor typings so that should be maintained.

A work around would be to set your types array in your tsconfig and to not include jasmine type:

{
   "compilerOptions": {
       "types" : ["node", "lodash", "express"]
   }
}

This tsconfig.json file will only include ./node_modules/@types/node, ./node_modules/@types/lodash and ./node_modules/@types/express. Other packages under node_modules/@types/* will not be included.

from https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

cnishina added a commit that referenced this issue Dec 5, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
@cnishina
Copy link
Contributor

cnishina commented Dec 5, 2016

closed with #3795

@cnishina cnishina closed this as completed Dec 5, 2016
cnishina added a commit to cnishina/protractor that referenced this issue Dec 5, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes angular#3792
cnishina added a commit that referenced this issue Dec 8, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
heathkit pushed a commit to heathkit/protractor that referenced this issue Dec 15, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes angular#3792
heathkit pushed a commit to heathkit/protractor that referenced this issue Dec 19, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes angular#3792
juliemr pushed a commit that referenced this issue Dec 19, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
juliemr pushed a commit that referenced this issue Dec 20, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
juliemr pushed a commit that referenced this issue Dec 21, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
juliemr pushed a commit that referenced this issue Dec 22, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
juliemr pushed a commit that referenced this issue Dec 28, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
sjelin pushed a commit that referenced this issue Dec 28, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
juliemr pushed a commit that referenced this issue Dec 29, 2016
- update outdated dependencies
- move @types/jasmine to devDependencies

closes #3792
shtaft pushed a commit to shtaft/jest-fetch-mock that referenced this issue Aug 27, 2018
Since jest functions are global, their typing tends to conflict with other global properties in
global space. This commit moves jest typings to devDependencies, where they won't be
included for projects that require jest-fetch-mock.

This is very similar to a protractor issue, reference here-
angular/protractor#3792
angular/protractor#3795
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants