ember-codemods / ember-mocha-codemods

Codemod scripts for ember-mocha
MIT License
4 stars 6 forks source link

Update Babel-preset-env to fix unit tests #114

Closed jbryson3 closed 4 years ago

jbryson3 commented 4 years ago

After downloading the repo, I tried to run the unit tests using npm test. None of the tests ran, due to what seemed like a babel error.

image

After upgrading babel-preset-env to latest, the unit tests are now passing using npm test.

jbryson3 commented 4 years ago

Hmm, it seems that I've broken the CI tests. I'll have to look into that

jbryson3 commented 4 years ago

I fixed the CI tests by migrating the two older transforms (import-it-from-mocha, new-testing-api) to CommonJS modules (module.exports) to align with the newest transform: fourteen-testing-api.

Additionally, I aligned the testing methodology for those 2 older transforms. They were using defineTest with hardcoded test names. Now they are using the same runInlineTest that fourteen-testing-api is using. It has the added advantage that I can run those tests directly from my IDE now (Intellij).

Turbo87 commented 4 years ago

I don't understand the issue here. CI on the master branch is passing fine, so I'm wondering what this PR is fixing? 🤔

jbryson3 commented 4 years ago

You're absolutely right, the master branch is passing in CI, so must've been a problem with my setup. I was able to reproduce the issue, and it turns out that I ran npm install instead of yarn install. With npm install I get the errors after initial installation. With yarn install everything is good.

There's still a couple of changes that could be relevant:

  1. I could modify the README.md to include a building/testing section to guide users to yarn install
  2. We could keep the changes provided by commits 1c021bc, 5265c58

Let me know how you'd prefer to proceed

Turbo87 commented 4 years ago
1. I could modify the README.md to include a building/testing section to guide users to `yarn install`

I think CONTRIBUTING.md might be better suited for that

2\. We could keep the changes provided by commits [1c021bc](https://github.com/ember-codemods/ember-mocha-codemods/commit/1c021bc613890b43c6d8d42e91df7576d084bf3f), [5265c58](https://github.com/ember-codemods/ember-mocha-codemods/commit/5265c584240319d7829eabbc2e9e3eb28ab2081a)

since these are all unrelated changes I would suggest to open dedicated PRs for those if you want to land them. that way we can discuss and merge them individually.

I'll go ahead and close this PR since the original change with preset-env is apparently not needed anymore :)