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

Add test suite along with support for Webpack v3 #41

Merged
merged 1 commit into from
Jul 27, 2017

Conversation

fny
Copy link
Contributor

@fny fny commented Jul 4, 2017

This pull requests adds what I'd say is a pretty good start for a test suite along with some small tweaks to support Webpack v3. This hopefully closes both #25 and #40!

Note I couldn't entirely figure out how to get a list of watched files, so there are two watched dependencies tests that need finishing.

🍻

@rhys-vdw
Copy link
Collaborator

rhys-vdw commented Jul 5, 2017

Hey @fny, this is awesome! I have to check it out and give it a spin, but looks it looks great. Thanks. :D

@rhys-vdw
Copy link
Collaborator

rhys-vdw commented Jul 6, 2017

Yo @fny. I tried to run the suite and hit the syntax error reported above. Let me know your plan and if you'd like help with anything. I'm happy to leave out the incomplete tests in preference for getting what you've done so far merged.

btw, not necessary for this PR, but it would be nice to get a test case for a transformer path with a space in it, see #35.

test.js Outdated
test('loads with erb', function (done) {
compile2({ file: 'engine.js.erb', engine: 'erb' }, done, function (stats) {
expect(stats.compilation.errors).toEqual([])
expectInOutput('var engine = 'erb'')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like there's a syntax error here (and in the other similar tests).

> rails-erb-loader@5.0.2 test /Users/rhys/Projects/usability-hub/erb-loader
> jest

 FAIL  ./test.js
  ● Test suite failed to run

    /Users/rhys/Projects/usability-hub/erb-loader/test.js: Unexpected token, expected , (66:34)
        64 |   compile2({ file: 'engine.js.erb', engine: 'erb' }, done, function (stats) {
        65 |     expect(stats.compilation.errors).toEqual([])
      > 66 |     expectInOutput('var engine = 'erb'')
           |                                   ^
        67 |     done()
        68 |   })
        69 | })

@rhys-vdw
Copy link
Collaborator

rhys-vdw commented Jul 7, 2017

Great. Working well!

There's a few more things to do... I'm just listing these here for posterity. Let me know if you're interested in doing any of these. No pressure, I'm happy to merge now, and then we can move these into different issues to be tackled later by yourself or others.

Configure ESLint for jest

Add https://www.npmjs.com/package/eslint-plugin-jest and in the test file:

/* eslint-env jest/globals */

So that we don't get undefined errors for all the globals defined by jest.

Expand test script

  1. Run ESLint
  2. Run webpack 2 tests
  3. Run webpack 3 tests

Set up TravisCI

I can do this, but the goal would be to set up CI for PRs and such. Should run the test command.

Add tests for watchers

Two tests marked "skipped" in file.

Once these are done we can enable jest/no-disabled-tests

Add test for runner path with a space in it

See #35

Add hooks to npm standard scripts

See npm scripts

  • Run tests on prepublishOnly script
  • Run bundle install on postinstall script so that Ruby dependencies will be installed with npm dependencies

@rhys-vdw
Copy link
Collaborator

rhys-vdw commented Jul 24, 2017

@fny I'll merge this tomorrow and move the above TODO points to issues unless you're interested in doing any more on this PR. Thanks again for your contribution.

@rhys-vdw rhys-vdw merged commit 0e3dd5b into usabilityhub:master Jul 27, 2017
This was referenced Jul 27, 2017
@rhys-vdw
Copy link
Collaborator

These changes have been release in 5.1.0.

See #42 #43 #44 for remaining test issues.

@fny
Copy link
Contributor Author

fny commented Jul 30, 2017 via email

@rhys-vdw
Copy link
Collaborator

All good. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants