Skip to content

grit apply chai_to_jest should remove chai imports if exists #209

@prabirshrestha

Description

@prabirshrestha

Given the following file.

import { expect } from 'chai';

describe('some test suite', function () {
  it('test should exist', function () {
    const test = 'test';
    expect(test).to.equal('test');
  });
});

When running grit apply chai_to_jest it converts the expect methods but the import { expect } from 'chai; is not removed.

import { expect } from 'chai';

describe('some test suite', function () {
  it('test should exist', function () {
    const test = 'test';
    expect(test).toBe('test');
  });
});

Workaround is to manually call remove_import.

grit apply 'remove_import(from=`"chai"`)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions