Skip to content

Commit

Permalink
Merge pull request #497 from trivikr/bump-jest-26
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel15 authored Mar 30, 2022
2 parents 331f80e + d8150c8 commit be4a67a
Show file tree
Hide file tree
Showing 3 changed files with 2,051 additions and 1,964 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.9.0",
"jest": "^21",
"jest": "^26",
"jsdoc": "^3.4.0",
"mkdirp": "^0.5.1"
},
Expand Down
15 changes: 7 additions & 8 deletions src/__tests__/Worker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ const createTempFileWith = testUtils.createTempFileWith;
const getFileContent = testUtils.getFileContent;

describe('Worker API', () => {
let worker;

beforeEach(() => {
jest.resetModuleRegistry();
worker = require('../Worker');
});

it('transforms files', done => {
const worker = require('../Worker');
const transformPath =
createTransformWith('return fileInfo.source + " changed";');
const sourcePath = createTempFileWith('foo');
Expand All @@ -38,6 +32,7 @@ describe('Worker API', () => {
});

it('passes j as argument', done => {
const worker = require('../Worker');
const transformPath = createTempFileWith(
`module.exports = function (file, api) {
return api.j(file.source).toSource() + ' changed';
Expand Down Expand Up @@ -76,6 +71,7 @@ describe('Worker API', () => {
}

it('errors if new flow type code is parsed with babel v5', done => {
const worker = require('../Worker');
const transformPath = createTransformWith(
'api.jscodeshift(fileInfo.source); return "changed";'
);
Expand All @@ -92,6 +88,7 @@ describe('Worker API', () => {

['flow', 'babylon'].forEach(parser => {
it(`uses ${parser} if configured as such`, done => {
const worker = require('../Worker');
const transformPath = getTransformForParser(parser);
const sourcePath = getSourceFile();
const emitter = worker([transformPath]);
Expand All @@ -107,6 +104,7 @@ describe('Worker API', () => {

['babylon', 'flow', 'tsx'].forEach(parser => {
it(`can parse JSX with ${parser}`, done => {
const worker = require('../Worker');
const transformPath = getTransformForParser(parser);
const sourcePath = createTempFileWith(
'var component = <div>{foobar}</div>;'
Expand All @@ -122,7 +120,8 @@ describe('Worker API', () => {
});
});

it(`can parse enums with flow`, done => {
it('can parse enums with flow', done => {
const worker = require('../Worker');
const transformPath = getTransformForParser('flow');
const sourcePath = createTempFileWith(
'enum E {A, B}'
Expand Down
Loading

0 comments on commit be4a67a

Please sign in to comment.