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

Migrate e2e tests to TypeScript #7990

Merged
merged 21 commits into from
Feb 26, 2019
Merged

Conversation

natealcedo
Copy link
Contributor

This is a work in progress PR. Doing this mostly to see if the test suite will pass. The test suite on master isn't passing on my machine. Renamed the files in the __tests__ in the e2e folder. MockStdinPlugin, runJest and Utils have yet to be migrated.

@SimenB SimenB added this to the TypeScript Migration milestone Feb 26, 2019
@SimenB
Copy link
Member

SimenB commented Feb 26, 2019

The failing test is e2e/__tests__/iterator-to-null-test.ts, btw

@SimenB
Copy link
Member

SimenB commented Feb 26, 2019

gah, that fails on master (and has been failing for a long time) as well, but the test pattern doesn't pick it up.

So just ignore that failure for now 🙂

@natealcedo
Copy link
Contributor Author

Hmm, I'm not sure how to debug these actually. It seems that a different version of node throws a different error.

Going by circle CI output

Node 6:

TypeError: (var)[Symbol.iterator] is not a function
        at Function.race (native)

      at mapper (packages/jest-jasmine2/build/queueRunner.js:47:23)

Node 8:

TypeError: object is not a function
    at Function.race (<anonymous>)

  at mapper (packages/jest-jasmine2/build/queueRunner.js:47:23)

(node:300) UnhandledPromiseRejectionWarning: TypeError: object is not a function
    at Function.race (<anonymous>)
    at mapper (/home/circleci/jest/packages/jest-jasmine2/build/queueRunner.js:47:23)
    at promise.then (/home/circleci/jest/packages/jest-jasmine2/build/queueRunner.js:71:41)
    at <anonymous>

Node 10:


TypeError: [object Array] is not iterable
    at Function.race (<anonymous>)

  at mapper (packages/jest-jasmine2/build/queueRunner.js:47:23)

(node:320) UnhandledPromiseRejectionWarning: TypeError: [object Array] is not iterable

@SimenB
Copy link
Member

SimenB commented Feb 26, 2019

That test has been broken since August 2017 when Promise.race was introduced in #4016. Seems we didn't run it :(

@natealcedo
Copy link
Contributor Author

natealcedo commented Feb 26, 2019

Locally, these tests are failing for me.

image

System:
OS: macOS High Sierra 10.13.6
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
Yarn: 1.13.0 - ~/.nvm/versions/node/v8.15.0/bin/yarn
npm: 6.8.0 - ~/.nvm/versions/node/v8.15.0/bin/npm

Edit:
Oh prolly ignore the mercurial issue. I'm trying to get that resolved locally.

Disregarding the mercurial tests failing, it seems that the only failing test for me is e2e/__tests__/iterator-to-null-test.ts. Let me try to migrate the utils and see how things go.

@SimenB
Copy link
Member

SimenB commented Feb 26, 2019

Opened up #7993 for the iterator test

e2e/MockStdinWatchPlugin.js Outdated Show resolved Hide resolved
e2e/Utils.ts Outdated
@@ -83,6 +84,7 @@ export const writeFiles = (
createDirectory(path.join.apply(path, [directory].concat(filePath)));
}
fs.writeFileSync(
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the ignore? The code looks really convoluted (I guess it's from a time before rest params), could we do

path.resolve(directory, ...filePath, filename),

?

Same above, just do path.join(directory, ...filePath)

Copy link
Contributor Author

@natealcedo natealcedo Feb 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh the issue here was that filename is can possibly undefined from the pop call. It doesnt fit the type expected by path.resolve

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed up some changes to make the code simpler regarding your comments. I'll just continue tomorrow. It's midnight where I'm at. Happy coding :)

@SimenB
Copy link
Member

SimenB commented Feb 26, 2019

I hit the failing iterator test previously as well: #4630.

It should be ignored for now, mind fixing the pattern? https://github.com/facebook/jest/blob/12542a27089d9fc30ce321aa0e06e71de5f45e09/jest.config.js#L57

@natealcedo
Copy link
Contributor Author

Sure thing. Lemme push it up real quick then

e2e/MockStdinWatchPlugin.js Outdated Show resolved Hide resolved
e2e/Utils.ts Outdated Show resolved Hide resolved
e2e/Utils.ts Outdated Show resolved Hide resolved
@SimenB SimenB changed the title [WIP] Migrate/e2e tests Migrate e2e tests to TypeScript Feb 26, 2019
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm too lazy to test locally before pushing 😅 Should be good now, though.

Thanks!

@SimenB SimenB merged commit a782ce5 into jestjs:master Feb 26, 2019
@natealcedo natealcedo deleted the migrate/e2e-tests branch February 28, 2019 13:57
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants